Skip to main content
Glama
beel-es

BeeL MCP server

Official
by beel-es

beel_convert_proforma_to_invoice

DestructiveIdempotent

Convert an active proforma into a standard draft invoice, optionally issuing it and assigning a fiscal number in one call.

Instructions

Converts an accepted proforma of this company into a real invoice. The new invoice is created as a STANDARD draft linked back through source_proforma_id.

  • What converts: only proformas in status ACTIVE. One shown as EXPIRED is still ACTIVE underneath and converts too.

  • The proforma: preserved as the record of what the customer accepted — it keeps its PRO-... number and PDF and moves to the terminal status CONVERTED.

  • issue: with true the new invoice is numbered and issued in the same atomic call. If issuing fails nothing is created and the proforma stays ACTIVE. That includes 400 SERIES_NUMBER_COLLISION: the number the series would assign is already used by another invoice of the same company, and the series needs review, so contact support.

  • Errors: 422 CONVERSION_REQUIRES_PROFORMA when the document is not a proforma, 422 PROFORMA_NOT_CONVERTIBLE when it is not ACTIVE, and 409 PROFORMA_ALREADY_CONVERTED when it has already been converted — a second call never creates a second invoice.

Endpoint: POST /v1/companies/{company_id}/invoices/{invoice_id}/convert-to-invoice

⚠️ Read before calling:

  • The status names, the proforma lifecycle, and which tool performs each operation. (resource: beel://guardrails/invoice-state-machine)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNo
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
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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.9.0
    • removedInput schema / $defs / ConvertProformaToInvoiceRequest / properties / verifactu_enabled
      Removed value: -{
      -  "description": "Whether the resulting invoice generates VeriFactu information.\n\n**If omitted, the company's declared preference applies** (the \"apply VeriFactu by\ndefault\" setting, `apply_by_default`) — the same resolution used when creating an\ninvoice. Send the field explicitly (`true` or `false`) to override it.\n\nThe proforma itself never carries VeriFactu, so it has no preference to pass on: the\ninvoice born from the conversion is a new fiscal document and follows the company's\npolicy, exactly like one created from scratch.\n\nThis matters most with `issue: true`, where there is no draft left to edit before\nthe invoice reaches AEAT.\n",
      -  "type": "boolean"
      -}
  2. Changed6 schema fields changedv0.5.0
    • addedInput schema / $defs / ConvertProformaToInvoiceRequest / additionalProperties
      Added value: +false
    • removedInput schema / $defs / ConvertProformaToInvoiceRequest / properties / issue / example
      Removed value: -false
    • removedInput schema / $defs / ConvertProformaToInvoiceRequest / properties / verifactu_enabled / example
      Removed value: -true
    • 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."
  3. First observedv0.3.1

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial behavior beyond the annotations: atomicity of the `issue` call with rollback semantics, the terminal CONVERTED status, the specific 400/409/422 error codes and their meanings, and the guarantee that a second call never creates a second invoice. This meaningfully enriches the destructiveHint/idempotentHint annotations rather than restating them.

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?

Front-loads the core purpose, then uses scannable bolded bullets for conversion scope, preservation, the `issue` flag, and errors, closing with the endpoint and a guardrails pointer. Slightly long but nearly every line carries distinct information; structure is strong.

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 complex, destructive mutation with no output schema, the description covers lifecycle transitions, atomicity, idempotency consequences, and the full error taxonomy, and it routes the agent to the state-machine guardrail resource. Nothing essential to calling it correctly appears to be 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 coverage is 75%, and the description deepens the `issue` parameter with failure semantics (issuing failure leaves nothing created, proforma stays ACTIVE, SERIES_NUMBER_COLLISION path) that the schema's one-line description does not. company_id and invoice_id semantics live in the schema; the description adds linkage context via source_proforma_id.

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 ('Converts an accepted proforma ... into a real invoice') and immediately distinguishes itself from generic invoice creation by naming the source object and the resulting STANDARD draft linked via source_proforma_id. An agent can tell it apart from create_invoice, issue_invoice, or create_invoice_derivation without opening a schema.

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 preconditions for use (only ACTIVE proformas convert, EXPIRED-but-ACTIVE still converts) and points to the guardrails resource for the lifecycle. It does not, however, explicitly name sibling alternatives or say when NOT to reach for this tool versus e.g. create_invoice, so it stops short of full routing guidance.

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