Skip to content

Stale MCP Tool Schema After Server Restart #19155

Open

Description

@abirmingham

What version of Codex CLI is running?

0.122.0

What subscription do you have?

Business

Which model were you using?

gpt-5.4 high

What platform is your computer?

Linux 5.4.0-216-generic x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

What issue are you seeing?

Codex appears to keep a stale MCP tool schema in-session, even when the server emits notifications/tools/list_changed.

What steps can reproduce the bug?

  1. Start Codex with an MCP server exposing:
    • tool: count_detections
    • required input: duration
  2. Call it successfully: {"duration":"1h"}
  3. Change the server so the same tool name now requires:
    • lookback
    • not duration
  4. Rebuild and restart the MCP server.
  5. Server replays initialization and emits notifications/tools/list_changed.
  6. In the same Codex session, call the tool again.

Codex still uses the old schema and the call fails with:
Mcp error: -32602: invalid params: validating "arguments": validating root: unexpected additional properties ["duration"]

What is the expected behavior?

After notifications/tools/list_changed, Codex should refresh the tool definition and use the updated schema in the same session.

Additional information

Control

A fresh MCP client connected to the same restarted server immediately sees the new schema and can call the tool correctly, so this looks like a Codex-side stale cache/binding issue rather than an MCP server restart issue.

Current workaround

  • restart Codex after breaking MCP schema changes
  • or version tool names / temporarily accept both old and new params

Activity

  1. added
    bug
    on Apr 23, 2026
  2. added
    CLI
    mcp
    on Apr 23, 2026
  3. removed
    CLI
    on Apr 23, 2026
  4. barryw commented on Jul 3, 2026

    @barryw

    I have a candidate fix for this at https://github.com/barryw/codex/tree/codex/fix-mcp-tool-list-changed.

    Summary:

    • refresh cached MCP tools when a server sends a tool list changed notification
    • surface tool list change notifications through the RMCP client handlers
    • add connection manager coverage for notification-driven tool refresh behavior

    This also looks related to #10105. Happy to open an invited PR if this matches the intended direction.

  5. anythingoah commented on Aug 30, 2026

    @anythingoah

    Hey, I came across your Codex issue about the MCP tool schema changing from duration to lookback while Codex kept using the stale schema.

    Curious after running into that, did you find a reliable way to catch MCP tool/schema changes before they cause calls to fail, or is restarting/updating clients still basically the workaround?

  6. abirmingham commented on Aug 31, 2026

    @abirmingham
    Author

    Hey, I came across your Codex issue about the MCP tool schema changing from duration to lookback while Codex kept using the stale schema.

    Curious after running into that, did you find a reliable way to catch MCP tool/schema changes before they cause calls to fail, or is restarting/updating clients still basically the workaround?

    Unfortunately not! I am still hoping that this will be resolved.

  7. anythingoah commented on Sep 1, 2026

    @anythingoah

    Hey, I came across your Codex issue about the MCP tool schema changing from duration to lookback while Codex kept using the stale schema.
    Curious after running into that, did you find a reliable way to catch MCP tool/schema changes before they cause calls to fail, or is restarting/updating clients still basically the workaround?

    Unfortunately not! I am still hoping that this will be resolved.

    Not a fix for the Codex-side caching bug, no that's on OpenAI's end. But since you can't rely on the client catching tools/list_changed reliably, I ended up building something that watches the MCP server directly and flags schema changes (like your duration→lookback case) the moment they happen, independent of whether any client picks up the notification. Built it after hitting this exact class of problem myself happy to point you at it if useful, no pressure either way.

  8. osewon10-netizen commented on Oct 18, 2026

    @osewon10-netizen

    Related reproduction on the same active-thread stale-schema problem, with an installed native Codex CLI 0.163.0:

    • I ran the app-server against a disposable local Streamable HTTP MCP server using protocol 2025-06-18. Generation 1 exposed fixture_tool with an item_id schema; Generation 2 changed its description and added a return_to_implementation boolean.
    • In the existing thread, mcpServerStatus/list and the next model request retained Generation 1 across successive turns. The server recorded zero tools/list requests on the retained connection during config/mcpServer/reload, which returned {}. Tool calls in that thread did reach Generation 2.
    • Fresh discovery and a new codex exec --ephemeral session both fetched Generation 2 and exposed its description/schema to the model.

    This fixture used only synthetic loopback servers and a mock model endpoint; it touched no live MCP service, user configuration, or credentials. It suggests that the current app-server reload path does not invalidate an unchanged healthy Streamable HTTP connection's cached catalog when the server cannot send notifications/tools/list_changed. I found no supported same-thread refresh in this 0.163.0 path. Please treat this as additional evidence for the existing stale-schema issue; fresh-session recovery is the bounded current workaround, not active-thread freshness.

  9. Paraphern commented on Oct 21, 2026

    @Paraphern

    Replying to the question of "a reliable way to catch MCP tool/schema changes before they cause calls to fail" - yes, there is one, and it is complementary to both the candidate fix above and the live-watcher approach described in this thread:

    Pin the tool contracts at approval time and diff against them. We maintain rugsnare (Apache-2.0): scan captures every tool's {name, description, inputSchema} as a signed baseline, diff (or a CI step / GitHub Action) reports every change graded by direction - the duration -> lookback case would surface as a schema drift with the exact before/after, at upgrade time rather than at first failed call.

    The three layers compose rather than compete: @barryw's fix makes the client honor tools/list_changed; a live watcher flags changes the moment they happen; a pin answers the question neither can - "is what the server serves now the same shape the user approved?" - including cases where nobody is watching (fresh CI run, new machine, first session after an upgrade). Field evidence for how often that matters: 25 of 28 MCP servers we watch changed at least one tool contract across version windows (corpus + repro).

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

    bugmcp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions