Skip to main content
Glama
beel-es

BeeL MCP server

Official
by beel-es

beel_create_invoice_derivation

Idempotent

Duplicate an existing invoice into a new draft without altering the source. The copy resets number, status, dates, and VeriFactu data, ready for changes.

Instructions

Creates a draft invoice derived from an existing invoice of this company. The source invoice, named in from_invoice_id, is not modified.

  • mode: the only value is DUPLICATE, which copies the source into a fresh draft. Recipient, lines, payment method, series and observations are copied; number, status, dates, VeriFactu data and PDF are reset.

  • Series: the one sent in series_id, or the source's when omitted. It is validated against the type of the copy, which is not always the source's: the copy of a CORRECTIVE is born STANDARD. An incompatible series fails with 422 SERIES_INCOMPATIBLE_DOC_TYPE.

Endpoint: POST /v1/companies/{company_id}/invoices/derivations

⚠️ 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)

For the exhaustive rules and worked examples, call beel_docs_search.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYes
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.
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. Changed4 schema fields changedv0.5.0
    • addedInput schema / $defs / CreateInvoiceDerivationRequest / additionalProperties
      Added value: +false
    • 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.6/5.0
Behavior5/5

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

Beyond the annotations, the description discloses that the source invoice is not modified, which fields are copied versus reset, and that a copy of a CORRECTIVE invoice is born STANDARD. It also surfaces a specific error case and points to fiscal guardrails, giving substantial behavioral context.

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 structured with clear bullets and front-loads the most important fact: the source invoice is not modified. Every section earns its place, including the endpoint, error code, guardrails pointer, and exhaustive-docs pointer.

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?

The definition covers side effects, field resets, series behavior, error causes, endpoint, and a guardrails resource, making the tool highly usable without external context. It does not describe the response payload, but no output schema is present and the request schema is comprehensive enough to support a correct call.

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?

The schema already provides rich descriptions for most parameters, and the tool description adds extra value by explaining mode's only accepted value and the series default/validation behavior, including the CORRECTIVE-to-STANDARD transformation. Notes and idempotency_key are not re-explained, but they are already thoroughly documented in the schema.

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 opens with a specific action and resource: 'Creates a draft invoice derived from an existing invoice.' It clearly separates derivation from ordinary invoice creation and from proforma conversion by emphasizing that the source is copied and not modified, and by explaining exactly what is reset.

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?

The description establishes that the only mode is DUPLICATE and details the copy behavior, making the intended use clear. It lacks an explicit 'use this instead of create_invoice when...' statement, but the semantics of deriving from an existing invoice are unambiguous enough for an agent to select this tool appropriately.

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