Skip to content

Feature: Read and download project files - #535

Merged
ripexz merged 2 commits into
mainfrom
feature-file-download
Sep 11, 2026
Merged

Feature: Read and download project files#535
ripexz merged 2 commits into
mainfrom
feature-file-download

Conversation

@ripexz

@ripexz ripexz commented Sep 11, 2026

Copy link
Copy Markdown
Member

Description

Files could be uploaded and attached through twprojects-create_file, twprojects-create_upload_url and twprojects-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 when project_id is omitted. task_id answers "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 its downloadURL. version selects an older version, include_versions inlines the history, fields narrows the row.
  • twprojects-download_file — the content, fetched 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 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's downloadURL for anything larger. The media type comes from the storage header, then the file extension, since storage answers application/octet-stream for anything the uploader's client did not recognise.
  • LoggingRoundTripper now 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.
  • The SDK bump carries the file relationships on tasks (attachments), message replies (attachments) and comments (files), so get_task, get_comment and get_message_reply now 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.
  • AGENTS.md notes on the download route, the size cap and the logging rule; generated docs refreshed.

Tool-definition cost (go run ./cmd/mcp-tokens -base=main): +1,551 o200k tokens (+2.3%), of which list_files is 1,101.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests pass locally (go test -v ./...)
  • Added/updated tests for new functionality

Wire-level tests pin every list_files filter and both routes on the query string, the get_file parameters and the selection dropping the sideload, and each content-block shape of download_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

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added necessary documentation
  • No new warnings or errors

🤖 Generated with Claude Code

@ripexz
ripexz requested a review from a team as a code owner September 11, 2026 13:52
@rafaeljusto

Copy link
Copy Markdown
Contributor

💣💣💣

image

@ripexz

ripexz commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

💣💣💣

image

I know I know, already rebasing as you posted 😁

ripexz and others added 2 commits September 11, 2026 15:58
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
ripexz force-pushed the feature-file-download branch from 2fd5ed2 to 69e7083 Compare September 11, 2026 13:59
@ripexz
ripexz merged commit 5333c2e into main Sep 11, 2026
4 checks passed
@ripexz
ripexz deleted the feature-file-download branch September 11, 2026 14:06
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