Repository navigation
Add the Agent Drive tools: upload_file, list_files, get_file, delete_file - #81
Merged
Merged
Conversation
…file upload_file runs the API's three-step upload in one call (create, PUT the bytes to the presigned URL, complete), since a model can't make the PUT: it takes text, or base64 for other bytes, and computes the size and SHA-256 itself. list_files, get_file and delete_file map one to one. Results leave out the file's sha256 and the inbox's duplicate email. Bumps to 0.15.0. Needs the agentmail SDK release that adds client.inboxes.files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0.5.46 is the SDK release with client.inboxes.files; tsc --noEmit no longer reports it missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shalim786
marked this pull request as ready for review
October 14, 2026 23:58
sidharth0612
approved these changes
Oct 15, 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.
TL;DR
Adds four Agent Drive tools (AgentMail Labs, US only):
upload_file,list_files,get_fileanddelete_file. It bumps the toolkit to 0.15.0.Requires
agentmail0.5.46, the SDK release withclient.inboxes.files(from agentmail-docs#314). Against it,tsc --noEmitreports nothing for these tools.Design: one upload tool
The API uploads in three steps: Create File returns a presigned PUT, the client sends the bytes there, then calls Complete File. A model can't make that PUT, so
upload_filedoes all three in one call:contentas plain text (encoding: utf8, the default) or base64 for any other bytes.Buffer.redirect: 'error'(a presigned S3 URL never redirects) and a 60-second timeout.Text content defaults to
text/plain; charset=utf-8. Base64 content without acontentTypegets the API'sapplication/octet-stream.The identical call is safe to retry. The API returns the file it already made, and completes it itself if the bytes had landed. So only a file still waiting for its bytes gets another PUT.
Size: the hosted MCP server accepts request bodies up to 10 MB, which is roughly 7 MB of file as base64. The API caps a file at 100 MiB.
There's no
urlvariant like the one attachments have. The toolkit would have to fetch arbitrary URLs from the MCP host itself, which is a request-forgery risk.Outputs
FileItemSchemaandFileSchemaallowlist the fields an agent uses:fileId,inboxId,path,name,size,contentType,status, the timestamps,expiresAt, plusdownloadUrl/downloadExpiresAtonget_fileandupload_file. The API'ssha256and the inbox's duplicateemailstay out.Tests
tests/drive.test.tscovers:expiresAtpassed as aDate;get_fileleaving outsha256andemail.pnpm lint,pnpm buildandpnpm test(673 tests) pass.After merge
Publish to npm, then agentmail-mcp bumps
agentmail-toolkitand its exactagentmailpin, adds the tools tocoreTools, and regenerates the manifest.🤖 Generated with Claude Code