Files
synapbus/internal
Algis DumbrisandClaude Opus 4.7 e59fb5a1e2 fix(mcp): alias common wrong action names + "did you mean" suggestions
Agents call() into the bridge with action names they guess from prior MCP
conventions or their training data — e.g. `read_channel`, `search`,
`my_status`, `read_dm`, `read_article`. Each produced a useless
"unknown action: X" WARN and no progress.

This change:
- Adds a small alias map (bridgeActionAliases) for observed wrong names
  that have a single unambiguous bridge equivalent:
    read_channel → get_channel_messages
    search       → search_messages
    read_dm      → read_inbox
    my_status    → read_inbox
    read_article → get_article
- Adds bridgeTopLevelOnly for wrong names whose real implementation lives
  as a top-level MCP tool, not a bridge action (rewrite_core_memory →
  memory_rewrite_core); the error now tells the agent to invoke the
  top-level tool instead of failing silently.
- For everything else, the default error includes a "did you mean"
  suggestion computed via substring match + Levenshtein (threshold 2-3)
  against the known bridge actions. Pure Go, no deps.

Tests cover each alias, the top-level-tool hint, "did you mean"
suggestions for close typos, no suggestion for distant strings, and the
Levenshtein helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 07:00:16 +03:00
..