Skip to content

Provide a consistent way for MCP Apps to know which tool invoked them #492

@billyjanitsch

Description

@billyjanitsch

Is your feature request related to a problem? Please describe.
If multiple app tools are linked to the same UI resource, the rendered app may wish to know which tool was called to invoke it, e.g., to decide how to parse tool inputs/results.

The spec allows for the host to pass toolInfo in HostContext via ui/initialize, but it's an optional parameter. Tool info is not sent in any other host -> app message.

I'm curious why this parameter is optional. It seems like it ought to always be available on the host, and it seems reasonable/useful for an app to require it.

A current workaround is for the MCP server to manually include the tool name in structuredContent of the tool response, though this solution requires the app to wait until ui/notifications/tool-result even though the tool name is known by the host and server much earlier.

Describe the solution you'd like
Make toolInfo required in HostContext via ui/initialize.

Describe alternatives you've considered
The host could also send the tool name in ui/notifications/tool-input/ui/notifications/tool-input-partial.

Additional context
None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions