Skip to content

[FEATURE] MCP ToolResult meta field is missing #881

@Mashiro2000

Description

@Mashiro2000

Problem Statement

Image

In the MCP server, I use the meta field to pass some business-related fields, but I found that when using the AWS Strands SDK's MCP tool, themeta field is ignored. Will support for passing this field be added in the future?

See MCP specification
for notes on _meta usage.

Proposed Solution

No response

Use Case

test_mcp= FastMCP("test_mcp")


@test_mcp.tool(
    name="xxxx",
    description="xxxx",
)
async def xxxx():
    try:

        token_usage = response.usage_metadata.total_token_count if response.usage_metadata else 0

        return TextContent(
            type="text",
            text=url,
            _meta={
                "token_usage": token_usage,
            }
        )
    except Exception as e:
        logger.error(f"{type(e).__name__}: {e}")
        raise e

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions