mirror of
https://github.com/openai/codex.git
synced 2026-05-17 01:32:32 +00:00
This updates code-mode tool rendering so MCP tools can surface
structured output types from their `outputSchema`.
What changed:
- Detect MCP tool-call result wrappers from the output schema shape
instead of relying on tool-name parsing or provenance flags.
- Render shared TypeScript aliases once for MCP tool results
(`CallToolResult`, `ContentBlock`, etc.) so multiple MCP tool
declarations stay compact.
- Type `structuredContent` from the tool definition's `outputSchema`
instead of rendering it as `unknown`.
- Update the shared MCP aliases to match the MCP draft `CallToolResult`
schema more closely.
Example:
- Before: `declare const tools: { mcp__rmcp__echo(args: { env_var?:
string; message: string; }): Promise<{ _meta?: unknown; content:
Array<unknown>; isError?: boolean; structuredContent?: unknown; }>; };`
- After: `declare const tools: { mcp__rmcp__echo(args: { env_var?:
string; message: string; }): Promise<CallToolResult<{ echo: string; env:
string | null; }>>; };`
32 lines
1.1 KiB
Rust
32 lines
1.1 KiB
Rust
mod description;
|
|
mod response;
|
|
mod runtime;
|
|
mod service;
|
|
|
|
pub use description::CODE_MODE_PRAGMA_PREFIX;
|
|
pub use description::CodeModeToolKind;
|
|
pub use description::ToolDefinition;
|
|
pub use description::ToolNamespaceDescription;
|
|
pub use description::augment_tool_definition;
|
|
pub use description::build_exec_tool_description;
|
|
pub use description::build_wait_tool_description;
|
|
pub use description::is_code_mode_nested_tool;
|
|
pub use description::normalize_code_mode_identifier;
|
|
pub use description::parse_exec_source;
|
|
pub use description::render_code_mode_sample;
|
|
pub use description::render_json_schema_to_typescript;
|
|
pub use response::FunctionCallOutputContentItem;
|
|
pub use response::ImageDetail;
|
|
pub use runtime::DEFAULT_EXEC_YIELD_TIME_MS;
|
|
pub use runtime::DEFAULT_MAX_OUTPUT_TOKENS_PER_EXEC_CALL;
|
|
pub use runtime::DEFAULT_WAIT_YIELD_TIME_MS;
|
|
pub use runtime::ExecuteRequest;
|
|
pub use runtime::RuntimeResponse;
|
|
pub use runtime::WaitRequest;
|
|
pub use service::CodeModeService;
|
|
pub use service::CodeModeTurnHost;
|
|
pub use service::CodeModeTurnWorker;
|
|
|
|
pub const PUBLIC_TOOL_NAME: &str = "exec";
|
|
pub const WAIT_TOOL_NAME: &str = "wait";
|