Skip to content

tools[].type = "namespace" is silently dropped — MCP tools are unusable with Codex CLI #23229

Closed as not planned

Description

@estrizhok

Summary

Since PR #23041 (merged 2026-05-15), the Responses-API shim in tools/server/server-chat.cpp no longer throws on non-function tool types — it logs a warning and skips. That removed the crash but introduced a silent breakage: when Codex CLI registers any MCP server, none of the MCP tools reach the model, because Codex wraps them as {type:"namespace", name:"mcp__<server>__", tools:[...]} and the shim drops the whole namespace along with its nested function tools.

Follow-up to #20156 — same root cause, different user-facing symptom now that the request no longer fails outright.

Reproduction

llama-server b9186, Vulkan/RADV, Qwen3.6-35B-A3B-MTP-UD-Q4_K_XL.

~/.codex/config.toml:

[model_providers.llamacpp]
base_url = "http://127.0.0.1:8080/v1"
wire_api = "responses"

[profiles.local]
model_provider = "llamacpp"
model = "qwen3.6-35b-a3b-mtp"

[mcp_servers.open-websearch]
url = "http://127.0.0.1:3000/mcp"

open-websearch is an HTTP MCP server (Aas-ee/open-webSearch) exposing two tools: search and fetchWebContent.

LLAMACPP_API_KEY=dummy codex exec --profile local "Reply ping."

llama-server verbose log

W srv  server_chat_: unsupported Responses tool type 'web_search' skipped
W srv  server_chat_: unsupported Responses tool type 'namespace' skipped

Original Responses-API request from codex contains 15 entries; one is the MCP wrapper:

type='namespace'  name=mcp__open_websearch__  inner=['fetchWebContent','search']

After the shim, the converted Chat-Completions tools[] has 13 entries — the namespace and its two inner function tools are gone. The model never sees mcp__open_websearch__*. The MCP server itself is reachable and codex's MCP manager initialized cleanly; the failure is purely in the Responses → Chat-Completions translation.

Suggested fix

Teach server-chat.cpp to recognise type:"namespace" and flatten it. Given a payload of

{"type":"namespace","name":"<ns>","tools":[{"type":"function","function":{"name":"a", ...}}, ...]}

emit

[{"type":"function","function":{"name":"<ns>a", ...}}, ...]

i.e. concatenate the namespace `name` and each inner function name. The returned tool-call name carries the full identifier, so no reverse map is needed on the llama-server side.

CLIProxyAPI is implementing the same shim for the same incompatibility (router-for-me/CLIProxyAPI#3298); LM Studio hits an even harder version of this (lmstudio-ai/lmstudio-bug-tracker#1810).

Impact

llama-server is currently functionally incompatible with Codex CLI's MCP integration, even though both halves work in isolation. The silent skip is more harmful than the original crash for users debugging this — there is no signal that tools were dropped.

Activity

  1. aldehir commented on May 17, 2026

    @aldehir
    Contributor

    So it didn't work, now it kinda works but that's worse? Ok.

  2. estrizhok commented on May 19, 2026

    @estrizhok
    Author
  3. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions