From 39e1484d01fe38b9c18fb1932c275665d1ce4112 Mon Sep 17 00:00:00 2001 From: Bob Liu Date: Tue, 1 Apr 2025 23:46:00 +0800 Subject: [PATCH] chore: fix typos --- crates/rmcp-macros/src/tool.rs | 14 +++++++------- crates/rmcp/tests/test_complex_schema.rs | 4 ++-- examples/rig-integration/src/config.rs | 2 +- examples/rig-integration/src/main.rs | 2 +- examples/servers/src/common/calculator.rs | 4 ++-- examples/servers/src/common/counter.rs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/rmcp-macros/src/tool.rs b/crates/rmcp-macros/src/tool.rs index feed535..7e4947c 100644 --- a/crates/rmcp-macros/src/tool.rs +++ b/crates/rmcp-macros/src/tool.rs @@ -360,7 +360,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu // async fn #tool_tool_call(context: rmcp::handler::server::tool::ToolCallContext<'_, Self>) // -> std::result::Result // - // and the block part shoule be like: + // and the block part should be like: // { // use rmcp::handler::server::tool::*; // let (t0, context) = ::from_tool_call_context_part(context)?; @@ -383,8 +383,8 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu // for receiver type, name it as __rmcp_tool_receiver let is_async = input_fn.sig.asyncness.is_some(); let receiver_ident = || Ident::new("__rmcp_tool_receiver", proc_macro2::Span::call_site()); - // generate the extraction part for trival args - let trival_args = input_fn + // generate the extraction part for trivial args + let trivial_args = input_fn .sig .inputs .iter() @@ -413,8 +413,8 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu Some(line) } }); - let trival_argrextraction_part = quote! { - #(#trival_args)* + let trivial_argrextraction_part = quote! { + #(#trivial_args)* }; let processed_argrextraction_part = match &mut tool_macro_attrs.params { ToolParams::Aggregated { rust_type } => { @@ -441,7 +441,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu } }; // generate the execution part - // has reveiver? + // has receiver? let params = &input_fn .sig .inputs @@ -487,7 +487,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu #raw_fn_vis async fn #tool_call_fn_ident(context: rmcp::handler::server::tool::ToolCallContext<'_, Self>) -> std::result::Result { use rmcp::handler::server::tool::*; - #trival_argrextraction_part + #trivial_argrextraction_part #processed_argrextraction_part #call } diff --git a/crates/rmcp/tests/test_complex_schema.rs b/crates/rmcp/tests/test_complex_schema.rs index 7829314..b9370fc 100644 --- a/crates/rmcp/tests/test_complex_schema.rs +++ b/crates/rmcp/tests/test_complex_schema.rs @@ -44,7 +44,7 @@ impl Demo { fn test_complex_schema() { let attr = Demo::chat_tool_attr(); let input_schema = attr.input_schema; - let enum_numer = input_schema + let enum_number = input_schema .get("definitions") .unwrap() .as_object() @@ -58,6 +58,6 @@ fn test_complex_schema() { .as_array() .unwrap() .len(); - assert_eq!(enum_numer, 4); + assert_eq!(enum_number, 4); println!("{}", serde_json::to_string_pretty(&input_schema).unwrap()); } diff --git a/examples/rig-integration/src/config.rs b/examples/rig-integration/src/config.rs index 1e1077a..387a4f6 100644 --- a/examples/rig-integration/src/config.rs +++ b/examples/rig-integration/src/config.rs @@ -12,7 +12,7 @@ pub struct Config { } impl Config { - pub async fn retrive(path: impl AsRef) -> anyhow::Result { + pub async fn retrieve(path: impl AsRef) -> anyhow::Result { let content = tokio::fs::read_to_string(path).await?; let config: Self = toml::from_str(&content)?; Ok(config) diff --git a/examples/rig-integration/src/main.rs b/examples/rig-integration/src/main.rs index 3fd8a6a..db5ac28 100644 --- a/examples/rig-integration/src/main.rs +++ b/examples/rig-integration/src/main.rs @@ -11,7 +11,7 @@ pub mod config; pub mod mcp_adaptor; #[tokio::main] async fn main() -> anyhow::Result<()> { - let config = config::Config::retrive("config.toml").await?; + let config = config::Config::retrieve("config.toml").await?; let openai_client = { if let Some(key) = config.deepseek_key { deepseek::Client::new(&key) diff --git a/examples/servers/src/common/calculator.rs b/examples/servers/src/common/calculator.rs index 699b881..f2de8f6 100644 --- a/examples/servers/src/common/calculator.rs +++ b/examples/servers/src/common/calculator.rs @@ -20,14 +20,14 @@ impl Calculator { (a + b).to_string() } - #[tool(description = "Calculate the sum of two numbers")] + #[tool(description = "Calculate the sub of two numbers")] fn sub( &self, #[tool(param)] #[schemars(description = "the left hand side number")] a: i32, #[tool(param)] - #[schemars(description = "the left hand side number")] + #[schemars(description = "the right hand side number")] b: i32, ) -> Json { Json(a - b) diff --git a/examples/servers/src/common/counter.rs b/examples/servers/src/common/counter.rs index aeeccd9..8115120 100644 --- a/examples/servers/src/common/counter.rs +++ b/examples/servers/src/common/counter.rs @@ -146,7 +146,7 @@ impl ServerHandler for Counter { next_cursor: None, prompts: vec![Prompt::new( "example_prompt", - Some("This is an example prompt that takes one required agrument, message"), + Some("This is an example prompt that takes one required argument, message"), Some(vec![PromptArgument { name: "message".to_string(), description: Some("A message to put in the prompt".to_string()),