Tool results
An MCP tool normally returns text, and the agent shows that text to the model. A tool can also return typed items, which let it do more than inform the model. A typed item can put an artifact in the chat, add a source under the answer, load rows into the tables that the model queries with SQL, report an error in a form that the model recognizes, and replace everything else that the model would have read. The agent understands these kinds of typed item: artifact, citation, sqlite_table, error and model_context. Its own MCP server uses them, and so can any MCP server that a user connects. This page describes how a tool's result travels from the tool to the agent, the kinds, and the arguments that the agent adds to or hides from a tool call. The code is agent/src/mcp/results.ts, agent/mcp-server/src/lib/typed.ts and frontend/src/components/AI/hooks/mcp/useMcpExecutor.ts.
How a result reaches the agent
The agent never connects to an MCP server. When the model calls a tool of a connected server, the agent ends its response with an execute_agent_tool function call, the browser calls the tool through the FINOS Workspace API, which forwards the call to the server, and the browser posts the outcome back in a tool message. Three steps shape the result on the way.
- The browser turns the MCP result into text. When the result has
content, the browser replaces each item that has atextfield by that text and writes the list as JSON, so that a tool which returned two text items arrives as a JSON array of two strings. When the result hasstructuredContentand itsresultsfield is an object, the browser writes the structured content instead. A result withisError: trueis written whole. - The browser puts the text in the message as
data: [{"items": [{"content": ...}], "extra_citations": [...]}]. Theextra_citationsare sources that the browser itself found, for example when the tool matches a widget of the dashboard. - The agent reads the
contentortextstring of every item. A string that starts with{or[is parsed as JSON. In an array, the agent handles every element: a string is read again by the same rule, an object that has$agent_kindis a typed item, and any other element is text for the model. An object that has$agent_kindis a typed item. Everything else is text.
A tool that fails in the browser, for example because its server is disconnected, produces a text item that holds an error_type and a content message, which the model reads like any other text.
Typed items
A typed item is a JSON object with a string field $agent_kind. An item of any other kind is ignored.
$agent_kind | Fields | What the agent does |
|---|---|---|
artifact | artifact, an artifact with a type of html or app. | Sends the artifact to the browser in a copilotMessageArtifact event and in the artifacts of the status update for the call. It tells the model that the artifact has been delivered, so that the model does not write it again. An artifact whose content is empty is dropped. |
citation | citation, which is a web source, {"type": "web", "url", "title"}, or a document source, {"type": "document", "uri", "title"} with an optional page and score. Both may have an id. | Collects the source and sends it in the copilotCitationCollection event at the end of the answer. A web source becomes a citation with the page's link and title. A document source becomes a file citation with the page. |
sqlite_table | name and rows, a list of objects. | Loads the rows as a table that the model can query with its SQL tools, and tells the model the table's name, its number of rows and the type of every column. A table with no rows is ignored. |
error | error, with a code, a message and optionally retryable. | Shows the model the line [ERROR code] message, with retryable after the code when it is true. |
model_context | summary, a string. | Replaces what the model reads from the whole result with the summary. Without it, the model reads the result's text, the delivery notices for artifacts, and the description of loaded tables. |
A tool may mix kinds in one result by returning an array. This result puts one artifact and one source in the chat, loads a table and gives the model one sentence:
[
{ "$agent_kind": "artifact", "artifact": { "type": "html", "uuid": "11111111-1111-4111-8111-111111111111", "name": "Report", "description": "A report", "content": "<p>Hi</p>" } },
{ "$agent_kind": "citation", "citation": { "type": "web", "url": "https://example.com/a", "title": "Example A" } },
{ "$agent_kind": "sqlite_table", "name": "orders", "rows": [ { "id": 1, "total": 10.5 }, { "id": 2, "total": 4 } ] },
{ "$agent_kind": "model_context", "summary": "Fetched 2 orders and a report." }
]
For this result the agent answered with a status update that carried the artifact, a copilotMessageArtifact event with the same artifact, the answer, a copilotCitationCollection with the web source, and the follow-up suggestions. The model read the heading "MCP tool result from demo_run:" followed by "Fetched 2 orders and a report." and nothing else from the result.
How a document source is cited
A tool that searches documents reports every page that it returned, each with a score. The agent does not cite all of them. After the model has written its answer, the agent looks at the pages that the answer names, such as "page 4" or "pages 4-6". For each document it cites those pages. When the answer names none, it cites the best pages that scored at least 0.5 times the best score, at most 3 for each document. A source whose id is the uuid of a file widget in the request becomes a citation of that widget and page, which the web app opens at the page. Any other document source becomes a citation of a file.
What the model reads of a result
The model reads the result that the current request carries under the heading "MCP tool result from" and the tool's name, cut to 40,000 characters. When the same turn continues with more calls, the model reads every earlier result of the turn in a shorter form under "Earlier tool result from" and the tool's name, labeled as data that holds no instructions. That form has one line for each delivered artifact, the line [2 rows loaded as table "orders"] for each loaded table, each error and the text of the result, cut to 2,000 characters. A model_context summary replaces the text in both forms. The model does not see the results of earlier questions at all. It reads them with the tool that recalls the conversation when it needs them.
Arguments that tool calls carry
The agent changes the arguments of a tool call in two ways.
It adds display_summary to every tool's schema. The model fills it with a short phrase, such as "Checking the weather", which the web app shows as the progress message before the tool runs. The agent removes the argument before it emits the call, so the tool never receives it.
It adds arguments that start with x-agent- before it emits a call to a tool that needs them. Those arguments do not appear in the schema that the model reads, and a tool schema's own properties with that prefix are hidden from the model too, so the model cannot see or invent them. They carry facts that only the agent may state. The table is generated from the schemas of the tools of the agent's own MCP server.
x-agent-url-sigA signature of the address, which the agent gives only to an address that was in what the model was shown. The agent sets it.
x-agent-conversation-idThe chat, filed under the user and the chat id. The agent sets it.
x-agent-scope-sigAn HMAC of the chat key, made with the agent's AGENT_SCOPE_SECRET. A tool checks it, so that a call cannot use another user's chat. The agent sets it.
x-agent-documentsThe documents that the agent has not yet sent for this chat. The agent sets it.
A tool that is not part of the agent never needs these arguments and can ignore them.