Skip to content

Commit 4e8686f

Browse files
authored
fix: generic ServerHandler (#223)
1 parent 23e8200 commit 4e8686f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/rmcp-macros/src/tool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pub(crate) fn tool_impl_item(attr: TokenStream, mut input: ItemImpl) -> syn::Res
258258
input.items.push(parse_quote! {
259259
async fn list_tools(
260260
&self,
261-
request: rmcp::model::PaginatedRequestParam,
261+
request: Option<rmcp::model::PaginatedRequestParam>,
262262
context: rmcp::service::RequestContext<rmcp::RoleServer>,
263263
) -> Result<rmcp::model::ListToolsResult, rmcp::Error> {
264264
self.list_tools_inner(request, context).await
@@ -316,7 +316,7 @@ pub(crate) fn tool_impl_item(attr: TokenStream, mut input: ItemImpl) -> syn::Res
316316
input.items.push(parse_quote! {
317317
async fn list_tools_inner(
318318
&self,
319-
_: rmcp::model::PaginatedRequestParam,
319+
_: Option<rmcp::model::PaginatedRequestParam>,
320320
_: rmcp::service::RequestContext<rmcp::RoleServer>,
321321
) -> Result<rmcp::model::ListToolsResult, rmcp::Error> {
322322
Ok(rmcp::model::ListToolsResult {

crates/rmcp/tests/test_tool_macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ impl<DS: DataService> GenericServer<DS> {
8383
self.data_service.get_data()
8484
}
8585
}
86+
#[tool(tool_box)]
87+
impl<DS: DataService> ServerHandler for GenericServer<DS> {}
8688

8789
#[tokio::test]
8890
async fn test_tool_macros() {

0 commit comments

Comments
 (0)