Skip to main content
Glama

patch_artifact

Destructive

Cambia PEDAZOS de un artefacto ya guardado, sin volver a mandarlo entero. Es la forma normal de editarlo: save_artifact cobra el archivo completo en cada guardado (un artefacto de 100 KB son ~50.000 tokens de salida), un parche cobra lo que cambia.

Cada edit es un reemplazo LITERAL (no es una regex) sobre el HTML guardado:

  edits: [{ buscar: "<td>42</td>", reemplazar: "<td>57</td>" }]

Las reglas, que son lo que lo hace seguro:
  · Cada `buscar` tiene que aparecer EXACTAMENTE UNA VEZ. Con 0 o con varias no se guarda nada y se te dice cuántas hay: ampliá el fragmento —sumale la línea de arriba o la de abajo— hasta que sea único. Si querés cambiar todas a propósito, mandá todas:true en ese edit.
  · Es atómico: si un solo edit no encaja, no se aplica ninguno y no se crea versión.
  · Se aplican EN ORDEN sobre el texto en memoria, así que el edit 3 ve lo que hicieron el 1 y el 2.
  · Queda como una versión nueva, igual que save_artifact: la anterior sigue en el historial y se puede restaurar.

El texto exacto para `buscar` sale de **get_artifact con buscar="…"**, que devuelve sólo los fragmentos que coinciden con su contexto alrededor: ~800 caracteres en vez de los 107.000 del archivo.

Se parchea el HTML GUARDADO —para un artefacto react, markdown o mermaid, el ya envuelto—, que es exactamente lo que devuelve get_artifact.

Con base_version se exige que la versión viva sea esa: si alguien guardó en el medio no se pisa nada y se te dice cuál es la actual.

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": {
      "artifact_id": "<artifact_id>",
      "edits": "<edits>"
    },
    "name": "patch_artifact"
  }
}

Input Schema

NameRequiredDescriptionDefault
notaNoQué cambió, en una línea. Es lo que se lee en el historial de versiones.
editsYesLos reemplazos, en orden. Hasta 50.
artifact_idYesID del artefacto a editar
base_versionNoLa versión sobre la que calculaste los edits. Si ya no es la viva, se rechaza el parche.
workspace_idNoUUID del workspace, o su nombre tal como lo dice el usuario ('Acme', 'el personal'). Omitir si el token ya tiene workspace fijo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=false, but the description adds the behavior that matters: edits are literal (not regex), each buscar must match exactly once, the operation is atomic (no partial apply, no version created), edits apply in order over in-memory text, and a new restorable version is produced. What it does not spell out is what a failure response looks like beyond the match-count message, which keeps it just under a 5.

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 purpose and cost rationale, then a worked example, then a bulleted rules block — easy to scan. There is minor redundancy (the exactly-once rule is stated in the prose and again in the edit example's framing) and the token-count figures appear twice, but nothing is filler.

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 mutation tool with no output schema, the description covers everything an agent needs: how to source the literal text, uniqueness and atomicity failure modes, ordering semantics, version-history effects, and concurrency via base_version. The remaining parameters are fully documented in the schema, so nothing material is missing.

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

Parameters5/5

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

Schema coverage is already 100%, yet the description still adds real meaning: buscar is a LITERAL string taken from get_artifact output, the todas flag is the escape hatch for intentional multi-match, base_version rejects the patch if the live version moved on, and the stored HTML (including the react/markdown/mermaid wrapper) is the target. This is meaning beyond what the schema fields alone convey.

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?

Opens with a specific verb and scope: it changes PEDAZOS of an already-saved artifact without resending the whole file, and explicitly contrasts that with save_artifact's full-file cost. An agent can distinguish it from save_artifact, get_artifact and append_artifact without opening any schema.

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?

States that this is 'la forma normal de editarlo' and quantifies why (100 KB ≈ 50.000 output tokens vs. paying only for the delta), which is an explicit when-to-use rule. It also routes the agent to get_artifact with buscar=... to obtain the exact literal text, and explains the base_version guard case.

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