fix: generic ServerHandler (#223)
This commit is contained in:
parent
23e8200a58
commit
4e8686ff47
2 changed files with 4 additions and 2 deletions
|
|
@ -258,7 +258,7 @@ pub(crate) fn tool_impl_item(attr: TokenStream, mut input: ItemImpl) -> syn::Res
|
||||||
input.items.push(parse_quote! {
|
input.items.push(parse_quote! {
|
||||||
async fn list_tools(
|
async fn list_tools(
|
||||||
&self,
|
&self,
|
||||||
request: rmcp::model::PaginatedRequestParam,
|
request: Option<rmcp::model::PaginatedRequestParam>,
|
||||||
context: rmcp::service::RequestContext<rmcp::RoleServer>,
|
context: rmcp::service::RequestContext<rmcp::RoleServer>,
|
||||||
) -> Result<rmcp::model::ListToolsResult, rmcp::Error> {
|
) -> Result<rmcp::model::ListToolsResult, rmcp::Error> {
|
||||||
self.list_tools_inner(request, context).await
|
self.list_tools_inner(request, context).await
|
||||||
|
|
@ -316,7 +316,7 @@ pub(crate) fn tool_impl_item(attr: TokenStream, mut input: ItemImpl) -> syn::Res
|
||||||
input.items.push(parse_quote! {
|
input.items.push(parse_quote! {
|
||||||
async fn list_tools_inner(
|
async fn list_tools_inner(
|
||||||
&self,
|
&self,
|
||||||
_: rmcp::model::PaginatedRequestParam,
|
_: Option<rmcp::model::PaginatedRequestParam>,
|
||||||
_: rmcp::service::RequestContext<rmcp::RoleServer>,
|
_: rmcp::service::RequestContext<rmcp::RoleServer>,
|
||||||
) -> Result<rmcp::model::ListToolsResult, rmcp::Error> {
|
) -> Result<rmcp::model::ListToolsResult, rmcp::Error> {
|
||||||
Ok(rmcp::model::ListToolsResult {
|
Ok(rmcp::model::ListToolsResult {
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ impl<DS: DataService> GenericServer<DS> {
|
||||||
self.data_service.get_data()
|
self.data_service.get_data()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[tool(tool_box)]
|
||||||
|
impl<DS: DataService> ServerHandler for GenericServer<DS> {}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_tool_macros() {
|
async fn test_tool_macros() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue