Feature: Read and download project files - #535
Merged
Merged
Conversation
Contributor
Member
Author
Add twprojects-list_files, twprojects-get_file and twprojects-download_file on twapi-go-sdk v1.30.0. Files could be uploaded and attached but never read back: nothing listed a project's files area, showed a file's details, or returned its content. list_files and get_file follow the list and get contracts (verbose, fields, count_only, ordering, streamed body, web links). download_file fetches the content through the SDK's FileDownload with the engine's own session: text comes back as text, images as image content, anything else as an embedded resource blob, capped at 10 MB with an error result pointing at the file's downloadURL for anything larger. The download's second hop is a pre-signed storage request, so LoggingRoundTripper elides its response body the way it already elides the upload's request body: the content is the customer's file, under the file's own content type. The SDK bump also carries the file relationships on tasks, comments and message replies, which the get tools show through the typed round-trip; a test per tool pins that they are not dropped. Two call sites are updated for renames in the same bump. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ripexz
force-pushed
the
feature-file-download
branch
from
September 11, 2026 13:59
2fd5ed2 to
69e7083
Compare
rafaeljusto
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Files could be uploaded and attached through
twprojects-create_file,twprojects-create_upload_urlandtwprojects-add_project_file, but never read back: nothing listed a project's files area, showed a file's details or returned its content. This adds the read side on twapi-go-sdk v1.30.0.twprojects-list_files— a project's files area, or every project whenproject_idis omitted.task_idanswers "what is attached to this task". Filters for IDs, category, tags, uploaders, search term (optionally across all fields), upload date window, updated-after, deleted files and external files, with the boundary rule stated on each date parameter. Follows the list contract:verbose,fields,count_only, ordering, streamed body and web links.twprojects-get_file— details, version history, the tasks, messages and comments a file is attached to, and itsdownloadURL.versionselects an older version,include_versionsinlines the history,fieldsnarrows the row.twprojects-download_file— the content, fetched through the SDK'sFileDownloadwith the engine's own session. Text comes back as text, images as image content, anything else as an embedded resource blob with its media type. Content is capped at 10 MB, checked against the declared length first and then by reading one byte past the cap, with an error result pointing at the file'sdownloadURLfor anything larger. The media type comes from the storage header, then the file extension, since storage answersapplication/octet-streamfor anything the uploader's client did not recognise.LoggingRoundTrippernow elides the response body of a pre-signed storage request, as it already elides the upload's request body: the content is the customer's file, under the file's own content type, so a CSV or Markdown download otherwise looked loggable.attachments), message replies (attachments) and comments (files), soget_task,get_commentandget_message_replynow show which files an item carries;download_file's description names them as the source of the file ID. Two call sites are updated for renames in the same bump.Tool-definition cost (
go run ./cmd/mcp-tokens -base=main): +1,551 o200k tokens (+2.3%), of whichlist_filesis 1,101.Type of Change
Testing
go test -v ./...)Wire-level tests pin every
list_filesfilter and both routes on the query string, theget_fileparameters and the selection dropping the sideload, and each content-block shape ofdownload_file(text, image, resource, extension fallback, oversize refusal, API failure as a tool result). The three tools are registered in the sparse-fields, ordering and count tables, and a test per get tool pins that the file relationships survive the typed round-trip. The logging change has its own test. The SDK's own integration tests for these routes were run against a live site before v1.30.0 was tagged.Checklist
🤖 Generated with Claude Code