Skip to content

feat: enhance tools command to display nested object properties - #27

Merged
maplezzk merged 5 commits into
mainfrom
feature/tools-nested-display
Feb 5, 2026
Merged

maplezzk merged 5 commits into
mainfrom
feature/tools-nested-display

Conversation

@maplezzk

@maplezzk maplezzk commented Feb 5, 2026

Copy link
Copy Markdown
Owner

🎯 功能改进

增强 mcps tools 命令,完整显示工具参数的结构信息,解决之前嵌套对象参数只显示 "object" 导致信息缺失的问题。

✨ 主要改进

1. 递归显示嵌套对象结构

  • 之前:params: object
  • 现在:
    params*: object
      token*: string (The wiki node token...)
      obj_type: string ["doc", "docx", ...]
    

2. 显示数组元素类型

  • 之前:owner_ids: array
  • 现在:owner_ids: array of string (Open ID of the file owner)

3. 显示枚举值选项

  • 之前:member_type: string
  • 现在:member_type*: string ["email", "openid", "unionid", ...]

4. 新增 --json 选项

  • 支持输出原始 JSON schema,方便调试和查看完整结构

📝 示例对比

修复前:

Arguments:
  params: object
  path*: object
  useUAT: boolean

修复后:

Arguments:
  params: object
    lang: number (Specifies the language...)
  path*: object
    document_id*: string (The unique identification...)
  useUAT: boolean (Use user access token...)

🧪 测试

  • ✅ 新增 9 个单元测试,覆盖各种参数结构
  • ✅ 所有 40 个测试通过
  • ✅ 实际测试通过多个 MCP 服务器(feishu-docs 等)

📚 文档

  • 更新 README.md 和 README.zh.md
  • 添加新功能说明和输出示例
  • 更新命令行选项文档

🏷️ 版本

  • 版本号:1.5.0 (minor)
  • 分支:feature/tools-nested-display
  • 标签:v1.5.0

✅ PR 检查清单

  • 从最新 main 分支创建的功能分支
  • 代码已提交到功能分支(非 main 分支)
  • 新功能包含对应的单元测试
  • 版本号已使用 npm version 更新
  • npm run build 构建成功
  • npm test 所有测试通过
  • 提交信息符合规范
  • PR 描述清晰说明了变更内容

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Claude Bot and others added 5 commits February 5, 2026 22:44
…dd JSON output

- 修复嵌套 object 类型参数不展开显示的问题,现在递归显示所有嵌套属性
- 添加数组类型的元素类型显示(例如:array of string)
- 添加枚举值选项显示(例如:string ["value1", "value2"])
- 新增 --json 选项,可输出原始 JSON schema 方便调试
- 更新 README.md 和 README.zh.md 文档,包含新的输出示例和选项说明

修复问题:之前 tools 命令输出嵌套对象参数时只显示 "object" 而不展开内部结构,
导致用户无法看到完整的参数定义,影响了工具的使用体验。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Remove unused import of captureConsole
- Add type annotations (any) to fix type inference issues
- All 40 tests passing
- Add `npm run check` script that runs build and test together
- Update DEVELOPMENT.md to emphasize the importance of running build before test
- Add common error case: only running npm test without build
- Update PR checklist to highlight TypeScript compilation check

This prevents the issue where vitest passes but tsc fails,
which caught us in PR #27.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@maplezzk
maplezzk merged commit 0d2fc17 into main Feb 5, 2026
1 check passed
@maplezzk
maplezzk deleted the feature/tools-nested-display branch February 5, 2026 15:37
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.

1 participant