fix(mcp): 修复非 UUID Agent ID 无法解析的问题 - #2422
Merged
lyingbug merged 1 commit intoJul 30, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes MCP agent resolution so that non-UUID agent identifiers returned by list_agents (e.g. builtin-wiki-researcher) can be correctly used with APIs like agent_chat / get_agent, by enhancing resolve_agent_id to match both agent id and name.
Changes:
- Update
resolve_agent_idto (for non-UUID input) first match agentidexactly, then fall back to case-insensitivenamematching. - Update the
resolve_agent_iddocstring to reflect support for both ID and name inputs. - Add regression tests covering non-UUID ID resolution and the existing case-insensitive name resolution behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mcp-server/weknora_mcp_server.py | Fix agent resolution logic to support exact matching on non-UUID agent IDs before falling back to name matching. |
| mcp-server/tests/test_agent_id_resolution.py | Add pytest regression coverage for non-UUID agent IDs and case-insensitive name matching. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
问题描述
使用MCP来调用工具
list_agents会返回内置 Agent 的 ID(例如builtin-wiki-researcher),但该非 UUID ID 传给agent_chat或get_agent时会被解析失败并报“Agent not found”。根因是
resolve_agent_id对非 UUID 入参仅按 Agent 的name(忽略大小写)匹配,未按id匹配。变更类型
修复内容
id。name忽略大小写匹配的行为。测试
builtin-wiki-researcher可按非 UUID ID 解析的回归测试。pytest,结果:2 passed。检查清单
git diff --check origin/main...HEAD通过