Skip to content

MCP tool ordering changes after restart and breaks prompt caching #23571

@CoolZxp

Description

@CoolZxp

Description

After restarting OpenCode, the order of MCP tools can change even when the MCP configuration itself has not changed.
This breaks prompt caching for providers such as OpenAI, causing previously reusable cache entries to be missed.

Plugins

None

OpenCode version

1.14.19

Steps to reproduce

  1. Configure multiple MCP tools.
  2. Use the OpenAI provider.
  3. Start OpenCode and send a message.
  4. Record the order of tools in the request.
  5. Restart OpenCode.
  6. Send another request with the same configuration.
  7. Compare the tools field in both requests. The tool set may be identical, but the order can differ.
  8. This causes OpenAI prompt cache reuse to become unstable.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions