Skip to main content
Glama

Definir una métrica

define_metric

Crea o cambia la ficha de una métrica para que salga siempre igual: qué cuenta y qué no, tipo, formato, perspectiva, ventana, fuente, SQL y filtros. Rellena solo lo que él haya dicho; lo que falte, pregúntaselo o déjalo vacío. Cambiar la ficha sube su versión. El objetivo no va aquí: es una apuesta.

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": {
      "project": "<project>",
      "name": "<name>"
    },
    "name": "define_metric"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNo
nameYes
unitNo
queryNoLa consulta SQL canónica, tal cual.
formatNo
sourceNoDe dónde sale. Nunca inventes un id.
windowNoDiaria, mensual, últimos 28 días…
filtersNoFiltros obligatorios.
gotchasNoTrampas de los datos.
projectYesEl proyecto (p1, p2…), de list_projects.
excludesNoQué no cuenta.
canon_refNoSi ya tiene ficha en el company brain de su empresa: cuál. Entonces no copies la ficha.
numeratorNo
definitionNoQué cuenta exactamente.
denominatorNoObligatorio en ratio y tasa.
perspectiveNoPor cuenta, por usuario; cohorte o foto.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare a non-read-only, non-idempotent, non-destructive write, and the description adds a genuinely useful trait beyond them: changing the card bumps its version. However, for a mutation on an existing metric it never clarifies whether omitted fields are wiped, preserved, or merged — the one behavior an agent most needs to know before an update.

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?

Three front-loaded sentences, starting with the action and scope before the workflow rules; the field enumeration in the first sentence is dense but earns its place by mapping the concept. Minor redundancy between "qué cuenta y qué no" and the later schema-level glosses, but no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 16-parameter mutation with no output schema, the description covers create/update semantics, partial-fill policy, version bumping, and one exclusion. It stops short of explaining update merge semantics, what the caller gets back, or how canon_ref interacts with the other fields (only the schema hints at the "don't copy the card then" rule).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 16 parameters at 69% schema coverage, the baseline is a 3, and the description largely restates glosses the schema already carries (definition = "qué cuenta exactamente", excludes = "qué no cuenta"). It does implicitly tie denominator to the tipo values ratio/tasa, but leaves the two required params (project, name) and canon_ref, unit, gotchas, and numerator without added meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb pair ("Crea o cambia") and a concrete resource ("la ficha de una métrica"), then enumerates the facets the card captures (qué cuenta, tipo, formato, perspectiva, ventana, fuente, SQL, filtros). It is unambiguously an upsert-for-metric-definitions tool, though it never names a sibling to distinguish itself from save_format or save_context.

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?

It gives real operating guidance: fill only what the user actually said, ask or leave blank otherwise, and explicitly excludes the objective ("El objetivo no va aquí: es una apuesta"), routing that content elsewhere. It states the create-or-update condition clearly, but never names the alternative tool for the excluded objective or a precondition such as needing a project from list_projects.

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.