diff --git a/reboot/mcp/server.py b/reboot/mcp/server.py index 70bae9e..e12b00b 100644 --- a/reboot/mcp/server.py +++ b/reboot/mcp/server.py @@ -314,6 +314,7 @@ class Tool: description: str | None annotations: mcp.types.ToolAnnotations | None structured_output: bool | None + meta: dict[str, Any] | None = None LogLevel: TypeAlias = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] @@ -539,6 +540,7 @@ def tool( description: str | None = None, annotations: mcp.types.ToolAnnotations | None = None, structured_output: bool | None = None, + meta: dict[str, Any] | None = None, ) -> Callable[[mcp.types.AnyFunction], mcp.types.AnyFunction]: """Decorator to register a tool. @@ -555,6 +557,7 @@ def tool( - If None, auto-detects based on the function's return type annotation - If True, unconditionally creates a structured tool (return type annotation permitting) - If False, unconditionally creates an unstructured tool + meta: Optional metadata dict exposed as _meta in the MCP protocol. Example: @server.tool() @@ -585,6 +588,7 @@ def decorator(fn: mcp.types.AnyFunction) -> mcp.types.AnyFunction: description=description, annotations=annotations, structured_output=structured_output, + meta=meta, ) return fn @@ -598,6 +602,7 @@ def add_tool( description: str | None = None, annotations: mcp.types.ToolAnnotations | None = None, structured_output: bool | None = None, + meta: dict[str, Any] | None = None, ) -> None: self._tools.append( Tool( @@ -607,6 +612,7 @@ def add_tool( description=description, annotations=annotations, structured_output=structured_output, + meta=meta, ) ) @@ -711,6 +717,7 @@ def _streamable_http_app( description=tool.description, annotations=tool.annotations, structured_output=tool.structured_output, + meta=tool.meta, ) _servers[path] = mcp._mcp_server