Skip to content

Contrib mixin decorator does not have parity on title and meta attributes #2035

@AnkeshThakur

Description

@AnkeshThakur

Enhancement

MCP tools, resource and prompt support title and meta attributes. These attributes initialization is not available via mixin decorator.

Motivation

The mixin registration already passes title and meta to the underlying from_function() methods, but the decorator signatures were incomplete. This created an inconsistency where these arguments were available
when creating tools/resources/prompts directly, but not when using the mixin decorators. Now, openai Apps SDK integration needs these information to display data to users and take action

This matters because:

Readable title: title provides human-readable names separate from programmatic name
Custom metadata: meta tags are now needed by Openai-sdk to process tools and resources for rendering

Expected decorator syntax

    @mcp_tool(
        name="data_tool",
        description="Fetches user data from database",
        meta={"version": "2.0", "category": "database", "author": "dev-team"}
    )
    def data_tool_method(self, user_id: int):
        pass

   @mcp_resource(
        uri="component://config",
        title="Data resource Title,
        meta={"internal": True, "cache_ttl": 3600, "priority": "high"}
    )
    def config_resource_method(self):
        pass

    @mcp_prompt(
        name="analysis_prompt",
        title="Data Analysis Prompt",
        description="Analyzes data patterns",
        meta={"complexity": "high", "domain": "analytics", "requires_context": True}
    )
    def analysis_prompt_method(self, dataset: str):
        pass

PS. Tool's title is already generated by ToolAnnotations attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribRelated to community contributions in src/contrib/ directory.enhancementImprovement to existing functionality. For issues and smaller PR improvements.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions