Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/goose/tests/fastmcp_test_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Annotated

from fastmcp import FastMCP

mcp = FastMCP("mymcp")


@mcp.tool
def divide(
dividend: Annotated[float, "Dividend/numerator of the division."],
divisor: Annotated[float, "Divisor/denominator of the division."],
) -> Annotated[float, "Result of the division."]:
"""Divide two numbers and return the result."""
return dividend / divisor
38 changes: 10 additions & 28 deletions crates/goose/tests/mcp_integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ enum TestMode {
}

#[test_case(
vec!["npx", "-y", "@modelcontextprotocol/server-everything"],
vec!["npx", "-y", "@modelcontextprotocol/server-everything@2026.1.14"],
vec![
CallToolRequestParams { meta: None, task: None, name: "echo".into(), arguments: Some(object!({"message": "Hello, world!" })) },
CallToolRequestParams { meta: None, task: None, name: "add".into(), arguments: Some(object!({"a": 1, "b": 2 })) },
CallToolRequestParams { meta: None, task: None, name: "longRunningOperation".into(), arguments: Some(object!({"duration": 1, "steps": 5 })) },
CallToolRequestParams { meta: None, task: None, name: "structuredContent".into(), arguments: Some(object!({"location": "11238"})) },
CallToolRequestParams { meta: None, task: None, name: "sampleLLM".into(), arguments: Some(object!({"prompt": "Please provide a quote from The Great Gatsby", "maxTokens": 100 })) }
CallToolRequestParams { meta: None, task: None, name: "get-sum".into(), arguments: Some(object!({"a": 1, "b": 2 })) },
CallToolRequestParams { meta: None, task: None, name: "trigger-long-running-operation".into(), arguments: Some(object!({"duration": 1, "steps": 5 })) },
CallToolRequestParams { meta: None, task: None, name: "get-structured-content".into(), arguments: Some(object!({"location": "New York"})) },
CallToolRequestParams { meta: None, task: None, name: "trigger-sampling-request".into(), arguments: Some(object!({"prompt": "Please provide a quote from The Great Gatsby", "maxTokens": 100 })) }
],
vec![]
)]
Expand All @@ -152,30 +152,12 @@ enum TestMode {
vec![]
)]
#[test_case(
vec!["cargo", "run", "--quiet", "-p", "goose-server", "--bin", "goosed", "--", "mcp", "developer"],
vec!["uv", "run", "--with", "fastmcp==2.14.4", "fastmcp", "run", "tests/fastmcp_test_server.py"],
vec![
CallToolRequestParams { meta: None, task: None, name: "text_editor".into(), arguments: Some(object!({
"command": "view",
"path": "/tmp/goose_test/goose.txt"
}))},
CallToolRequestParams { meta: None, task: None, name: "text_editor".into(), arguments: Some(object!({
"command": "str_replace",
"path": "/tmp/goose_test/goose.txt",
"old_str": "# goose",
"new_str": "# goose (modified by test)"
}))},
// Test shell command to verify file was modified
CallToolRequestParams { meta: None, task: None, name: "shell".into(), arguments: Some(object!({
"command": "cat /tmp/goose_test/goose.txt"
})) },
// Test text_editor tool to restore original content
CallToolRequestParams { meta: None, task: None, name: "text_editor".into(), arguments: Some(object!({
"command": "str_replace",
"path": "/tmp/goose_test/goose.txt",
"old_str": "# goose (modified by test)",
"new_str": "# goose"
}))},
CallToolRequestParams { meta: None, task: None, name: "list_windows".into(), arguments: Some(object!({})) },
CallToolRequestParams { meta: None, task: None, name: "divide".into(), arguments: Some(object!({
"dividend": 10,
"divisor": 2
})) }
Comment on lines +155 to +160

Copilot AI Jan 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FastMCP test uses a relative script path ("tests/fastmcp_test_server.py"), but extensions are launched with the test process current_dir (often the workspace root or ./crates in CI), so recording replays will fail to find the script; use an absolute path derived from env!("CARGO_MANIFEST_DIR") (e.g., via concat!) so it works regardless of where cargo test is run from.

Copilot uses AI. Check for mistakes.
],
vec![]
)]
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading