mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
## Why Dynamic tool clients could return JSON as text in `contentItems`, so Code Mode scripts had to parse that text to access fields in the result. ## What changed App server dynamic tool requests advertise `supportedResultFormat: "structuredContent"`. Clients can reply with `structuredContent` and a `success` flag, report a failure with `errorMessage` and `success: false`, or continue using `contentItems`. Code Mode exposes structured replies as MCP-style tool results, with the original JSON under `structuredContent` and failure status in `isError`. Completed tool items include a text representation of the reply. Matching post-tool-use hooks can receive the structured result for successful calls. ## Testing Add protocol tests for the wire formats and rejection of ambiguous replies, plus an app server integration test that exercises structured results, content items, and errors through Code Mode. GitOrigin-RevId: d63152633b43bd5bd236f6e0dcb41ee7e98e7947
143 lines
3.1 KiB
JSON
Generated
143 lines
3.1 KiB
JSON
Generated
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/DynamicToolCallContentItems"
|
|
},
|
|
{
|
|
"properties": {
|
|
"structuredContent": true,
|
|
"success": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"structuredContent",
|
|
"success"
|
|
],
|
|
"type": "object"
|
|
},
|
|
{
|
|
"properties": {
|
|
"errorMessage": {
|
|
"type": "string"
|
|
},
|
|
"success": {
|
|
"const": false,
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"errorMessage",
|
|
"success"
|
|
],
|
|
"type": "object"
|
|
}
|
|
],
|
|
"definitions": {
|
|
"DynamicToolCallContentItems": {
|
|
"properties": {
|
|
"contentItems": {
|
|
"items": {
|
|
"$ref": "#/definitions/DynamicToolCallOutputContentItem"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"success": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"contentItems",
|
|
"success"
|
|
],
|
|
"type": "object"
|
|
},
|
|
"DynamicToolCallOutputContentItem": {
|
|
"oneOf": [
|
|
{
|
|
"properties": {
|
|
"text": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"inputText"
|
|
],
|
|
"title": "InputTextDynamicToolCallOutputContentItemType",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"text",
|
|
"type"
|
|
],
|
|
"title": "InputTextDynamicToolCallOutputContentItem",
|
|
"type": "object"
|
|
},
|
|
{
|
|
"properties": {
|
|
"imageUrl": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"inputImage"
|
|
],
|
|
"title": "InputImageDynamicToolCallOutputContentItemType",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"imageUrl",
|
|
"type"
|
|
],
|
|
"title": "InputImageDynamicToolCallOutputContentItem",
|
|
"type": "object"
|
|
},
|
|
{
|
|
"properties": {
|
|
"audioUrl": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"inputAudio"
|
|
],
|
|
"title": "InputAudioDynamicToolCallOutputContentItemType",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"audioUrl",
|
|
"type"
|
|
],
|
|
"title": "InputAudioDynamicToolCallOutputContentItem",
|
|
"type": "object"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"description": "A dynamic tool reply carrying content items, structured JSON, or an error message.",
|
|
"oneOf": [
|
|
{
|
|
"required": [
|
|
"contentItems"
|
|
],
|
|
"title": "ContentItemsDynamicToolCallResponse"
|
|
},
|
|
{
|
|
"required": [
|
|
"structuredContent"
|
|
],
|
|
"title": "StructuredContentDynamicToolCallResponse"
|
|
},
|
|
{
|
|
"required": [
|
|
"errorMessage"
|
|
],
|
|
"title": "ErrorMessageDynamicToolCallResponse"
|
|
}
|
|
],
|
|
"title": "DynamicToolCallResult"
|
|
} |