Skip to content

fix(mcp): stabilize tool ordering#32510

Open
wgu9 wants to merge 1 commit into
anomalyco:devfrom
wgu9:mcp-tool-order
Open

fix(mcp): stabilize tool ordering#32510
wgu9 wants to merge 1 commit into
anomalyco:devfrom
wgu9:mcp-tool-order

Conversation

@wgu9

@wgu9 wgu9 commented Jun 16, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #23571

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Sorts MCP servers and tools by their final sanitized prompt tool keys before building the tool map, so equivalent MCP configs produce deterministic tool order across reconnects and restarts.

How did you verify your code works?

  • bun test test/mcp/lifecycle.test.ts
  • bun typecheck
  • bunx oxlint packages/opencode/src/mcp/index.ts packages/opencode/test/mcp/lifecycle.test.ts (0 errors; existing warnings)
  • git diff --check
  • pre-push bun turbo typecheck

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP tool ordering changes after restart and breaks prompt caching

1 participant