feat(mcp): expose chatroom ID in get_chat_history/get_chat_images headers#142
Open
crimsonsky1 wants to merge 1 commit into
Open
feat(mcp): expose chatroom ID in get_chat_history/get_chat_images headers#142crimsonsky1 wants to merge 1 commit into
crimsonsky1 wants to merge 1 commit into
Conversation
When multiple groups share a name prefix (e.g. "18福特Fusion_211" appears in 3 different rental-period groups), passing the short name to downstream tools like decode_image causes resolve_username() to match the wrong group. This commit adds the resolved internal ID to the output headers of get_chat_history and get_chat_images so callers can reuse the exact ID for subsequent tool calls, eliminating fuzzy-match ambiguity. - get_chat_history: group chats show `[群聊, id=xxx@chatroom]`; non-group chats show `[id=wxid_xxx]` when username differs from display name - get_chat_images: header includes `id=xxx` when username differs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When multiple groups share a name prefix (e.g.
18福特Fusion_211appears in 3 rental-period groups), passing the short display name to downstream tools likedecode_imagecausesresolve_username()to match the wrong group — typically an older one that doesn't contain the targetlocal_id.Solution
Expose the resolved internal
username(chatroom ID likexxx@chatroomorwxid_xxx) in the output headers ofget_chat_historyandget_chat_images. Callers can then reuse the exact ID for subsequent tool calls, avoiding fuzzy-match ambiguity.Changes
get_chat_history: group chats now show[群聊, id=xxx@chatroom]; non-group chats show[id=wxid_xxx]whenusernamediffers fromdisplay_nameget_chat_images: header includes, id=xxxwhenusernamediffers fromdisplay_nameBefore / After
The IDs can be passed directly back to any MCP tool's
chat_nameparameter —resolve_username()already recognizes@chatroomandwxid_patterns and passes them through without fuzzy matching (line 501).No behavioral change for tools that receive the exact display name.