The MCP tool link
A widget can name one MCP tool of its own backend. The AI agent uses that tool to query the backend for the data that the widget shows. The key is mcp_tool, and every widget type accepts it.
Fields
The key mcp_tool of a widget definition has these fields. They come from the widgets.json schema, which widgets.json describes in full. A widget that sets disableRetrievalForCopilot cannot have mcp_tool, and the contract checks that every $ argument names a parameter of the widget.
mcp_toolobjectno other propertiesThe MCP tool of this backend the AI Agent uses to query what the widget shows: a server named in this backend's apps.json mcpServers, and the tool
3 nested properties
argsmap<string, string | number | boolean>maxProperties 32property names: maxLength 128The arguments that the AI Agent passes to the tool, by name
mcp_serverstringrequiredminLength 1maxLength 128The name of a server in this backend's apps.json mcpServers
tool_idstringrequiredminLength 1maxLength 128The name of the tool on that server
When the link is active
The web app puts the link into its request to the agent only when the server and the tool are available. This table comes from activeMcpLink in frontend/src/lib/utils/mcpLink.ts.
| Case | mcp_tool of the widget | Link in the request to the agent |
|---|---|---|
| The server and the tool are available | {"mcp_server":"<server>","tool_id":"<tool>","args":{"<argument>":"$<param>"}} | {"server_id":"<server id>","tool_name":"<tool>","args":{"<argument>":"$<param>"}} |
| The widget has no `mcp_tool` | none | none |
| The server was registered for another backend | {"mcp_server":"<server>","tool_id":"<tool>"} | none |
| The server's declared name differs from `mcp_server` | {"mcp_server":"<server>","tool_id":"<tool>"} | none |
| The tool is not in the request's tool list | {"mcp_server":"<server>","tool_id":"<tool>"} | none |
How a call is attributed
citeMcpCall in the same file decides which widget an answer cites for a call of the tool.
| Case | Arguments of the call | Cited widget | input_args | details |
|---|---|---|---|---|
| The mapping is applied in reverse | {"<argument>":"<value>"} | the widget | {"<param>":"<value>"} | {} |
| An argument that maps to no parameter goes into `details` | {"<argument>":"<value>","<extra>":"<value>"} | the widget | {"<param>":"<value>"} | {"<extra>":"<value>"} |
| Without `args`, an argument named like a parameter fills it | {"<param>":"<value>","<extra>":"<value>"} | the widget | {"<param>":"<value>"} | {"<extra>":"<value>"} |
| A literal argument that the call does not carry rules the widget out | {"<argument>":"<value>"} | no widget | none | none |
| Several widgets match: the one with the most literal arguments wins | {"<argument>":"<value>","<literal>":"<value>"} | second | {"<param>":"<value>"} | {"<literal>":"<value>"} |
| The server was registered for another backend | {"<argument>":"<value>"} | no widget | none | none |
Link a widget to an MCP tool explains how a backend declares its servers and what the agent does with the link.