Skip to main content
Glama

Create attachment

create_attachment

Create a new attachment — a record in the sfiles table plus the stored file — and return its id. To attach the file to a record, write the returned id into a File or Image column with write_data; every attachment id must be referenced by exactly one record and column, never reuse it elsewhere. Existing attachments cannot be modified — create a new one and update the referencing column instead. Provide the content either as text (stored as UTF-8) or as base64, never both.

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": {
      "filename": "<filename>"
    },
    "name": "create_attachment"
  }
}

Input Schema

NameRequiredDescriptionDefault
contentNoText content of the file, stored as UTF-8 with a byte order mark. Use for text formats (txt, csv, json, xml, html, svg, ...).
filenameYesFile name including the extension, e.g. report.pdf. The extension determines the stored content type.
content_base64NoBase64-encoded binary content of the file. Use for binary formats (images, pdf, office documents, ...).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior4/5

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

Annotations only declare the safety profile (mutating, non-idempotent, non-destructive), while the description adds the crucial behavioral invariant that every attachment id must be referenced by exactly one record and column and never reused, and that attachments are immutable. This is real context beyond the annotations; only return-shape and failure modes are left implicit, and the id return is already stated.

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 primary statement of what is created and returned, then the referencing rule, then the immutability rule, then the content-format rule — a logical order with no filler. It is dense but each sentence carries a distinct constraint; only the final clause mildly restates the schema.

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 three-parameter creation tool with no output schema, the description supplies purpose, return value (the id), the cross-tool workflow, immutability constraints, and content-format rules. Nothing an agent needs in order to call it correctly is missing.

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 parameter documentation is already complete and the baseline is 3. The description adds one piece of meaning the schema leaves implicit: the mutual exclusivity of text and base64 content ('never both'), which prevents a plausible calling error.

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?

The description names a specific verb and resource ('Create a new attachment') and immediately resolves what that means concretely: a record in the sfiles table plus the stored file, returning its id. This is far more informative than the title and cannot be confused with read_attachment or write_data.

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?

It explicitly routes the agent: use write_data to place the returned id into a File or Image column. It also states an exclusion — existing attachments cannot be modified, create a new one and update the referencing column instead — which tells the agent when not to attempt an edit path.

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