You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Changes
Simplified the usage of rcmp-macros with the following changes:
### Before
```rust
#[tool(tool_box)]
impl Calculator {
#[tool(description = "Calculate the sum of two numbers")]
fn sum(&self, #[tool(aggr)] SumRequest { a, b }: SumRequest) -> String {
(a + b).to_string()
}
#[tool(description = "Calculate the difference of two numbers")]
fn sub(
&self,
#[tool(param)]
#[schemars(description = "the left hand side number")]
a: i32,
#[tool(param)]
#[schemars(description = "the right hand side number")]
b: i32,
) -> Json<i32> {
Json(a - b)
}
}
```
### After
```rust
#[tool(tool_box)]
impl Calculator {
#[tool(description = "Calculate the sum of two numbers",aggr)]
fn sum(&self, SumRequest { a, b }: SumRequest) -> String {
(a + b).to_string()
}
#[tool(description = "Calculate the difference of two numbers")]
fn sub(
&self,
#[schemars(description = "the left hand side number")]
a: i32,
#[schemars(description = "the right hand side number")]
b: i32,
) -> Json<i32> {
Json(a - b)
}
}
```
## Improvements
1. Moved parameter-level `#[tool(aggr)]` attribute to the function level
2. Removed redundant `#[tool(param)]` markers
3. Maintained the same functionality while making the code more concise and readable
0 commit comments