Skip to content

feat(attachments): [1/4] add infrastructure for dynamic tools and file utilities - #114

Open
nguyenthe-hien wants to merge 1 commit into
nulab:mainfrom
nguyenthe-hien:pr1-attachment-infrastructure
Open

feat(attachments): [1/4] add infrastructure for dynamic tools and file utilities#114
nguyenthe-hien wants to merge 1 commit into
nulab:mainfrom
nguyenthe-hien:pr1-attachment-infrastructure

Conversation

@nguyenthe-hien

Copy link
Copy Markdown

Summary

Part 1 of 4 splitting #83 into smaller reviewable units, as requested by @katayama8000.

This PR contains only the foundational infrastructure — no user-visible tools are added yet.

What's in this PR

  • Adds dynamicTools field to Toolset type for tools returning binary content
  • Extends registerTools to register dynamic tools wrapped with backlogErrorHandler
  • Updates dynamicTools/toolsets to expose a dynamic flag in the listing
  • Adds utilities used by attachment download/transfer flows:
    • streamToBase64, streamToBuffer
    • getMimeType
    • buildFileContent, buildAttachmentResult
    • optimizeImageForInline
  • Bumps @modelcontextprotocol/sdk to ^1.29.0 and adds sharp for image optimization

Files: 16

Stacked PR series (please review/merge in order)

Important for reviewers: these 4 PRs are designed to be reviewed and merged sequentially. Each later PR includes the changes from earlier PRs in its diff (all branches are based on main), but the intent of each PR is only the new layer it introduces.

Recommended merge order:

  1. #THIS — Infrastructure (this PR)
  2. List tools (next PR)
  3. Download tools
  4. Transfer tool + README

Original combined PR: #83 (will be closed once these are merged).

Verification

  • npm run lint
  • npm run typecheck
  • npm test ✅ — 346 tests pass

Credits

🤖 Generated with Claude Code

…ities

Foundational plumbing for attachment download tools (no user-visible tools yet):

- Add `dynamicTools` field to `Toolset` type for binary-returning tools
- Extend `registerTools` to register dynamic tools wrapped with backlog error handler
- Update `dynamicTools/toolsets` to expose `dynamic` flag in listing
- Add utilities: streamToBase64, streamToBuffer, getMimeType,
  buildFileContent, buildAttachmentResult, optimizeImageForInline
- Bump @modelcontextprotocol/sdk to ^1.29.0 and add `sharp` for image optimization

Part 1/4 of splitting nulab#83 into reviewable units.
@alex-pythonista

Copy link
Copy Markdown
Contributor

@nguyenthe-hien hey man, whenever you have time, please resolve the merge conflicts.

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