Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions reboot/mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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.

Expand All @@ -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()
Expand Down Expand Up @@ -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

Expand All @@ -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(
Expand All @@ -607,6 +612,7 @@ def add_tool(
description=description,
annotations=annotations,
structured_output=structured_output,
meta=meta,
)
)

Expand Down Expand Up @@ -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
Expand Down