Field Guide
Result Flow
The first model-called tool should return enoughcontent for a non-UI host to answer the user. The View should render structuredContent, not parse content. Treat structuredContent as model-visible, so it should contain only data the model can safely use.
Return Both Text and Structured Data
structuredContent gives the model and the View a stable object shape.
What Goes in content
Use content for facts the model may need immediately:
- What the tool did.
- Counts, totals, statuses, or identifiers that answer the user.
- Error messages the model can recover from.
- A compact summary when the full data is too large.
content. If the user later chooses a row or filter in the View, send that selection with updateModelContext.
What Goes in structuredContent
Use structuredContent for model-safe UI payloads:
- Rows, chart series, map markers, cards, media metadata, or form defaults.
- Pagination cursors and IDs the View needs for app-only tool calls.
- Status objects that drive loading, success, and error UI.
outputSchema for model-called UI tools and for app-only tools whose responses the View depends on. The schema documents the contract and helps clients validate the result. Do not put private or oversized data in structuredContent; use _meta or an app-only tool instead.
What Goes in _meta
Use _meta only for data that should not be part of the model-readable answer:
- Internal request IDs, cache keys, trace IDs, or view IDs.
- Host-specific rendering hints.
- Resource
_meta.uisuch as CSP, permissions,domain, andprefersBorder. - Data that the View can use but the model should not see or rely on.
_meta. Hosts and clients may treat _meta as implementation metadata, and the model should not need it to answer.
Keep the Model Current After UI Changes
Tool results describe the state at tool-call time. After the user interacts with the View, callupdateModelContext with the small set of facts the model should know on later turns.
App-only Tool Results
App-only tools still return normal MCP tool results. Keepcontent short for logs and debugging, put model-safe data in structuredContent, and put component-only data in _meta.
callServerTool.
Checklist
- Return
contenton every model-visible tool result. - Render
structuredContentin the View instead of parsing text. - Add
outputSchemafor structured UI payloads. - Treat
structuredContentas model-visible. - Use
_metafor component-only data, not facts the model must know. - Use app-only tools for pagination, polling, submit buttons, and refresh actions.
- Call
updateModelContextafter user selections that should affect future model replies. - Keep each model context update complete because the previous one is overwritten.
Related
Tool and Resource Contract
Check the full server-side MCP App contract.
content vs structuredContent vs _meta
Choose the correct data channel for each tool result field.
Tool _meta
Link tools to Views and control model vs app visibility.
updateModelContext
Push View state into future model turns.
useToolData
Read tool input and structured output in sunpeak React resources.