Skip to main content
Glama

Classificar CID-10 como CSAP

classify_as_csap
Read-onlyIdempotent

Classify ICD-10 codes to determine if they are primary care-sensitive conditions (CSAP) and retrieve the corresponding CSAP group. Handles both OMS and SIH notations.

Instructions

Classifica um ou mais códigos CID-10 como CSAP ou não. Retorna o grupo CSAP correspondente se aplicável. Aceita as duas notações do mesmo código — J18.1 (OMS) e J181 (SIH) — com a mesma resposta. Código que NÃO é CID-10 não é classificado: volta com is_csap: null e error próprio, nunca false (que afirmaria que a condição existe e não é sensível). Só CID-10: os códigos CID-9 de 6 dígitos do SIH de 1992–1997 são classificados no build pela lista derivada (src/data/csap-groups-cid9.json), não por esta ferramenta.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cid_codesYesCódigos CID-10 para classificar (ex: ['J18', 'A09', 'K35'])

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoSó quando houver código não classificado: quantos foram e para onde olhar
summaryNo
provenanceYesBloco de proveniência (contrato v1.0): fonte, URL, competência, extração e licença
attributionYesURLs canônicas das fontes desta resposta (lista de atribuição)
classificationsNoUma entrada por código, na ordem informada

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.17.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": false,
      +  "anyOf": [
      +    {
      +      "required": [
      +        "classifications",
      +        "summary"
      +      ]
      +    }
      +  ],
      +  "description": "Cada código CID-10 informado classificado como sensível (com o grupo) ou não; `is_csap` é null no código que não é CID-10, que não recebe classificação",
      +  "properties": {
      +    "attribution": {
      +      "description": "URLs canônicas das fontes desta resposta (lista de atribuição)",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "classifications": {
      +      "description": "Uma entrada por código, na ordem informada",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "cid": {
      +            "description": "Código como foi informado",
      +            "type": "string"
      +          },
      +          "csap_group": {
      +            "description": "Grupo CSAP g01–g19; null quando não é sensível ou não foi classificado",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "csap_name": {
      +            "description": "Nome do grupo; null quando não é sensível ou não foi classificado",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "error": {
      +            "description": "Só nas entradas não classificadas: por que o código não é CID-10",
      +            "type": "string"
      +          },
      +          "is_csap": {
      +            "description": "true quando o código cai em algum grupo CSAP; false quando é CID-10 e não cai; null quando não é um código CID-10 (não classificado — veja `error` da entrada)",
      +            "type": [
      +              "boolean",
      +              "null"
      +            ]
      +          }
      +        },
      +        "required": [
      +          "cid",
      +          "is_csap",
      +          "csap_group",
      +          "csap_name"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "error": {
      +      "description": "Só quando houver código não classificado: quantos foram e para onde olhar",
      +      "type": "string"
      +    },
      +    "provenance": {
      +      "additionalProperties": false,
      +      "description": "Bloco de proveniência (contrato v1.0): fonte, URL, competência, extração e licença",
      +      "properties": {
      +        "citation": {
      +          "description": "Citação pronta para uso",
      +          "type": "string"
      +        },
      +        "data_vintage": {
      +          "description": "Competência ou safra do dado segundo a fonte; null quando a fonte não expõe",
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "license": {
      +          "description": "Regime legal do dado (id SPDX quando há)",
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "retrieved_at": {
      +          "description": "Instante REAL da extração na origem (ISO-8601)",
      +          "type": "string"
      +        },
      +        "source": {
      +          "description": "Fonte oficial do dado",
      +          "type": "string"
      +        },
      +        "source_url": {
      +          "description": "URL canônica que reproduz a consulta ou localiza a fonte",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "source",
      +        "source_url",
      +        "data_vintage",
      +        "retrieved_at",
      +        "citation",
      +        "license"
      +      ],
      +      "type": "object"
      +    },
      +    "summary": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "csap": {
      +          "description": "Quantos são sensíveis",
      +          "type": "number"
      +        },
      +        "non_csap": {
      +          "description": "Quantos são CID-10 e não são sensíveis (não inclui os não classificados)",
      +          "type": "number"
      +        },
      +        "not_classified": {
      +          "description": "Só quando houver: quantos não são CID-10",
      +          "type": "number"
      +        },
      +        "total": {
      +          "description": "Códigos informados",
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "total",
      +        "csap",
      +        "non_csap"
      +      ],
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "provenance",
      +    "attribution"
      +  ],
      +  "type": "object"
      +}
  2. Changed1 schema field changedv0.15.4
    • addedInput schema / additionalProperties
      Added value: +false
  3. First observedv0.12.1

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already establish readOnly/idempotent behavior, and the description adds valuable semantics beyond them: it discloses that non-ICD-10 input returns is_csap:null with a proper error rather than false, and that notation variants like J18.1 and J181 produce the same result. This prevents serious misinterpretation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences, front-loaded with the core classification behavior, followed by notation handling, invalid-input semantics, and scope exclusion. Every sentence carries useful information and there is no filler.

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 tool has an output schema, so return shape is already covered. The description compensates for the remaining usage risks: invalid inputs, notation equivalence, and ICD-9 exclusion. Nothing needed for correct invocation appears to be 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?

The input schema already documents cid_codes fully with examples, so the baseline is 3. The description adds actionable extra meaning by explaining that both OMS and SIH notations are accepted, which is not evident from the schema example alone.

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?

The description states a specific verb ('Classifica') and resource ('códigos CID-10'), and clarifies the result: 'Retorna o grupo CSAP correspondente se aplicável'. This clearly distinguishes it from sibling listing/getting tools like list_csap_groups or get_icsap.

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?

The description gives explicit exclusions: non-ICD-10 codes are not classified, and 6-digit ICD-9 SIH 1992–1997 codes are handled elsewhere ('não por esta ferramenta'). However, it does not name a specific sibling tool as the alternative, so the guidance is clear but not fully complete.

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