You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document that streamed fragments are transient and final responses are driven
from structured results. Clarify xcode-ide bridge payload handling and the
structured-output union consumers should parse.
Refs GH-360
Co-authored-by: Codex <noreply@openai.com>
Collecting --> ErrorTracked: error fragment emitted
41
40
StructuredReady --> ErrorTracked: structured result didError=true
42
41
43
42
ErrorTracked --> Finalizing: finalize()
@@ -60,7 +59,7 @@ stateDiagram-v2
60
59
RuntimeBoundary --> [*]
61
60
```
62
61
63
-
The render session is the collection point for the tool invocation. It receives fragments as work happens, stores attachments, stores the final structured output, stores next steps, tracks error state, and finalizes the transcript for the selected render strategy.
62
+
The render session is the collection point for the tool invocation. It receives fragments as work happens, stores attachments, stores the final structured output, stores next steps, derives error state from the structured result, and finalizes the transcript for the selected render strategy.
Copy file name to clipboardExpand all lines: app/docs/_content/architecture-tool-lifecycle.mdx
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,8 +60,6 @@ interface ToolHandlerContext {
60
60
|`nextSteps`| Provide explicit dynamic follow-ups when templates cannot express the result. |
61
61
|`structuredOutput`| Set the final canonical result, schema ID, and schema version. |
62
62
63
-
The omitted progress flags are internal boundary controls. They exist in source today, but the public docs intentionally do not teach tool authors to branch on them.
64
-
65
63
## Fragments versus structured output
66
64
67
65
A handler produces two different things, and they serve different readers. Fragments are live progress and transcript material — log lines, build output, attachments — that callers and pipelines consume while the work is running. Structured output is the one final canonical result the handler sets at the end of the call. Fragments are never the final result; the structured output is what powers CLI `--output json`, MCP `structuredContent`, schema validation, fixtures, and stable integrations.
Copy file name to clipboardExpand all lines: app/docs/_content/mcp-protocol-support.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ The envelope wraps every tool's structured payload in the same shape, so consume
51
51
}
52
52
```
53
53
54
-
The envelope fields are documented in [Output Formats](/docs/output-formats). Canonical JSON schemas live in [`schemas/structured-output/`](https://github.com/getsentry/XcodeBuildMCP/tree/main/schemas/structured-output). Tools advertise their output schema in `tools/list`.
54
+
The envelope fields are documented in [Output Formats](/docs/output-formats). Canonical JSON schemas live in [`schemas/structured-output/`](https://github.com/getsentry/XcodeBuildMCP/tree/main/schemas/structured-output). Tools advertise their output schema in `tools/list` as an object-shaped union of the domain schema OR `xcodebuildmcp.output.error`, so clients can always branch on `schema` to determine whether a structured result is a normal domain payload or a generic error.
55
55
56
56
The one exception is the [Xcode IDE bridge](/docs/xcode-ide): bridge tools forward calls to Xcode's own MCP service, so their output shape comes from Xcode and does not use the XcodeBuildMCP envelope.
For example, `list_sims` normally returns `xcodebuildmcp.output.simulator-list`, but a validation or runtime failure before simulator listing begins returns `xcodebuildmcp.output.error`. Do not assume a tool always returns only its domain schema; always check `schema` first.
76
98
77
99
```json
78
100
{
@@ -101,7 +123,22 @@ The response has these fields:
101
123
}
102
124
```
103
125
104
-
`data` can be `null` when a tool succeeds but has no structured payload. If a tool does not produce structured output for `--output json`, the CLI emits an error response with `schema: "xcodebuildmcp.output.error"`, `didError: true`, and exits with a non-zero status.
126
+
`data` can be `null` when a tool succeeds but has no structured payload. If a tool produces no structured output, or if a pre-domain failure occurs (validation, schema, or runtime error before the tool executes), the response uses the generic error branch and the CLI exits with a non-zero status:
Domain failures still use their domain schema. For example, an attempted build that fails returns `xcodebuildmcp.output.build-result` with `didError:true` and build diagnostics in `data`.
105
142
106
143
## `--outputjsonl`
107
144
@@ -143,7 +180,7 @@ Do not script against `raw`. The transcript is intentionally close to the underl
143
180
144
181
## Structured content for MCP clients
145
182
146
-
MCP mode always returns the normal `content` array. When a tool sets structured output, XcodeBuildMCP also attaches [`structuredContent`](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#structured-content) with the same shape as `--output json`.
183
+
MCP mode always returns the normal `content` array. When a tool sets structured output, XcodeBuildMCP also attaches [`structuredContent`](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#structured-content) with the same shape as `--outputjson`. Pre-domain failures — validation errors, schema mismatches, or runtime errors before the tool executes — also produce `structuredContent` using `schema:"xcodebuildmcp.output.error"`.
147
184
148
185
```json
149
186
{
@@ -188,7 +225,7 @@ MCP mode always returns the normal `content` array. When a tool sets structured
188
225
}
189
226
```
190
227
191
-
Tools that declare an [output schema](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#output-schema) also advertise it during MCP registration. Clients can use that schema to validate `structuredContent` or render typed UI.
228
+
Tools that declare an [output schema](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#output-schema) also advertise it during MCP registration. For tools with structured output, the advertised schema is a union of the tool's domain envelope and the generic `xcodebuildmcp.output.error` envelope. Clients can use that schema to validate `structuredContent` or render typed UI, but should still branch on the returned `schema` value at runtime.
0 commit comments