Skip to content

Commit 79babc8

Browse files
committed
Add meta=tool.meta passthrough to FastMCP for ext-apps
https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta
1 parent fb7fddc commit 79babc8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

reboot/mcp/server.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class Tool:
314314
description: str | None
315315
annotations: mcp.types.ToolAnnotations | None
316316
structured_output: bool | None
317+
meta: dict[str, Any] | None = None
317318

318319

319320
LogLevel: TypeAlias = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
@@ -539,6 +540,7 @@ def tool(
539540
description: str | None = None,
540541
annotations: mcp.types.ToolAnnotations | None = None,
541542
structured_output: bool | None = None,
543+
meta: dict[str, Any] | None = None,
542544
) -> Callable[[mcp.types.AnyFunction], mcp.types.AnyFunction]:
543545
"""Decorator to register a tool.
544546
@@ -555,6 +557,7 @@ def tool(
555557
- If None, auto-detects based on the function's return type annotation
556558
- If True, unconditionally creates a structured tool (return type annotation permitting)
557559
- If False, unconditionally creates an unstructured tool
560+
meta: Optional metadata dict exposed as _meta in the MCP protocol.
558561
559562
Example:
560563
@server.tool()
@@ -585,6 +588,7 @@ def decorator(fn: mcp.types.AnyFunction) -> mcp.types.AnyFunction:
585588
description=description,
586589
annotations=annotations,
587590
structured_output=structured_output,
591+
meta=meta,
588592
)
589593
return fn
590594

@@ -598,6 +602,7 @@ def add_tool(
598602
description: str | None = None,
599603
annotations: mcp.types.ToolAnnotations | None = None,
600604
structured_output: bool | None = None,
605+
meta: dict[str, Any] | None = None,
601606
) -> None:
602607
self._tools.append(
603608
Tool(
@@ -607,6 +612,7 @@ def add_tool(
607612
description=description,
608613
annotations=annotations,
609614
structured_output=structured_output,
615+
meta=meta,
610616
)
611617
)
612618

@@ -711,6 +717,7 @@ def _streamable_http_app(
711717
description=tool.description,
712718
annotations=tool.annotations,
713719
structured_output=tool.structured_output,
720+
meta=tool.meta,
714721
)
715722

716723
_servers[path] = mcp._mcp_server

0 commit comments

Comments
 (0)