Docs
MCP serverAvailable tools

Get document file

Retrieve one available document file as an MCP binary resource.

MCP toolget_document_file

Purpose

Use when
You have a public documentRef and need an available file, including a preview_pdf for an unstamped CFDI draft.
Do not use when
You need document metadata or a file for an unsupported document family.
Required permissions
invoices:read / receipts:read / sat:read
Side effects
None
Idempotency
Idempotent

Input schema

JSON Schema
{  "type": "object",  "$schema": "http://json-schema.org/draft-07/schema#",  "anyOf": [    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^invoice:.+$",          "description": "CFDI documentRef returned by search_documents"        },        "file": {          "enum": [            "pdf",            "xml",            "zip",            "preview_pdf",            "cancellation_xml",            "cancellation_pdf"          ]        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^withholding:.+$",          "description": "Withholding documentRef returned by search_documents"        },        "file": {          "enum": [            "pdf",            "xml",            "zip"          ]        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^sales_receipt:.+$"        },        "file": {          "const": "pdf"        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^declaration:.+$"        },        "file": {          "enum": [            "pdf",            "payment_pdf",            "full_pdf"          ]        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    },    {      "type": "object",      "properties": {        "documentRef": {          "type": "string",          "pattern": "^tax_compliance_opinion:.+$"        },        "file": {          "const": "pdf"        }      },      "required": [        "documentRef",        "file"      ],      "additionalProperties": false    }  ]}

Related workflow

See the canonical workflows in Quickstart

Related tools