Skip to main content
Glama

Prepare direct binary attachment uploads

mail_prepare_attachment_uploads

Prepare one to ten original files for a later mail_send_message call without putting Base64 in model-generated JSON. Use this only when the client runtime can read the original file bytes, calculate exact size and SHA-256, and perform an HTTPS PUT. The combined original size is at most 10485760 bytes. The server atomically reserves the whole set and returns one short-lived, one-use upload capability per file. For every returned item, PUT the unchanged raw bytes to upload_url with Content-Type: application/octet-stream, exact Content-Length and Authorization: Bearer <upload_token>. Never put the token in the URL or a message. After every PUT returns status=ready, call mail_send_message with the returned attachment_ids and the same inbox_id and idempotency_key. Existing archive, encryption, malware and active-content rules remain unchanged. If the client code sandbox cannot reach upload_url and inband_upload.eligible is true, do not ask the user to change network settings: upload the file through mail_upload_attachment_chunk instead.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "idempotency_key": "<idempotency_key>",
      "files": "<files>"
    },
    "name": "mail_prepare_attachment_uploads"
  }
}

Input Schema

NameRequiredDescriptionDefault
filesYesMetadata for one to ten original files. Their combined original size must not exceed 10485760 bytes.
inbox_idNoAuthorized sender inbox ID. Omit it when exactly one inbox is authorized.
idempotency_keyYesThe exact idempotency_key that the later mail_send_message call will use. The prepared attachments cannot be used with a different key.

Output Schema

NameRequiredDescriptionDefault
batch_idYes
expires_atYes
attachmentsYes
inband_uploadYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare the coarse profile (readOnlyHint=false, openWorldHint=true, idempotentHint=false, destructiveHint=false). The description goes far beyond: atomic whole-set reservation, one short-lived single-use token per file, required PUT headers (Content-Type, exact Content-Length, Bearer token), the status=ready completion gate, a 10485760-byte combined cap, and a security constraint never to put the token in a URL or message.

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

Conciseness4/5

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

Front-loaded with the purpose and preconditions, then the operational sequence, then the fallback. Every sentence carries operational weight, though the middle PUT-instruction block is dense and could be slightly tightened without losing rules.

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?

An output schema exists so return values need not be restated, yet the description still tells the agent how to consume the returned items (PUT to upload_url, wait for status=ready, feed attachment_ids forward). For a multi-step, token-bearing, mutation-adjacent tool this leaves nothing material unaddressed.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description nonetheless adds cross-call meaning the schema cannot express: the idempotency_key must be the same one the later mail_send_message call uses, prepared attachments cannot be reused with a different key, and the same inbox_id must be passed through.

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 (prepare), resource (original file attachments), and mechanism (direct binary upload not Base64 in model JSON). It also positions itself against siblings: it prepares for a later mail_send_message and names mail_upload_attachment_chunk as the fallback path.

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 an explicit precondition ('only when the client runtime can read the original file bytes, calculate exact size and SHA-256, and perform an HTTPS PUT'), an explicit follow-up sequence (call mail_send_message with the returned attachment_ids and matching inbox_id/idempotency_key), and an explicit exclusion path to mail_upload_attachment_chunk when the sandbox cannot reach upload_url.

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.