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.indiceValor({"indice":"uva"}) → 0 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"}) → 0 crédito(s): Convertir pesos a UVA o UVA a pesos api.dolarHistorico({"casa":"blue","fecha":"2024-01-15"}) → 0 crédito(s): Cotización histórica del dólar api.diasHabiles({"desde":"2026-12-20","sumar_dias_habiles":10}) → 0 crédito(s): Días hábiles y vencimientos api.plazoFijo({"monto":1000000,"dias":30,"banco":"Nación"}) → 1 crédito(s): Plazo fijo: tasas por banco e intereses api.interesesJudiciales({"capital":5000000,"desde":"2025-01-15","hasta":"2026-11-15","jurisdiccion":"buenos_aires"}) → 2 crédito(s): Intereses judiciales y moratorios (Ley 27.802, TIM) con el criterio de cada jurisdicción api.calendarioFiscal({"terminacion_cuit":7,"desde":"2026-12-01","hasta":"2026-12-31"}) → 1 crédito(s): Calendario fiscal y de plazos: vencimientos de ARCA, feriados provinciales y ferias judiciales 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.6/5.0
Behavior5/5

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

Goes well beyond the annotations: sandbox limits (no network, files, or modules), hard caps of 100 internal calls and 15 s, the cost model of 1 credit plus the sum of internal calls, and the convention that the returned value arrives in `resultado`. It also documents that await, console.log, and return are available. The only tension is that readOnlyHint=true while executions consume credits, but the description discloses that cost rather than contradicting the hint.

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?

The core explanation is front-loaded and every constraint sentence earns its place. The function catalog is bulky but functional for code mode, though the trailing 'Costo: 1 crédito(s).' duplicates the cost already stated earlier in the description.

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?

There is no output schema, and the description compensates by explaining that the returned value comes back in `resultado`. Combined with the sandbox limits, cost model, and the callable function list, an agent has everything needed to write and invoke code correctly.

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: `codigo` is JavaScript that can await the `api` functions and must return a value, and the return convention is spelled out. The per-function catalog with example payloads further clarifies what the code can call, though `timeout_ms` is only covered by the schema.

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 resource: run JavaScript in a sandbox with a pre-authenticated `api` object, one async function per tool. It explicitly distinguishes itself from the sibling tools by noting the result is identical to calling them directly, so an agent knows this is the code-mode meta-tool rather than a domain operation.

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 when-to-use guidance: batches (validating 50 CBUs, building 20 schedules) or chaining calls without returning to the model. The alternative (calling the tool directly) is implied by 'mismo resultado que llamarla directo' but never stated as an explicit exclusion for single calls.

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