Skip to main content
Glama

Turn something you just worked out into a reusable tool

procedure_save

Turns a verified browser task into a parameterized, reusable callable tool so future agents invoke it instead of repeating the work.

Instructions

Promote a task you have just completed into a callable tool, so the next agent invokes it instead of working it out again. This is the highest-leverage thing you can leave behind: a lesson still has to be read and applied, a procedure is simply called.

Save one only when you have actually run the code and seen it work in this session.

Parameterize it. If you fetched metrics for one VPS over one time window, the procedure takes (vpsId, hours) — hardcoding the values you happened to use is the single most common way this goes wrong and produces a tool nobody can reuse.

The code runs in the page via evaluate, with your parameters available as params. It must return a value. It is checked against origin before running, so it cannot fire on the wrong site. Mark mutating: true for anything that creates, changes or deletes — those refuse to run without explicit confirmation, and should be rare.

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": {
      "url": "<url>",
      "name": "<name>",
      "description": "<description>",
      "origin": "<origin>",
      "code": "<code>"
    },
    "name": "procedure_save"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesThe site this belongs to.
codeYesJS body with `params` in scope. Must return a value. No secrets — they are stripped.
nameYesTool name: lowercase with underscores, descriptive, globally unique. e.g. "examplehost_list_vps".
originYesExact origin it must run on, e.g. "https://panel.examplehost.com".
paramsNoThe parameters it accepts.
expectsNoShape of a successful result, so a wrong answer is recognizable.
mutatingNoTrue if it changes state on the site. Defaults to false.
descriptionYesWhat it does, for an agent deciding whether to call it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.5/5.0
Behavior5/5

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

With zero annotations, the description carries the full burden and does: it discloses the execution environment (code runs in the page via evaluate), the runtime contract (params in scope, must return a value), a safety gate (checked against origin before running, so it cannot fire on the wrong site), and the consequence of mutating:true (refuses to run without explicit confirmation). These are exactly the behavioral facts an agent needs before creating a side-effecting artifact.

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 core purpose and then organized into short imperative paragraphs (precondition, parameterize, execution contract), each covering a distinct concern. A few clauses are rhetorical rather than informational ('the highest-leverage thing you can leave behind', 'the single most common way this goes wrong') and could be trimmed without losing guidance.

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

Completeness4/5

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

For an 8-parameter, 5-required creation tool with no output schema and no annotations, the description covers environment, safety gating, mutation semantics, and the parameter contract well. It does not say what happens on a name collision despite requiring globally unique names, nor whether saved procedures are scoped per-site or available to all agents.

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, but the description adds meaning the schema cannot: why parameterization matters (hardcoding observed values is 'the single most common way this goes wrong'), the runtime binding of the params array into `params` inside the code body, and the operational meaning of the mutating flag rather than just its definition.

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 states a specific verb and resource: promote a just-completed task into a callable tool. It also draws the exact boundary against the nearest concept — 'a lesson still has to be read and applied, a procedure is simply called' — so an agent can tell why this exists rather than remembering a note.

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

Usage Guidelines4/5

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

It gives a hard precondition for use ('Save one only when you have actually run the code and seen it work in this session') and a strong when-not implied by that gate, plus 'should be rare' for the mutating case. It never names procedure_draft or procedure_list as alternatives, so the routing decision between drafting, saving, and listing is left to inference.

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