Skip to main content
Glama

Explain a compliance error

explain_compliance_error
Read-onlyIdempotent

Explain Apier compliance error codes with a Norwegian-bokmål summary, why, ordered fix steps, legal basis, and optional handover for human-resolved errors. Turn error codes into actionable guidance.

Instructions

Resolve a structured Apier compliance error code into a Norwegian-bokmål Explanation envelope: summary, bokmål why, ordered fix_steps, optional documentation link + legal_basis, and an optional handover block (who / where / what / why) for errors a human must resolve (e.g. AUTH_INSUFFICIENT_ROLE, AUTH_NO_DELEGATION, SCOPE_MISSING) — agent-resolvable errors ship handover: null. Accepts any code from the closed EXPLAINER_ERROR_CODES catalogue — pass whatever code an Apier endpoint returned in an error envelope. Optional flat context_org_number / context_scope / context_role / context_field / context_upstream_system strings carry placeholder values interpolated into the bokmål text; missing values fall back to 'ukjent '. Failure modes: VALIDATION_FAILED on an unknown code; SCOPE_INSUFFICIENT (needs read:rulebook). For a company's live obligations rather than an error explanation, use get_company_obligations instead. No API key? Bearer apier_sandbox_test_ (fresh suffix) serves synthetic fixtures; org numbers: GET /api/v1/sandbox/fixtures. Docs: https://www.apier.no/docs/guides/error-handling

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
error_codeYesAn Apier error code from an error envelope. Full list: apier://tools/explain_compliance_error/guide
context_roleNoRole code interpolated into the explanation.
context_fieldNoField name interpolated into the explanation.
context_scopeNoScope token interpolated into the bokmål explanation.
context_org_numberNoOrganisation the error relates to (9 digits).
context_upstream_systemNoUpstream system name interpolated into the explanation.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
_metaNo
resultYesThe Explainer envelope: summary, bokmål why, ordered fix_steps, optional documentation link + legal_basis, and an optional human handover block.
metadataYes
justificationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, and the description adds valuable behavioral detail beyond those: failure modes (VALIDATION_FAILED for unknown codes, SCOPE_INSUFFICIENT for missing read:rulebook), the handover block semantics for human-resolvable errors, and fallback behavior to 'ukjent <noun>' for missing context values. No contradiction with 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?

The description is dense and long, but every sentence earns its place: purpose, output envelope, failure modes, alternative tool, sandbox auth, and docs link. It is appropriately sized for a tool with six parameters and an output schema, though the single-paragraph format makes it slightly harder to scan than a more structured layout would.

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?

For a tool with six parameters, an output schema, and annotations, the description is complete: it covers input semantics, interpolation behavior, failure modes, permission requirements, sandbox testing, and the sibling alternative. Nothing an agent needs to call it correctly 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 description coverage is 100%, so the baseline is 3. The description adds meaning beyond the schema by explaining that the optional context_* parameters carry placeholder values interpolated into the bokmål text and that missing values fall back to 'ukjent <noun>'. It also clarifies that error_code comes from a closed catalogue and links to the full list.

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 opens with a specific verb and resource: 'Resolve a structured Apier compliance error code into a Norwegian-bokmål Explanation envelope'. It clearly lists the envelope contents and explicitly distinguishes itself from get_company_obligations, so an agent can tell this tool apart from siblings without opening schemas.

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?

The description says exactly when to use this tool ('pass whatever code an Apier endpoint returned in an error envelope') and when not to: 'For a company's live obligations rather than an error explanation, use get_company_obligations instead.' It also gives sandbox testing guidance for the no-API-key case, which is a clear usage context.

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