Skip to content

Fix:修复13章旅行助手代码因为自动扩展字段失效,无法利用amap工具的问题#493

Merged
jjyaoao merged 1 commit intodatawhalechina:mainfrom
NikoHu1:fix-chapter13-amapExpandable
Apr 15, 2026
Merged

Fix:修复13章旅行助手代码因为自动扩展字段失效,无法利用amap工具的问题#493
jjyaoao merged 1 commit intodatawhalechina:mainfrom
NikoHu1:fix-chapter13-amapExpandable

Conversation

@NikoHu1
Copy link
Copy Markdown

@NikoHu1 NikoHu1 commented Apr 12, 2026

1.ToolRegistry 判断工具是否需要展开时,需要auto_expand 、hasattr(tool, 'expandable') 、tool.expandable 三个条件都同时满足
2.MCPTool 初始化时虽然有 auto_expand=true ,但没有把父类 Tool 的 expandable 属性设为真,导致 tool.expandable 仍是父类 Tool 中设置的默认值 false,从而使得 ToolRegistry 永远不会执行展开的代码逻辑
3.最终导致了高德的 MCP 工具无法正常使用

如果要正常使用高德 MCP 工具,还需要手动指定 self.amap_tool.expandable=True

@jjyaoao
Copy link
Copy Markdown
Collaborator

jjyaoao commented Apr 15, 2026

感谢,LGTM

@jjyaoao jjyaoao merged commit 6ccf79c into datawhalechina:main Apr 15, 2026
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.

2 participants