Skip to content

Proxy's call_tool meta attribute not being forwarded #2525

@dherrman

Description

@dherrman

Description

When using FastMCP's proxy, any "meta" attributes are not returned when performing a call_tool call.

This is caused by the ProxyToolManager and ProxyTool leaving out the meta attribute when converting from a CallToolResult to the ToolResult

Example Code

import asyncio

from fastmcp import FastMCP
from fastmcp.client import Client
from fastmcp.client.transports import FastMCPTransport
from fastmcp.server.proxy import ProxyClient
from fastmcp.tools.tool import ToolResult


async def main():
    # Create the FastMCP server
    fastmcp_server = FastMCP("TestServer")

    # Add a tool that returns metadata
    @fastmcp_server.tool
    def tool_with_meta(value: str) -> ToolResult:
        """A tool that returns metadata in its result."""
        return ToolResult(
            content=f"Result: {value}",
            meta={"custom_key": "custom_value", "processed": True},
        )

    # Create the proxy server
    proxy_server = FastMCP.as_proxy(
        ProxyClient(transport=FastMCPTransport(fastmcp_server))
    )

    # Call the tool through the proxy
    async with Client(proxy_server) as client:
        result = await client.call_tool("tool_with_meta", {"value": "test"})

    # Verify the results
    print(f"Content: {result.content[0].text}")  # type: ignore[attr-defined]
    print(f"Meta: {result.meta}"). # prints None



if __name__ == "__main__":
    asyncio.run(main())

Version Information

FastMCP version:                                                                                                             2.13.1
MCP version:                                                                                                                 1.21.2
Python version:                                                                                                             3.12.12
Platform:                                                                                                macOS-26.1-arm64-arm-64bit
FastMCP root path: /Users/dherrman/Library/Caches/pypoetry/virtualenvs/aix-mcp-gateway-t86WoG1_-py3.12/lib/python3.12/site-packages

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.clientRelated to the FastMCP client SDK or client-side functionality.serverRelated to FastMCP server implementation or server-side functionality.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions