Skip to main content
Glama

get_invoice_pdf

Read-onlyIdempotent

Return the printable rendering of a document, as a PDF.

Works for both types — a DANFE for nfe, a DANFSe for nfse. The PDF comes back base64-encoded in content_base64, with its size in size_bytes; the XML, not this, is the legally valid document. A PDF above 2 MB is not inlined: the answer says to download it from the API instead. A 502 from here means the authorizer is unavailable, not that the invoice is wrong.

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": {
      "access_key": "<access_key>",
      "document_type": "<document_type>"
    },
    "name": "get_invoice_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
access_keyYesThe access key (chave de acesso) the authorizer assigned, as issue_invoice and list_invoices return it. An NF-e key has 44 characters; the issuer's CNPJ inside it may carry letters since July 2026, so copy it exactly.
company_idNoUUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both.
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.

Output Schema

NameRequiredDescriptionDefault
access_keyYes
size_bytesNoSize of the decoded PDF, in bytes.
content_typeNoapplication/pdf
content_base64YesThe PDF bytes, base64-encoded. Decode before saving.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • 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."
  2. Changed2 schema fields changed
    • changedInput schema / properties / company_id / description
      Previous value: -"UUID of the company this call acts for. Omit it when the connection covers a single company; with several it is required (see list_authorized_companies). Send company_id or company_tax_id, never both."New 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."
    • changedInput schema / properties / company_tax_id / description
      Previous value: -"CNPJ or CPF of the company this call acts for, never the recipient or a taxpayer being looked up. Omit it when the connection covers a single company; with several it is required (see list_authorized_companies). Send 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 it if the connection covers a single company; else see list_authorized_companies. company_id or company_tax_id, never both."
  3. Changed1 schema field changed
    • changedInput schema / properties / access_key / description
      Previous value: -"The access key (chave de acesso) the authorizer assigned, digits only, as issue_invoice and list_invoices return it. An NF-e key has 44 digits."New value: +"The access key (chave de acesso) the authorizer assigned, as issue_invoice and list_invoices return it. An NF-e key has 44 characters; the issuer's CNPJ inside it may carry letters since July 2026, so copy it exactly."
  4. Changed14 schema fields changed
    • addedInput schema / properties / access_key / description
      Added value: +"The access key (chave de acesso) the authorizer assigned, digits only, as issue_invoice and list_invoices return it. An NF-e key has 44 digits."
    • removedInput schema / properties / access_key / title
      Removed value: -"Access Key"
    • changedInput schema / properties / company_id / description
      Previous value: -"UUID of the company this call acts for, as list_authorized_companies shows it. Omit it when the connection covers a single company: that company is used. Required when the connection covers several — call list_authorized_companies to see them, with their ids and what each one allows. Give company_id or company_tax_id, never both."New value: +"UUID of the company this call acts for. Omit it when the connection covers a single company; with several it is required (see list_authorized_companies). Send company_id or company_tax_id, never both."
    • removedInput schema / properties / company_id / title
      Removed value: -"Company Id"
    • changedInput schema / properties / company_tax_id / description
      Previous value: -"CNPJ or CPF of the company this call acts for — the company using Stackin, never the recipient or a taxpayer being looked up. Punctuation is ignored. Omit it when the connection covers a single company: that company is used. Required when the connection covers several — call list_authorized_companies to see them, with their ids and what each one allows. Give company_id or company_tax_id, never both."New value: +"CNPJ or CPF of the company this call acts for, never the recipient or a taxpayer being looked up. Omit it when the connection covers a single company; with several it is required (see list_authorized_companies). Send company_id or company_tax_id, never both."
    • removedInput schema / properties / company_tax_id / title
      Removed value: -"Company Tax Id"
    • 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"
    • removedInput schema / title
      Removed value: -"get_invoice_pdfArguments"
    • removedOutput schema / properties / access_key / title
      Removed value: -"Access Key"
    • removedOutput schema / properties / content_base64 / title
      Removed value: -"Content Base64"
    • removedOutput schema / properties / content_type / title
      Removed value: -"Content Type"
    • removedOutput schema / properties / size_bytes / title
      Removed value: -"Size Bytes"
    • removedOutput schema / title
      Removed value: -"InvoicePdf"
  5. Changed2 schema fields changed
    • addedInput schema / properties / company_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maxLength": 64,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "UUID of the company this call acts for, as list_authorized_companies shows it. Omit it when the connection covers a single company: that company is used. Required when the connection covers several — call list_authorized_companies to see them, with their ids and what each one allows. Give company_id or company_tax_id, never both.",
      +  "title": "Company Id"
      +}
    • 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 this call acts for — the company using Stackin, never the recipient or a taxpayer being looked up. Punctuation is ignored. Omit it when the connection covers a single company: that company is used. Required when the connection covers several — call list_authorized_companies to see them, with their ids and what each one allows. Give company_id or company_tax_id, never both.",
      +  "title": "Company Tax Id"
      +}
  6. Changed1 schema field changed
    • addedOutput schema / properties / size_bytes
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Size of the decoded PDF, in bytes.",
      +  "title": "Size Bytes"
      +}
  7. First observed

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive and closed-world, so the safety profile is covered. The description still adds real value: base64 payload in content_base64, size in size_bytes, the 2 MB inlining cutoff with a fallback instruction, and the meaning of a 502 (authorizer down, not a bad invoice). Those are genuine behavioral disclosures beyond the annotations, though return-shape detail is partly duplicated by the output schema.

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?

Front-loads the purpose in the first sentence, then layers output format, size handling and error semantics in short, information-dense clauses. No filler or restatement of the tool name.

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?

An output schema exists, yet the description still covers return format, size cap behavior and error interpretation, which is what an agent needs to avoid misreading a 502 or a missing inline PDF. Nothing material is missing for a read-only PDF fetch.

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%, so access_key, company_id, company_tax_id and document_type are already documented in the schema. The description only indirectly illuminates document_type by mapping each value to its rendering (DANFE vs DANFSe), which is marginal added meaning. 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?

States a specific verb+resource ("Return the printable rendering of a document, as a PDF") and immediately clarifies the two output flavors (DANFE for nfe, DANFSe for nfse). The clause "the XML, not this, is the legally valid document" implicitly separates it from XML-fetching siblings.

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?

Gives clear context for when this is the right artifact (printable rendering) and a strong when-not signal: the PDF is not the legally valid document, so an agent chasing legal validity should prefer XML. It does not explicitly name a sibling alternative or state preconditions, so it falls short of a 5.

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.