create_invoice
Referência da tool create_invoice do MCP Server do bitERP (Notas fiscais de saída).
Create Invoice · Notas fiscais de saída
| Somente leitura | Destrutiva | Idempotente | Mundo aberto |
|---|---|---|---|
| Não | Não | Não | Não |
Descrição
A descrição abaixo é a que o servidor publica, em inglês, e é o texto que o agente lê para decidir quando usar a tool.
Creates a draft fiscal invoice with line items. Does not run the tax engine automatically; link tax_resolution_id per item or pass manual taxes.
Parâmetros
| Parâmetro | Tipo | Obrigatório | Descrição |
|---|---|---|---|
tenant | string | Sim | Defines which tenant will have data read or changed. Use list_tenants first and prefer the returned tenant slug. Writes are permanent, so when the user has more than one tenant you must confirm the tenant before any write and never assume or reuse a previous choice without confirmation. UUID is accepted only when already known safely. |
reference_code | string | Não | Optional user-owned reference code. Free-form; the invoice is created without one when omitted. |
customer_id | string (UUID) | Sim | Customer UUID. Use list_customers to find customers. |
operation_type | string | Não | Operation type. Defaults to sale. Valores: sale, return. |
sales_order_id | string (UUID) | Não | Optional originating sales order UUID. |
product_type | string | Sim | Product type: goods, service, or mixed. Valores: goods, service, mixed. |
invoice_date | string | Sim | Invoice date (calendar date, YYYY-MM-DD). |
origin_state_code | string | Não | — |
origin_country_code | string | Não | — |
destination_state_code | string | Não | — |
destination_country_code | string | Não | — |
customer_tax_type | string | Não | Valores: individual, company. |
salesperson_name | string | Não | — |
fiscal_notes | string | Não | — |
internal_notes | string | Não | — |
discount_amount | decimal (string ou number) | Não | Global discount amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted |
discount_rate | decimal (string ou number) | Não | Global discount rate as decimal string on the 0-100 percentage scale (e.g. "10" = 10%, "0.5" = half a percent); a JSON number on the same scale is also accepted |
items | array de objetos | Sim | At least one line item is required. |
items[].id | string (UUID) | Não | Existing invoice item UUID when updating a line. |
items[].product_id | string (UUID) | Não | Product UUID. Use list_products to find products. |
items[].sales_order_item_id | string (UUID) | Não | Source sales order line UUID when generated from an order. |
items[].tax_resolution_id | string (UUID) | Não | UUID of a pre-calculated tax_resolution_result from tax-resolution calculate. Does not auto-run the tax engine on create. |
items[].item_description | string | Sim | Line item description. |
items[].quantity | decimal (string ou number) | Sim | Quantity as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted, must be > 0 |
items[].unit_price | decimal (string ou number) | Sim | Unit price as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted, non-negative |
items[].discount_amount | decimal (string ou number) | Não | Line discount amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted |
items[].po_number | string | Não | Purchase order number. |
taxes | array de objetos | Não | — |
taxes[].item_index | integer | Não | Zero-based index into items[] for line-level tax. Omit for invoice-level tax. |
taxes[].tax_code | string | Sim | Tax code (e.g. ISS, PIS, ICMS). |
taxes[].tax_name | string | Sim | Display name of the tax. |
taxes[].base_amount | decimal (string ou number) | Sim | Tax base amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted |
taxes[].rate | decimal (string ou number) | Sim | Tax rate as decimal string on the 0-100 percentage scale (e.g. "10" = 10%, "0.5" = half a percent); a JSON number on the same scale is also accepted |
taxes[].amount | decimal (string ou number) | Sim | Tax amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted |
taxes[].is_withheld | boolean | Não | When true, tax is withheld from net receivable. |
taxes[].is_included | boolean | Não | When true, tax is already included in item subtotal. |
taxes[].jurisdiction | string | Não | Tax jurisdiction label. |
taxes[].source | string | Não | Tax source identifier. |
taxes[].position | integer | Sim | Sort position among tax lines. |
receivables | array de objetos | Não | Optional receivable installments linked to the invoice. |
receivables[].amount | decimal (string ou number) | Sim | Receivable installment amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted, must be > 0 |
receivables[].due_date | string | Sim | Due date as calendar date YYYY-MM-DD. |
receivables[].financial_account_id | string (UUID) | Sim | Financial account UUID for this receivable. |
receivables[].payment_method_id | string (UUID) | Não | Optional payment method UUID. |
receivables[].description | string | Não | Installment description. |
Resposta
O structuredContent da resposta traz os campos abaixo (até dois níveis; o schema completo está no outputSchema publicado no tools/list).
| Campo | Tipo | Descrição |
|---|---|---|
id | string (UUID) | — |
tenant_id | string (UUID) | — |
record_number | integer | Tenant-scoped sequential invoice number shown in the UI as NTF-1042 for Brazilian companies (prefix depends on the tenant country); pass 1042 without the prefix. |
reference_code | string ou null | — |
status | string | — |
operation_type | string | — |
product_type | string | — |
origin | string | Procedência do registro: internal (nasceu no bitERP) ou imported. Valores: internal, imported. |
has_source_xml | boolean | True quando a nota tem arquivo XML de origem preservado no storage (import). |
source_data_import_id | string (UUID) ou null | — |
import_cancellation_source | string ou null | Nota importada cancelada: manual = registrado só no bitERP, não transmitido à prefeitura; demais valores = cancelamento veio no XML importado. Valores: abrasf_nfse_cancelamento, abrasf_nfse_substituicao, nacional_event_101101, nacional_event_105102, nacional_event_105104, nacional_event_305101, spreadsheet, manual. |
import_channel | string ou null | Nota importada: file = XML enviado pelo usuário, spreadsheet = planilha, dfe_adn = captura da NFS-e emitida no Ambiente Nacional. Valores: file, spreadsheet, dfe_adn. |
br_data | object | — |
br_data.nfse_access_key | string ou null | — |
br_data.source_xml_dialect | string ou null | Valores: nacional, abrasf_v2. |
br_data.has_response_xml | boolean | True quando o XML autorizado da NFS-e está disponível para download. |
customer_id | string (UUID) | — |
customer | object ou null | — |
customer.id | string (UUID) | — |
customer.legal_name | string | — |
customer.trade_name | string ou null | — |
customer.tax_id | string ou null | — |
customer.tax_id_type | string ou null | — |
customer.country_code | string | — |
invoice_date | string (date) | — |
origin_state_code | string ou null | — |
origin_country_code | string ou null | — |
destination_state_code | string ou null | — |
destination_country_code | string ou null | — |
customer_tax_type | string ou null | Valores: individual, company. |
salesperson_name | string ou null | — |
fiscal_notes | string ou null | — |
internal_notes | string ou null | — |
discount_amount | string | — |
discount_rate | string | — |
tax_engine_provider | string ou null | — |
sales_order_id | string (UUID) ou null | — |
subtotal | string | — |
items_discount | string | — |
total_discount | string | — |
total_tax | string | — |
withheld_total | string | — |
net_receivable_total | string | — |
total | string | — |
items | array de objetos | — |
items[].id | string (UUID) | — |
items[].invoice_id | string (UUID) | — |
items[].product_id | string (UUID) ou null | — |
items[].sales_order_item_id | string (UUID) ou null | — |
items[].item_description | string | — |
items[].quantity | string | — |
items[].unit_price | string | — |
items[].discount_amount | string | — |
items[].subtotal | string | — |
items[].total | string | — |
taxes | array de objetos | — |
taxes[].id | string (UUID) | — |
taxes[].invoice_id | string (UUID) | — |
taxes[].invoice_item_id | string (UUID) ou null | — |
taxes[].tax_code | string | — |
taxes[].tax_name | string | — |
taxes[].base_amount | string | — |
taxes[].rate | string | — |
taxes[].amount | string | — |
taxes[].jurisdiction | string ou null | — |
taxes[].is_withheld | boolean | — |
taxes[].is_included | boolean | — |
taxes[].source | string | — |
taxes[].position | integer | — |
deleted_by_user_id | string (UUID) ou null | — |
created_at | string (date-time) | — |
updated_at | string (date-time) | — |
deleted_at | string (date-time) ou null | — |
_tenant | object | — |
_tenant.id | string (UUID) | — |
_tenant.slug | string | — |
_tenant.company_name | string | — |
Exemplo de chamada
Requisição tools/call com os parâmetros obrigatórios. Os valores são ilustrativos: troque minha-empresa pelo tenant devolvido por list_tenants e cada <...> por um valor real.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "create_invoice",
"arguments": {
"tenant": "minha-empresa",
"customer_id": "<uuid>",
"product_type": "goods",
"invoice_date": "2026-01-15",
"items": [
{
"item_description": "<item_description>",
"quantity": "100.00",
"unit_price": "100.00"
}
]
}
}
}
