Skip to main content
Glama

validate_invoice_payload

Read-onlyIdempotent

Dry-run issue_invoice: the API runs issuance's pre-authority checks (company blockers; NCM, CEST, IBS/CBS and presumed-credit tables; layout and cross-field rules). Nothing is sent, numbered, stored or charged. Malformed fields come back first, without the API.

It does not replace issuing: the authorizer can still reject what passes (recipient registration, a number already used).

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": {
      "document_type": "<document_type>",
      "items": "<items>"
    },
    "name": "validate_invoice_payload"
  }
}

Input Schema

NameRequiredDescriptionDefault
nfseNoAs in issue_invoice.
itemsYesAs issue_invoice takes them.
changeNoAs in issue_invoice.
exportNoAs in issue_invoice.
numberNoAs in issue_invoice.
seriesNoAs in issue_invoice.
tax_idNoAs in issue_invoice.
purposeNoAs in issue_invoice.
discountNoAs in issue_invoice.
paymentsNoAs in issue_invoice.
presenceNoAs in issue_invoice.
client_idNoAs in issue_invoice.
directionNoAs in issue_invoice.
issued_atNoAs in issue_invoice.
transportNoAs in issue_invoice.
company_idNoUUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both.
foreign_idNoAs in issue_invoice.
client_nameNoAs in issue_invoice.
contingencyNoAs in issue_invoice.
intermediaryNoAs in issue_invoice.
document_typeYesnfse for a service invoice, nfe for goods.
company_tax_idNoCNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both.
referenced_keysNoAs in issue_invoice.
recipient_addressNoAs in issue_invoice.
contingency_reasonNoAs in issue_invoice.
contingency_started_atNoAs in issue_invoice.
foreign_id_missing_reasonNoAs in issue_invoice.
recipient_municipal_registrationNoAs in issue_invoice.

Output Schema

NameRequiredDescriptionDefault
validYesNo rule broken. The authorizer can still reject it.
errorsNo
checkedYeslocal: field checks failed, the API rules did not run. api: the API ran issuance's pre-authority rules.
warningsNo
document_typeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / contingency_reason
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / contingency_started_at
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
  2. Changed3 schema fields changed
    • addedInput schema / properties / foreign_id_missing_reason
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / nfse
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / recipient_municipal_registration
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
  3. Changed7 schema fields changed
    • addedInput schema / properties / change
      Added value: +{
      +  "anyOf": [
      +    {
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • changedInput schema / properties / company_id / description
      Previous value: -"UUID of the company acted for. Omit it if the connection covers a single company; else see list_authorized_companies. company_id or company_tax_id, never both."New value: +"UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both."
    • changedInput schema / properties / company_tax_id / description
      Previous value: -"CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit it if the connection covers a single company; else see list_authorized_companies. company_id or company_tax_id, never both."New value: +"CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both."
    • addedInput schema / properties / intermediary
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / payments
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / presence
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / transport
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
  4. Changed24 schema fields changed
    • addedInput schema / properties / client_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / client_name
      Added value: +{
      +  "default": "",
      +  "description": "As in issue_invoice.",
      +  "type": "string"
      +}
    • addedInput schema / properties / company_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maxLength": 64,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "UUID of the company acted for. Omit it if the connection covers a single company; else see list_authorized_companies. company_id or company_tax_id, never both."
      +}
    • addedInput schema / properties / company_tax_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maxLength": 18,
      +      "minLength": 11,
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit it if the connection covers a single company; else see list_authorized_companies. company_id or company_tax_id, never both."
      +}
    • addedInput schema / properties / contingency
      Added value: +{
      +  "default": false,
      +  "description": "As in issue_invoice.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / direction
      Added value: +{
      +  "anyOf": [
      +    {
      +      "enum": [
      +        "out",
      +        "in"
      +      ],
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / discount
      Added value: +{
      +  "anyOf": [
      +    {
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / export
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / foreign_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / issued_at
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • changedInput schema / properties / items / description
      Previous value: -"The items exactly as they would go to issue_invoice, e.g. [{\"description\": \"Cadeira\", \"amount\": 450, \"ncm\": \"94013000\", \"cfop\": \"5102\"}]."New value: +"As issue_invoice takes them."
    • addedInput schema / properties / number
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / purpose
      Added value: +{
      +  "anyOf": [
      +    {
      +      "enum": [
      +        "normal",
      +        "complementary",
      +        "adjustment",
      +        "return"
      +      ],
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • changedInput schema / properties / recipient_address / description
      Previous value: -"The recipient_address exactly as it would go to issue_invoice. Required for nfe."New value: +"As in issue_invoice."
    • addedInput schema / properties / referenced_keys
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / series
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "As in issue_invoice."
      +}
    • addedInput schema / properties / tax_id
      Added value: +{
      +  "default": "",
      +  "description": "As in issue_invoice.",
      +  "type": "string"
      +}
    • addedOutput schema / $defs / ValidationFinding
      Added value: +{
      +  "description": "One rule the payload broke, or one warning about it.",
      +  "properties": {
      +    "code": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    },
      +    "expected": {
      +      "default": null
      +    },
      +    "field": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "The request path to fix."
      +    },
      +    "fix_url": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    },
      +    "message": {
      +      "type": "string"
      +    },
      +    "received": {
      +      "default": null
      +    },
      +    "sefaz_rejection": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    }
      +  },
      +  "required": [
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / $defs / ValidationProblem
      Removed value: -{
      -  "description": "One field the SDK models refused.",
      -  "properties": {
      -    "field": {
      -      "type": "string"
      -    },
      -    "problem": {
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "field",
      -    "problem"
      -  ],
      -  "type": "object"
      -}
    • changedOutput schema / properties / checked / description
      Previous value: -"What was checked, so the answer is not read as more than it is."New value: +"local: field checks failed, the API rules did not run. api: the API ran issuance's pre-authority rules."
    • addedOutput schema / properties / checked / enum
      Added value: +[
      +  "local",
      +  "api"
      +]
    • changedOutput schema / properties / errors / items / $ref
      Previous value: -"#/$defs/ValidationProblem"New value: +"#/$defs/ValidationFinding"
    • changedOutput schema / properties / valid / description
      Previous value: -"True when no field rule was broken. It does not promise the authorizer will accept the document."New value: +"No rule broken. The authorizer can still reject it."
    • addedOutput schema / properties / warnings
      Added value: +{
      +  "items": {
      +    "$ref": "#/$defs/ValidationFinding"
      +  },
      +  "type": "array"
      +}
  5. Changed15 schema fields changed
    • addedInput schema / properties / document_type / description
      Added value: +"nfse for a service invoice, nfe for goods."
    • removedInput schema / properties / document_type / title
      Removed value: -"Document Type"
    • addedInput schema / properties / items / description
      Added value: +"The items exactly as they would go to issue_invoice, e.g. [{\"description\": \"Cadeira\", \"amount\": 450, \"ncm\": \"94013000\", \"cfop\": \"5102\"}]."
    • removedInput schema / properties / items / title
      Removed value: -"Items"
    • addedInput schema / properties / recipient_address / description
      Added value: +"The recipient_address exactly as it would go to issue_invoice. Required for nfe."
    • removedInput schema / properties / recipient_address / title
      Removed value: -"Recipient Address"
    • removedInput schema / title
      Removed value: -"validate_invoice_payloadArguments"
    • removedOutput schema / $defs / ValidationProblem / properties / field / title
      Removed value: -"Field"
    • removedOutput schema / $defs / ValidationProblem / properties / problem / title
      Removed value: -"Problem"
    • removedOutput schema / $defs / ValidationProblem / title
      Removed value: -"ValidationProblem"
    • removedOutput schema / properties / checked / title
      Removed value: -"Checked"
    • removedOutput schema / properties / document_type / title
      Removed value: -"Document Type"
    • removedOutput schema / properties / errors / title
      Removed value: -"Errors"
    • removedOutput schema / properties / valid / title
      Removed value: -"Valid"
    • removedOutput schema / title
      Removed value: -"ValidationReport"
  6. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, yet the description goes further and enumerates exactly which pre-authority checks run (company blockers, NCM/CEST/IBS-CBS tables, layout and cross-field rules) and states that nothing is sent, numbered, stored or charged. It also discloses the residual failure mode after a passing validation, which no annotation or schema conveys.

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?

Two short, front-loaded paragraphs: the first says what it is and does, the second bounds what it cannot do. No filler, and the most decision-relevant clause (nothing sent, numbered, stored or charged) appears early.

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

Completeness4/5

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

For a 28-parameter tool the burden is carried by the complete schema, an output schema and rich annotations, and the description correctly focuses on behavior rather than repeating fields. A minor gap is that it does not say whether validation returns all problems or only the first batch, which affects how the agent should react to the result.

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?

Schema description coverage is 100% and most parameters simply defer with 'As in issue_invoice', so the schema carries the semantics. The description adds no field-level detail beyond what the schema provides; the useful context here is behavioral rather than per-parameter, so baseline 3 applies.

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?

Names a specific operation (dry-run of issuance validation) and a specific resource (the invoice payload), and explicitly anchors it to the sibling issue_invoice rather than leaving the agent to guess. An agent can immediately tell this apart from issue_invoice or consult_invoice.

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?

Establishes the context of use (validate before/alongside issuing) and an explicit exclusion: it does not replace issuing because the authorizer can still reject what passes, with two concrete examples of residual rejections. What is missing is a direct instruction such as 'call this before issue_invoice', so the routing is strongly implied rather than stated.

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.