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.validarCuit({"cuit":"30-50001091-2"}) → 0 crédito(s): Validar CUIT/CUIL api.validarCbu({"cbu":"0070999000004012345672"}) → 0 crédito(s): Validar CBU/CVU api.normalizarTelefonoAr({"telefono":"011 15 2345-6789"}) → 0 crédito(s): Normalizar teléfono argentino api.cotizacionDolar({"casa":"blue"}) → 0 crédito(s): Cotización del dólar en Argentina api.sueldoNeto({"bruto":1500000}) → 0 crédito(s): Sueldo en mano (bruto a neto y al revés) api.escalaComercio({"categoria":"Administrativo B","antiguedad_anios":3}) → 1 crédito(s): Sueldo de Comercio por categoría (CCT 130/75) api.calcularAguinaldo({"mejor_sueldo":1500000,"anio":2026,"semestre":2}) → 0 crédito(s): Calcular el aguinaldo (SAC) api.calcularVacaciones({"fecha_ingreso":"2019-03-01","anio":2026,"sueldo_mensual":1500000}) → 0 crédito(s): Calcular los días y el pago de vacaciones api.liquidacionFinal({"fecha_ingreso":"2021-03-01","fecha_egreso":"2026-11-20","motivo":"despido_sin_causa","mejor_remuneracion":1500000,"convenio":"comercio","provincia":"Córdoba"}) → 2 crédito(s): Liquidación final e indemnización por despido api.categoriaMonotributo({"ingresos_anuales":20000000,"actividad":"servicios"}) → 0 crédito(s): Categoría y cuota del monotributo 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?

Annotations only declare read-only, idempotent, closed-world and non-destructive; the description adds substantially more: sandbox isolation, `await`/`console.log`/`return` semantics, the return value surfacing in `resultado`, the cost model (1 credit per run plus internal calls), and hard limits of 100 calls and 15 s. It also states no network, filesystem or module access, which is exactly the kind of constraint an agent cannot infer from annotations.

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 mechanic and the batch/chaining rationale before the limits and cost, which is the right order. The function catalog is long but earns its place since it defines the `api` surface; the stray trailing "Costo: 1 crédito(s)." appended after the last function listing duplicates the cost sentence and reads as a formatting artifact.

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?

With no output schema, the description still explains where the result lands (`resultado`), what the code may do, per-function credit costs, and the execution ceiling. Nothing an agent needs to write and run a correct snippet is missing.

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 both parameters are already documented, and the description adds the non-obvious contract that the returned value comes back in `resultado` and that `await` is usable inside `codigo`. `timeout_ms` is left to the schema, which is acceptable given its own description and the separate 15 s cap mentioned in the text.

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 exposing one async function per tool. It distinguishes itself from the siblings (validar_cbu, calcular_aguinaldo, etc.) by explaining that the same parameters and results apply, so an agent knows this is a programmatic alternative to calling them one by one.

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: batches ("validar 50 CBUs, armar 20 cronogramas") or chaining calls without returning to the model. The implicit counterpart — a single call should go to the dedicated tool — is inferable but never stated as an explicit exclusion, so it stops short of a full when/when-not rule.

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