Skip to main content
Glama
comparador-luz-gas

comparador-luz-gas

leer_factura_qr

Read-onlyIdempotent

Extract electricity bill data from a decoded QR code URL, returning postal code, contracted power, consumption, and amount for viewing or offer comparisons.

Instructions

Interpreta el texto ya decodificado del QR de una factura de luz y devuelve sus datos. qr es la URL de comparador.cnmc.gob.es impresa en la factura; de su query se leen cp (código postal, obligatorio), pP1/pP2 (potencias, kW), caP1-caP3 (consumo anual punta/llano/valle, kWh), cfP1-cfP3 (consumo del periodo facturado) e imp (importe, euros); un campo numérico ausente o ilegible vale 0. Úsala para ver los datos; para comparar, pasa el QR a comparar_ofertas; con el archivo, leer_factura_archivo. Local e instantánea: sin red ni disco. Si falla, devuelve un error con texto JSON {"ok": false, "error": "ArgumentoInvalido", "message": "..."}: SinQR si no es un QR del comparador o falta cp (p. ej. QR de gas o de pago).

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": {
      "qr": "<qr>"
    },
    "name": "leer_factura_qr"
  }
}

Input Schema

NameRequiredDescriptionDefault
qrYescontenido del QR de la factura de luz, ya decodificado: la URL de comparador.cnmc.gob.es que lleva impresa, p. ej. `https://comparador.cnmc.gob.es/comparador/QRE?cp=28013&pP1=4.6&caP1=740...`

Output Schema

NameRequiredDescriptionDefault
importeNo
potencia_p1No
potencia_p2No
codigo_postalYes
consumo_anualYes
consumo_facturaNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.4
    • changedInput schema / properties / qr / description
      Previous value: -"contenido del QR de la factura de luz, ya decodificado (la URL de comparador.cnmc.gob.es que lleva impresa)"New value: +"contenido del QR de la factura de luz, ya decodificado: la URL de comparador.cnmc.gob.es que lleva impresa, p. ej. `https://comparador.cnmc.gob.es/comparador/QRE?cp=28013&pP1=4.6&caP1=740...`"
  2. Changed1 schema field changedv0.2.3
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "codigo_postal": {
      +      "type": "string"
      +    },
      +    "consumo_anual": {
      +      "items": {
      +        "type": "number"
      +      },
      +      "type": "array"
      +    },
      +    "consumo_factura": {
      +      "items": {
      +        "type": "number"
      +      },
      +      "type": "array"
      +    },
      +    "importe": {
      +      "type": "number"
      +    },
      +    "potencia_p1": {
      +      "type": "number"
      +    },
      +    "potencia_p2": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "codigo_postal",
      +    "consumo_anual"
      +  ],
      +  "type": "object"
      +}
  3. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive/closed-world, so safety is covered. The description adds genuine behavioral context beyond them: execution is local and instantaneous with no network or disk, and failures return an in-band JSON envelope with concrete codes (ArgumentoInvalido, SinQR) including the case of gas/payment QRs lacking cp. It does not describe the shape of the success payload, but an output schema exists.

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 purpose, then parameter semantics, alternatives, and error behavior in a tight sequence with zero filler. The single long paragraph with run-on clauses is dense in places, which slightly hurts scannability, but every sentence carries information.

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?

The output schema carries return values, so the description need not explain them. It covers the input contract, the required cp prerequisite, the sibling routing, and the exact error envelope and codes an agent must handle — complete for a single-parameter, offline parser.

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% and the schema example already shows the query string, so baseline is 3. The description adds real meaning beyond it: the field-by-field mapping of the CNMC query (cp obligatorio, pP1/pP2 in kW, caP1-caP3 annual kWh, cfP1-cfP3 billed-period consumption, imp in euros) and the rule that an absent or unreadable numeric field is treated as 0.

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 (interpreta) and resource (texto ya decodificado del QR de una factura de luz) plus the returned outcome, and explicitly names both siblings (comparar_ofertas for comparison, leer_factura_archivo for files). An agent can route correctly 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 Guidelines5/5

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

Gives explicit when-to-use ('Úsala para ver los datos') and names the alternative plus the selecting condition for each sibling: pass the QR to comparar_ofertas to compare, use leer_factura_archivo when you have the file. Nothing is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.