Repository navigation
Description
Symptom (self-test, latest main 4f6a53d798f0)
Two isolated homes (@selftesta2.home / @selftestb2.home), mutual friends with live grants. After one side revokes its Bot grant, Sharing → Share with a friend fails with the raw MCP error:
flybot/social/share-with-friend: MCP error -32602: Tool grant_bot_to_friend not found
Expected
The handler already intends older Bot Social servers to degrade cleanly: grantBotToFriend should return { unavailable: true } and the UI should say "Bot Social needs an update to share with a friend. Invite links still work." (the #500/#516 contract). The REST fallback (POST /v1/bots/:id/grants/to-friend) should be attempted first; when it also 404s, the unavailable path should win.
Actual
The MCP tool-not-found error is not classified as unknown-tool, so no fallback runs and the raw MCP string is shown. isUnknownTool() matches unknown tool, no tool, method not found, unrecognized tool — but the server says MCP error -32602: Tool <name> not found, which matches none.
Evidence from this round:
- production
tools/listhas nogrant_bot_to_friend(it haslist_bot_grants/revoke_bot_grant); - direct REST
POST /v1/bots/bot_…/grants/to-friendreturns404 Route … not found; isUnknownTool(new Error("MCP error -32602: Tool grant_bot_to_friend not found"))→false.
Steps to reproduce
- Start two isolated homes on latest main; make them friends so both have a grant (invite A→B, then B→A).
- Revoke A's Bot grant to B (
social/revoke-grant), so B appears in A's share list again. social/share-friends { botId }→ B is listed.social/share-with-friend { botId, home: "@selftestb2.home" }→ raw MCP error above.
Scope / suggested fix
plugins/social/src/mcp-client.js:isUnknownToolshould also treatTool <name> not foundand-32602(JSON-RPC invalid params used by the production MCP server for a missing tool) as unknown-tool, sotryToolreaches the REST fallback and{ unavailable: true }.plugins/social/src/social.js:mapShareFriendErrorcan map the same wording to the friendlyunavailablemessage as a belt-and-braces guard.- Test: the existing Share a Bot with an existing friend without an invite link #500 test for a server without
grant_bot_to_friendusesnew Error("unknown tool"); add a case with the production wordingMCP error -32602: Tool grant_bot_to_friend not found.
Note: the production Bot Social server still lacks the companion capability itself, so the share action cannot succeed until it ships; the FlyBot-side defect is the fallback/error path. No issue opened in the upstream repo.
Activity
Birfy commentedon Oct 21, 2026
Triaged
agent-ready(bug,area:social, from self-test). Reproduced the classification bug at the root:isUnknownTool()knowsunknown tool/no tool/method not found/unrecognized tool, but the production server answers a missing tool withMCP error -32602: Tool <name> not found, sotryToolnever takes the REST fallback and the raw MCP string reaches the UI.Branch:
fix/563-share-with-friend-missing-tool(frommain4f6a53d7). Scope:plugins/social/src/mcp-client.js—isUnknownToolalso acceptsTool <name> not found, and-32602only when the text names a missing tool (so aninvalid paramserror that is not a missing tool still surfaces).plugins/social/test/social.test.js— a minimal repro with the production wording: the REST fallback runs, an absent route reportsunavailable, andsocial/share-with-friendshows the "needs an update … Invite links still work" sentence, not the raw error.docs/subsystems/social.md+ achangelog.d/563-…fixed.mdfragment.I am not touching
mapShareFriendError: onceisUnknownToolrecognises the wording,grantBotToFriendreturns{ unavailable: true }and the handler already maps that to the actionable sentence, so a second mapping would be unreachable code. The production server still lacks the capability itself, so sharing stays unavailable until it ships; this fixes the FlyBot-side fallback and message.Share with a friend degrades cleanly when the server lacks the tool (#…
Share with a friend degrades cleanly when the server lacks the tool (T…