Skip to main content
Glama

Upload files to attach

attachments_generate_upload_link

Creates an upload link (valid 30 minutes, up to 10 files and 150 MB in all) for files to attach to a message. Use it instead of content_base64 for a file on your own disk, and for a file only the user has. If you can make HTTP requests, upload each file yourself, one at a time: PUT its raw bytes (not multipart, not base64) to put_url with ?name= and the URL-encoded file name, with its Content-Type (curl -T works), then POST finish_url once. Otherwise give the user url, a page where they drop the files, and ask them to say when they are done. Then call attachments_check_upload_status and pass its upload tokens to mail_send, mail_reply, mail_forward or mail_create_draft. Example: {}.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "attachments_generate_upload_link"
  }
}

Input Schema

NameRequiredDescriptionDefault
noteNoShown on the upload page, e.g. "The signed contract".

Output Schema

NameRequiredDescriptionDefault
urlYesThe upload page, for the user.
put_urlYesFor an agent: PUT one file's raw bytes to put_url?name=<URL-encoded file name>; one file at a time.
upload_idYes
expires_atYes
finish_urlYesFor an agent: POST here, no body, once every file is in; then call attachments_check_upload_status.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedOutput schema / properties / finish_url
      Added value: +{
      +  "description": "For an agent: POST here, no body, once every file is in; then call attachments_check_upload_status.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / put_url
      Added value: +{
      +  "description": "For an agent: PUT one file's raw bytes to put_url?name=<URL-encoded file name>; one file at a time.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / url / description
      Added value: +"The upload page, for the user."
    • changedOutput schema / required
      Previous value: -[
      -  "upload_id",
      -  "url",
      -  "expires_at"
      -]New value: +[
      +  "upload_id",
      +  "url",
      +  "put_url",
      +  "finish_url",
      +  "expires_at"
      +]
  2. First observed

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations only declare the safety profile (not read-only, not destructive, not idempotent), and the description adds substantial behavior: link expiry, size/count caps, raw-bytes PUT to put_url with ?name= and Content-Type, a single POST to finish_url, and the human fallback page. It leaves the interaction between the non-open-world annotation and the agent-initiated HTTP uploads unexplained, which is a mild ambiguity rather than a contradiction.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the purpose and constraints, then ordered by decision branch and follow-up call. Every clause carries operational information (protocol details, fallback path, downstream tools), and the trailing empty example correctly signals that no input is required.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-required-parameter tool with an output schema, the description covers everything an agent needs: when to pick it, how to perform the upload, what to do without HTTP capability, and what to call next. Return values can be left to the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the single 'note' parameter is already documented as text shown on the upload page. The description adds nothing about the parameter, so it neither compensates nor detracts — baseline 3 applies when the schema fully carries parameter meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Creates an upload link ... for files to attach to a message') and immediately scopes it with concrete limits (30 minutes, 10 files, 150 MB). It also distinguishes its role from the base64 parameter path, so an agent can tell what it is and what it is not.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit selection guidance: use this rather than content_base64 for files on the agent's own disk or files only the user has. It then branches the workflow into two concrete cases (agent can make HTTP requests vs. hand the URL to the user) and names the required follow-up sibling, attachments_check_upload_status, plus the mail_* tools that consume its tokens.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources