Skip to main content
Glama
beel-es

BeeL MCP server

Official
by beel-es

beel_issue_invoice

DestructiveIdempotent

Finalize a draft invoice into a legally issued one: assign its definitive number, make it immutable, and trigger submission to AEAT. Returns acceptance; PDF arrives asynchronously.

Instructions

Finalizes a draft invoice of this company: assigns its definitive number from the configured series and makes it immutable.

  • Irreversible: an issued invoice is corrected with a corrective invoice (POST …/{invoice_id}/corrective) or voided (POST …/{invoice_id}/void), never edited.

  • Asynchronous: PDF generation and submission to the AEAT happen after the response, so a 200 means the invoice was accepted for submission, not that the AEAT has registered it. Use wait_for_pdf to wait for the PDF.

Endpoint: POST /v1/companies/{company_id}/invoices/{invoice_id}/issue

⚠️ Fiscal guardrails — read before calling:

  • When an invoice can still be changed, and what to do once it cannot. (resource: beel://guardrails/invoice-state-machine)

  • Why an issued invoice may never reach AEAT, and how to tell before issuing. (resource: beel://guardrails/verifactu-gates)

For the exhaustive rules and worked examples, call beel_docs_search.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
company_idYesUnique identifier (UUID) of the company the operation acts on — its identifier, not its NIF. It is the only source of context: the account that owns it is derived from it, and the `BeeL-Active-Company` header plays no part. A company you do not reach answers `403`, and so does a company that does not exist, so the existence of a company in another account is never disclosed.
invoice_idYesInvoice ID
wait_for_pdfNoIf `true`, waits for PDF generation and returns the URL in the response. Adds ~1-2s of latency but guarantees the PDF is immediately available.
idempotency_keyNoOptional idempotency key for this operation. Omit it and one is derived from the request itself, which makes a blind retry safe but also collapses a SECOND, deliberately identical operation into the first for 24 hours. Set it — to an order id, or anything unique per intended operation — whenever you mean to create something that may look identical to what you just created.
attach_source_invoicesNoOnly applies when the invoice has automatic email sending enabled. If `true`, the email sent after issuing also attaches a ZIP (`suplidos_<invoice-number>.zip`) with the PDFs of the source invoices referenced by the invoice's SUPLIDO consolidation lines. Access to sources owned by managed accounts is re-checked with the same rules as issuing, and the request fails synchronously with an actionable error — never a partial ZIP — if the invoice has no consolidation sources (`ATTACH_SOURCE_INVOICES_NO_SOURCES`), a source is not reachable (`ATTACH_SOURCE_INVOICE_UNAVAILABLE`) or a source has no generated PDF (`ATTACH_SOURCE_PDF_MISSING`).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.5.0
    • removedInput schema / $defs / UUID / example
      Removed value: -"550e8400-e29b-41d4-a716-446655440000"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / company_id / description
      Previous value: -"NIF (company) the operation acts on. It is the only source of context: the account that owns it is derived from it, and the `BeeL-Active-Company` header plays no part. A NIF you do not reach answers `403`, and so does a NIF that does not exist, so the existence of a NIF in another account is never disclosed."New value: +"Unique identifier (UUID) of the company the operation acts on — its identifier, not its NIF. It is the only source of context: the account that owns it is derived from it, and the `BeeL-Active-Company` header plays no part. A company you do not reach answers `403`, and so does a company that does not exist, so the existence of a company in another account is never disclosed."
  2. First observedv0.3.1

TDQS

A4.5/5.0
Behavior5/5

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

The description goes well beyond annotations by disclosing that the operation is irreversible, asynchronous, and that a 200 means 'accepted for submission' rather than AEAT registration. It also explains that PDF generation and AEAT submission happen after the response and directs the agent to wait_for_pdf. 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.

Conciseness5/5

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

The description is dense but well-organized: a one-sentence purpose, two bolded behavioral bullets, an endpoint line, and a focused guardrails block. Every element earns its place and no content is redundant with the schema.

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 high-stakes, irreversible, asynchronous fiscal action with no output schema, the description covers the lifecycle, response semantics, PDF behavior, guardrail resources, and where to find exhaustive rules. Nothing critical is missing for an agent deciding whether and how to invoke it.

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 the baseline is 3. The description adds a small amount of parameter-relevant context by mentioning wait_for_pdf in relation to asynchronous PDF generation, but idempotency_key and attach_source_invoices are left to the schema. That matches the expected baseline.

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 action ('Finalizes a draft invoice of this company'), the key outcome ('assigns its definitive number from the configured series'), and the resulting state ('makes it immutable'). This clearly differentiates the tool from create, patch, void, or corrective operations among the 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?

It gives clear context: an issued invoice is 'corrected with a corrective invoice... or voided... never edited,' and points to guardrail resources for the state machine. It does not explicitly enumerate all sibling alternatives for the pre-issue editable stage, so the guidance is strong but not fully exhaustive.

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

Deploy Server

Other Tools