mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
fix(codex): preserve namespace MCP tools forwarded to Codex Responses API (#1483)
Integrated into release/v3.7.0
This commit is contained in:
@@ -336,6 +336,20 @@ function normalizeCodexTools(body: Record<string, unknown>): void {
|
||||
}
|
||||
|
||||
const tool = toolValue as Record<string, unknown>;
|
||||
|
||||
// Preserve namespace tools (MCP tool groups used by Codex/OpenAI Responses API).
|
||||
// Codex API supports them natively; register sub-tool names for tool_choice validation.
|
||||
if (tool.type === "namespace" && Array.isArray(tool.tools)) {
|
||||
for (const st of tool.tools as unknown[]) {
|
||||
if (st && typeof st === "object" && !Array.isArray(st)) {
|
||||
const subTool = st as Record<string, unknown>;
|
||||
const name = typeof subTool.name === "string" ? subTool.name.trim() : "";
|
||||
if (name) validToolNames.add(name);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tool.type !== "function") {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,12 +55,14 @@ export function openaiResponsesToOpenAIRequest(
|
||||
for (const toolValue of tools) {
|
||||
const tool = toRecord(toolValue);
|
||||
const toolType = toString(tool.type);
|
||||
// Allow: function tools, tools already in Chat format (have .function property), and CLI subagent tools
|
||||
// Allow: function tools, tools already in Chat format (have .function property), CLI subagent tools,
|
||||
// and namespace tools (MCP tool groups used by Codex/OpenAI Responses API).
|
||||
if (
|
||||
toolType &&
|
||||
toolType !== "function" &&
|
||||
toolType !== "custom" &&
|
||||
toolType !== "command" &&
|
||||
toolType !== "namespace" &&
|
||||
!tool.function
|
||||
) {
|
||||
throw unsupportedFeature(
|
||||
|
||||
Reference in New Issue
Block a user