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.indiceValor({"indice":"uva"}) → 1 crédito(s): Valor de un índice (UVA, CER, ICL, inflación) api.ajustarMonto({"monto":100000,"indice":"ipc","desde":"2024-01-15","hasta":"2025-01-15"}) → 2 crédito(s): Ajustar un monto por índice api.actualizarAlquiler({"monto_inicial":500000,"fecha_inicio":"2025-01-01","indice":"icl","periodicidad_meses":3}) → 3 crédito(s): Actualizar un alquiler por ICL, IPC o UVA api.convertirUva({"monto":1000000,"direccion":"pesos_a_uva"}) → 1 crédito(s): Convertir pesos a UVA o UVA a pesos api.dolarHistorico({"casa":"blue","fecha":"2024-01-15"}) → 1 crédito(s): Cotización histórica del dólar api.diasHabiles({"desde":"2026-12-20","sumar_dias_habiles":10}) → 1 crédito(s): Días hábiles y vencimientos 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.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does most of it: sandbox boundaries (no network, files or modules), cost model (1 credit per run plus the sum of internal calls), and hard limits (100 calls, 15 s). Gaps remain on failure behavior – what happens when the code throws or a call inside the batch bills partially – which matters for a metered execution tool.

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 purpose, then usage, then the code contract, then cost/limits, then the function catalog – a sensible order. The appended function list with costs earns its length by letting the agent write correct calls without opening other schemas, but the stray trailing "Costo: 1 crédito(s)." on the días hábiles entry reads as leftover cruft.

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 metered code-execution tool with no annotations and no output schema, everything an agent needs is present: entry point, available API surface with signatures and prices, return channel, cost, and hard limits. Return values are explained in prose since no output schema exists.

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 meaning about the `codigo` contract: await is supported, console.log is available, and the returned value surfaces in `resultado`. The 15 s ceiling is restated consistently with timeout_ms, though the relationship between the per-run timeout and the schema default is left implicit.

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?

Names a specific verb and resource ("Corre JavaScript en un sandbox con un objeto `api` ya autenticado") and immediately distinguishes the mecanism from siblings: one async function per tool with the same parameters and results as calling them directly. An agent can tell this is the batch/chaining path rather than a single-purpose tool like ajustar_monto.

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?

Gives concrete when-to-use conditions with examples ("validar 50 CBUs, armar 20 cronogramas") and the alternative it replaces ("encadenar llamadas sin volver al modelo"). It also implies the counterfactual of calling the sibling tools directly, so the routing decision is explicit.

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