Skip to main content
Glama

Ejecutar código contra la API (Code Mode)

ejecutar
Read-onlyIdempotent

Corre JavaScript en un sandbox con un objeto api ya autenticado: una función async por tool, mismos parámetros y mismo resultado que llamarla directo. Ideal para lotes (validar 50 CBUs, armar 20 cronogramas) o para encadenar llamadas sin volver al modelo. El código puede usar await, console.log y return; el valor retornado vuelve en resultado. Costo: 1 crédito por ejecución + la suma de las llamadas internas. Máximo 100 llamadas y 15 s. Sin acceso a red, archivos ni módulos.

Funciones disponibles: api.normalizarDireccion({"direccion":"Av. Corrientes 1234","provincia":"CABA"}) → 2 crédito(s): Normalizar y geocodificar una dirección argentina api.ubicacion({"lat":-34.6037,"lon":-58.3816}) → 0 crédito(s): Geocodificación inversa: lat/lon → provincia, departamento y municipio api.buscarLocalidad({"nombre":"Rosario","provincia":"Santa Fe"}) → 0 crédito(s): Buscar localidades argentinas api.buscarCalle({"nombre":"Santa Fe","provincia":"CABA","categoria":"AV"}) → 1 crédito(s): Buscar calles en el callejero oficial api.buscarDivision({"tipo":"provincia","nombre":"cordoba"}) → 0 crédito(s): Buscar provincias, departamentos o municipios Costo: 1 crédito(s).

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": {
      "codigo": "<codigo>"
    },
    "name": "ejecutar"
  }
}

Input Schema

NameRequiredDescriptionDefault
codigoYesJavaScript. Ej: const r = await api.validarCuit({cuit:'20-12345678-6'}); return r.valido;
timeout_msNoTiempo máximo total en milisegundos

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations: credit cost (1 per execution plus the sum of internal calls), hard caps (100 calls, 15 s), sandbox limits (no network, files, or modules), and how values come back (`resultado`, `console.log`, `await`, `return`). The only blemish is inconsistent cost notation on `api.buscarDivision` (shows 0 credits, then appends 'Costo: 1 crédito(s)').

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-loads the core behavior, limits, and cost before the function catalog, and the catalog itself earns its space by defining the sandbox's actual API surface. There is some redundancy and sloppy duplication in the trailing cost annotations.

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?

No output schema exists, and the description compensates by explaining that the return value appears in `resultado`. It omits what happens on timeout or when the code throws, which matters for a sandboxed executor, and the validarCuit example points at a function not in the advertised list.

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 real semantics: what `codigo` may contain (await, console.log, return) and where the return value lands (`resultado`), plus the runtime caps that contextualize `timeout_ms`. The worked example references `api.validarCuit`, which is absent from the list of available functions, which muddies the contract slightly.

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 mechanism: run JavaScript in a sandbox with a pre-authenticated `api` object, one async function per tool mirroring the direct tools' params and results. That distinguishes it from every sibling (buscar_calle, normalizar_direccion, etc.) which are single-purpose lookups rather than a code-execution surface.

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?

Gives concrete selection criteria: use it for batches (validating 50 CBUs, building 20 schedules) or for chaining calls without a round-trip to the model, and implicitly routes single calls to the direct tools via 'mismo resultado que llamarla directo'. It stops short of an explicit 'do not use for a single call' exclusion.

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