feat(tools): add issue attachment upload/download/delete tools #17
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-attachment-tools"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Surface the attachment capabilities already provided by youtrack-client (upload_attachment, download_attachment, delete_attachment) as MCP tools so an agent can attach screenshots and logs without leaving the MCP for the web UI. Only list_issue_attachments was previously exposed.
add_issue_attachment accepts a local file_path (primary) or base64 content with a required filename; the two are mutually exclusive. The file name's extension drives the MIME type YouTrack infers server-side. Base64 uploads are staged in a uniquely-named temp file (cleaned up regardless of outcome) so they flow through the canonical youtrack-client upload path. Uploads above 25 MiB are rejected before any network call with an actionable invalid-params error, and a path-component strip on caller-supplied filenames prevents temp-dir escape.
get_issue_attachment resolves an attachment id to its metadata via the list endpoint, downloads the bytes, and returns them base64-encoded alongside id/name/url/size/mimeType. delete_issue_attachment removes an attachment by id.
Adds an invalid_params error helper and unit tests for the pure upload-source validation (mutual exclusion, missing filename, bad base64, oversize, path stripping).
#YTMCP-12