chore: add #[non_exhaustive] and mutation methods to improve compatibility (#715)
* chore: add #[non_exhaustive] to reduce backwards-incompatible changes going forward * fix: remove ProtocolVersion import * fix: add a few more with_ mutator methods --------- Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
parent
79834b6211
commit
f63718d202
3 changed files with 1568 additions and 1110 deletions
|
|
@ -53,10 +53,7 @@ impl Calculator {
|
|||
#[tool_handler]
|
||||
impl ServerHandler for Calculator {
|
||||
fn get_info(&self) -> ServerInfo {
|
||||
ServerInfo {
|
||||
instructions: Some("A simple calculator".into()),
|
||||
capabilities: ServerCapabilities::builder().enable_tools().build(),
|
||||
..Default::default()
|
||||
}
|
||||
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
|
||||
.with_instructions("A simple calculator")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,15 +48,14 @@ async fn main() -> anyhow::Result<()> {
|
|||
println!("Calling sum tool: {}", sum_tool.name);
|
||||
let result = client
|
||||
.peer()
|
||||
.call_tool(rmcp::model::CallToolRequestParams {
|
||||
meta: None,
|
||||
name: sum_tool.name.clone(),
|
||||
arguments: Some(rmcp::object!({
|
||||
"a": 10,
|
||||
"b": 20
|
||||
})),
|
||||
task: None,
|
||||
})
|
||||
.call_tool(
|
||||
rmcp::model::CallToolRequestParams::new(sum_tool.name.clone()).with_arguments(
|
||||
rmcp::object!({
|
||||
"a": 10,
|
||||
"b": 20
|
||||
}),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Result: {:?}", result);
|
||||
|
|
|
|||
|
|
@ -46,15 +46,14 @@ async fn main() -> anyhow::Result<()> {
|
|||
println!("Calling sum tool: {}", sum_tool.name);
|
||||
let result = client
|
||||
.peer()
|
||||
.call_tool(rmcp::model::CallToolRequestParams {
|
||||
meta: None,
|
||||
name: sum_tool.name.clone(),
|
||||
arguments: Some(rmcp::object!({
|
||||
"a": 10,
|
||||
"b": 20
|
||||
})),
|
||||
task: None,
|
||||
})
|
||||
.call_tool(
|
||||
rmcp::model::CallToolRequestParams::new(sum_tool.name.clone()).with_arguments(
|
||||
rmcp::object!({
|
||||
"a": 10,
|
||||
"b": 20
|
||||
}),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("Result: {:?}", result);
|
||||
|
|
|
|||
Loading…
Reference in a new issue