Skip to content

Conversation

@mrchantey
Copy link
Contributor

The list_tools function now accepts Option<PaginatedRequestParam> but the macro wasn't updated for generic servers. This pr fixes the error and adds the implementation to the test to avoid future regressions.

#[tool(tool_box)]
impl<DS: DataService> ServerHandler for GenericServer<DS> {}

/// error:


error[E0053]: method `list_tools` has an incompatible type for trait
  --> crates/rmcp/tests/test_tool_macros.rs:86:1
   |
86 | #[tool(tool_box)]
   | ^^^^^^^^^^^^^^^^^ expected `Option<PaginatedRequestParam>`, found `PaginatedRequestParam`
   |
   = note: expected signature `fn(&GenericServer<_>, std::option::Option<PaginatedRequestParam>, RequestContext<_>) -> _`
              found signature `fn(&GenericServer<_>, PaginatedRequestParam, RequestContext<_>) -> _`
   = note: this error originates in the attribute macro `tool` (in Nightly builds, run with -Z macro-backtrace for more info)
help: change the parameter type to match the trait
   |
86 | std::option::Option<PaginatedRequestParam>

@4t145 4t145 requested a review from jokemanfire May 26, 2025 03:08
@mrchantey
Copy link
Contributor Author

sorry accidentally committed some extra stuff, ill reopen a clean pr.

@mrchantey mrchantey closed this May 26, 2025
@mrchantey mrchantey changed the title Fix: generic ServerHandler Fix: generic ServerHandler (bad commit history) May 26, 2025
@mrchantey
Copy link
Contributor Author

clean pr #223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant