Skip to main content
Glama

Ejecutar código contra la API (Code Mode)

ejecutar

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.validarCuit({"cuit":"30-50001091-2"}) → 1 crédito(s): Validar CUIT/CUIL api.validarCbu({"cbu":"0070999000004012345672"}) → 1 crédito(s): Validar CBU/CVU api.normalizarTelefonoAr({"telefono":"011 15 2345-6789"}) → 1 crédito(s): Normalizar teléfono argentino api.cotizacionDolar({"casa":"blue"}) → 2 crédito(s): Cotización del dólar en Argentina 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. First observed

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: sandbox capabilities (await, console.log, return), where the return value lands (`resultado`), hard limits (100 calls, 15 s), the cost model (1 credit per execution plus the sum of internal calls), and explicit negative capability ("Sin acceso a red, archivos ni módulos"). That is precisely the risk-relevant information an agent needs before writing arbitrary code.

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?

Purpose is front-loaded in the first clause, followed by use cases, execution semantics, cost/limits, and finally the callable surface. The enumerated function catalog is long but earns its place because an agent literally cannot write valid code without knowing the `api.*` names, signatures and prices; a single minor oddity is the stray trailing "Costo: 1 crédito(s)" fragment at the end.

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 a high-complexity execution tool with no annotations and no output schema, the description covers execution model, limits, cost, return channel and the available functions. The remaining gap is failure semantics: it does not say whether an exception inside the code still costs a credit, what happens on timeout mid-batch, or how per-internal-call errors appear in `resultado`.

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 baseline is 3, but the description adds real meaning the schema does not: the `codigo` string runs against a pre-authenticated `api` object, may use top-level await and console.log, and its return value surfaces as `resultado`. The 15 s ceiling also contextualizes `timeout_ms`, though it never explains how per-call timeouts interact with the overall wall clock.

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?

"Corre JavaScript en un sandbox con un objeto `api` ya autenticado" states a specific verb (execute) and a specific mechanism (sandboxed JS over an authenticated API proxy), and immediately clarifies the relationship to the sibling tools: one async function per tool with the same parameters and result as calling them directly. An agent can distinguish code mode from a direct single call 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 Guidelines4/5

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

Explicitly names the use cases that select this tool: batches ("validar 50 CBUs, armar 20 cronogramas") and chaining calls without returning to the model, which is exactly the trade-off versus the single-call siblings. It stops short of stating the inverse rule ("for a single check, use validar_cbu directly"), so the agent must infer when-not, but the intended context is clear.

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