Skip to content

feat(attachments): [3/4] add download tools for issue, wiki, and pull request#116

Open
nguyenthe-hien wants to merge 3 commits into
nulab:mainfrom
nguyenthe-hien:pr3-attachment-download-tools
Open

feat(attachments): [3/4] add download tools for issue, wiki, and pull request#116
nguyenthe-hien wants to merge 3 commits into
nulab:mainfrom
nguyenthe-hien:pr3-attachment-download-tools

Conversation

@nguyenthe-hien

Copy link
Copy Markdown

Summary

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

Adds three dynamic tools that download attachment binary content and return it as MCP image (inline, when MIME type is an image) or resource (blob) otherwise.

What's in this PR (new layer)

  • getIssueAttachmentTool (dynamic)
  • getWikiAttachmentTool (dynamic)
  • getPullRequestAttachmentTool (dynamic)
  • Wired into the issue, wiki, and git toolsets under dynamicTools

Depends on

This branch sits on top of PRs 1 and 2, so its diff against main includes their changes. Review only the new layer (download tools); earlier layers are reviewed in #114 and #115.

Files: 29 total (6 new in this PR + 23 from PRs 1+2)

Stacked PR series (please review/merge in order)

Important for reviewers: the 4 PRs are designed to be reviewed and merged sequentially. All branches base on main, so later PRs' diffs include earlier PRs' code until they are merged.

Recommended merge order:

  1. feat(attachments): [1/4] add infrastructure for dynamic tools and file utilities #114 — Infrastructure
  2. feat(attachments): [2/4] add list tools for issue, wiki, and pull request #115 — List tools
  3. #THIS — Download tools
  4. Transfer tool + README (next)

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

Verification

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

🤖 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.
Adds three list tools that return attachment metadata (JSON) for issues,
wiki pages, and pull requests, and wires them into the `issue`, `wiki`,
and `git` toolsets.

- getIssueAttachmentsTool
- getWikiAttachmentsTool
- getPullRequestAttachmentsTool

Part 2/4 of splitting nulab#83 into reviewable units. Depends on PR 1 (infrastructure).
Adds three dynamic tools that download attachment binary content and
return it as MCP `image` (inline, for image MIME types) or `resource`
(blob) based on the detected MIME type.

- getIssueAttachmentTool
- getWikiAttachmentTool
- getPullRequestAttachmentTool

Wired into the `issue`, `wiki`, and `git` toolsets as dynamic tools so
their binary output is registered through the dynamic-tool path.

Part 3/4 of splitting nulab#83 into reviewable units. Depends on PR 2 (list tools).
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