Update to rmcp 1.1.0 (#7619)
Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
@@ -393,12 +393,8 @@ mod tests {
|
||||
_messages: &[Message],
|
||||
_tools: &[Tool],
|
||||
) -> Result<MessageStream, ProviderError> {
|
||||
let tool_call = CallToolRequestParams {
|
||||
meta: None,
|
||||
task: None,
|
||||
name: "test_tool".into(),
|
||||
arguments: Some(object!({"param": "value"})),
|
||||
};
|
||||
let tool_call = CallToolRequestParams::new("test_tool")
|
||||
.with_arguments(object!({"param": "value"}));
|
||||
let message = Message::assistant().with_tool_request("call_123", Ok(tool_call));
|
||||
|
||||
let usage = ProviderUsage::new(
|
||||
|
||||
@@ -136,42 +136,42 @@ enum TestMode {
|
||||
#[test_case(
|
||||
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: "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 })) }
|
||||
CallToolRequestParams::new("echo").with_arguments(object!({"message": "Hello, world!" })),
|
||||
CallToolRequestParams::new("get-sum").with_arguments(object!({"a": 1, "b": 2 })),
|
||||
CallToolRequestParams::new("trigger-long-running-operation").with_arguments(object!({"duration": 1, "steps": 5 })),
|
||||
CallToolRequestParams::new("get-structured-content").with_arguments(object!({"location": "New York"})),
|
||||
CallToolRequestParams::new("trigger-sampling-request").with_arguments(object!({"prompt": "Please provide a quote from The Great Gatsby", "maxTokens": 100 }))
|
||||
],
|
||||
vec![]
|
||||
)]
|
||||
#[test_case(
|
||||
vec!["github-mcp-server", "stdio"],
|
||||
vec![
|
||||
CallToolRequestParams { meta: None, task: None, name: "get_file_contents".into(), arguments: Some(object!({
|
||||
CallToolRequestParams::new("get_file_contents").with_arguments(object!({
|
||||
"owner": "block",
|
||||
"repo": "goose",
|
||||
"path": "README.md",
|
||||
"sha": "ab62b863c1666232a67048b6c4e10007a2a5b83c"
|
||||
}))},
|
||||
})),
|
||||
],
|
||||
vec!["GITHUB_PERSONAL_ACCESS_TOKEN"]
|
||||
)]
|
||||
#[test_case(
|
||||
vec!["uvx", "mcp-server-fetch"],
|
||||
vec![
|
||||
CallToolRequestParams { meta: None, task: None, name: "fetch".into(), arguments: Some(object!({
|
||||
CallToolRequestParams::new("fetch").with_arguments(object!({
|
||||
"url": "https://example.com",
|
||||
})) }
|
||||
}))
|
||||
],
|
||||
vec![]
|
||||
)]
|
||||
#[test_case(
|
||||
vec!["uv", "run", "--with", "fastmcp==2.14.4", "fastmcp", "run", "tests/fastmcp_test_server.py"],
|
||||
vec![
|
||||
CallToolRequestParams { meta: None, task: None, name: "divide".into(), arguments: Some(object!({
|
||||
CallToolRequestParams::new("divide").with_arguments(object!({
|
||||
"dividend": 10,
|
||||
"divisor": 2
|
||||
})) }
|
||||
}))
|
||||
],
|
||||
vec![]
|
||||
)]
|
||||
@@ -271,12 +271,11 @@ async fn test_replayed_session(
|
||||
.await?;
|
||||
let mut results = Vec::new();
|
||||
for tool_call in tool_calls {
|
||||
let tool_call = CallToolRequestParams {
|
||||
meta: None,
|
||||
task: None,
|
||||
name: format!("test__{}", tool_call.name).into(),
|
||||
arguments: tool_call.arguments,
|
||||
};
|
||||
let mut new_call = CallToolRequestParams::new(format!("test__{}", tool_call.name));
|
||||
if let Some(args) = tool_call.arguments {
|
||||
new_call = new_call.with_arguments(args);
|
||||
}
|
||||
let tool_call = new_call;
|
||||
let result = extension_manager
|
||||
.dispatch_tool_call(
|
||||
"test-session-id",
|
||||
|
||||
@@ -13,12 +13,7 @@ fn test_repetition_inspector_denies_after_exceeding_and_resets_on_param_change()
|
||||
let mut inspector = RepetitionInspector::new(Some(2));
|
||||
|
||||
// First identical call → allowed
|
||||
let call_v1 = CallToolRequestParams {
|
||||
meta: None,
|
||||
task: None,
|
||||
name: "fetch_user".into(),
|
||||
arguments: Some(object!({"id": 123})),
|
||||
};
|
||||
let call_v1 = CallToolRequestParams::new("fetch_user").with_arguments(object!({"id": 123}));
|
||||
assert!(inspector.check_tool_call(call_v1.clone()));
|
||||
|
||||
// Second identical call → still allowed (at limit)
|
||||
@@ -28,12 +23,7 @@ fn test_repetition_inspector_denies_after_exceeding_and_resets_on_param_change()
|
||||
assert!(!inspector.check_tool_call(call_v1.clone()));
|
||||
|
||||
// Change parameters; this should reset the consecutive counter
|
||||
let call_v2 = CallToolRequestParams {
|
||||
meta: None,
|
||||
task: None,
|
||||
name: "fetch_user".into(),
|
||||
arguments: Some(object!({"id": 456})),
|
||||
};
|
||||
let call_v2 = CallToolRequestParams::new("fetch_user").with_arguments(object!({"id": 456}));
|
||||
|
||||
assert!(inspector.check_tool_call(call_v2.clone()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user