biterp

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 leituraDestrutivaIdempotenteMundo aberto
NãoNãoNãoNã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âmetroTipoObrigatórioDescrição
tenantstringSimDefines 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_codestringNãoOptional user-owned reference code. Free-form; the invoice is created without one when omitted.
customer_idstring (UUID)SimCustomer UUID. Use list_customers to find customers.
operation_typestringNãoOperation type. Defaults to sale. Valores: sale, return.
sales_order_idstring (UUID)NãoOptional originating sales order UUID.
product_typestringSimProduct type: goods, service, or mixed. Valores: goods, service, mixed.
invoice_datestringSimInvoice date (calendar date, YYYY-MM-DD).
origin_state_codestringNão—
origin_country_codestringNão—
destination_state_codestringNão—
destination_country_codestringNão—
customer_tax_typestringNãoValores: individual, company.
salesperson_namestringNão—
fiscal_notesstringNão—
internal_notesstringNão—
discount_amountdecimal (string ou number)NãoGlobal discount amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted
discount_ratedecimal (string ou number)NãoGlobal 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
itemsarray de objetosSimAt least one line item is required.
items[].idstring (UUID)NãoExisting invoice item UUID when updating a line.
items[].product_idstring (UUID)NãoProduct UUID. Use list_products to find products.
items[].sales_order_item_idstring (UUID)NãoSource sales order line UUID when generated from an order.
items[].tax_resolution_idstring (UUID)NãoUUID of a pre-calculated tax_resolution_result from tax-resolution calculate. Does not auto-run the tax engine on create.
items[].item_descriptionstringSimLine item description.
items[].quantitydecimal (string ou number)SimQuantity 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_pricedecimal (string ou number)SimUnit 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_amountdecimal (string ou number)NãoLine 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_numberstringNãoPurchase order number.
taxesarray de objetosNão—
taxes[].item_indexintegerNãoZero-based index into items[] for line-level tax. Omit for invoice-level tax.
taxes[].tax_codestringSimTax code (e.g. ISS, PIS, ICMS).
taxes[].tax_namestringSimDisplay name of the tax.
taxes[].base_amountdecimal (string ou number)SimTax base amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted
taxes[].ratedecimal (string ou number)SimTax 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[].amountdecimal (string ou number)SimTax amount as decimal string (numeric(18,6), e.g. "1500.000000"); a JSON number with at most 6 decimals is also accepted
taxes[].is_withheldbooleanNãoWhen true, tax is withheld from net receivable.
taxes[].is_includedbooleanNãoWhen true, tax is already included in item subtotal.
taxes[].jurisdictionstringNãoTax jurisdiction label.
taxes[].sourcestringNãoTax source identifier.
taxes[].positionintegerSimSort position among tax lines.
receivablesarray de objetosNãoOptional receivable installments linked to the invoice.
receivables[].amountdecimal (string ou number)SimReceivable 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_datestringSimDue date as calendar date YYYY-MM-DD.
receivables[].financial_account_idstring (UUID)SimFinancial account UUID for this receivable.
receivables[].payment_method_idstring (UUID)NãoOptional payment method UUID.
receivables[].descriptionstringNãoInstallment description.

Resposta

O structuredContent da resposta traz os campos abaixo (até dois níveis; o schema completo está no outputSchema publicado no tools/list).

CampoTipoDescrição
idstring (UUID)—
tenant_idstring (UUID)—
record_numberintegerTenant-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_codestring ou null—
statusstring—
operation_typestring—
product_typestring—
originstringProcedência do registro: internal (nasceu no bitERP) ou imported. Valores: internal, imported.
has_source_xmlbooleanTrue quando a nota tem arquivo XML de origem preservado no storage (import).
source_data_import_idstring (UUID) ou null—
import_cancellation_sourcestring ou nullNota 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_channelstring ou nullNota 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_dataobject—
br_data.nfse_access_keystring ou null—
br_data.source_xml_dialectstring ou nullValores: nacional, abrasf_v2.
br_data.has_response_xmlbooleanTrue quando o XML autorizado da NFS-e está disponível para download.
customer_idstring (UUID)—
customerobject ou null—
customer.idstring (UUID)—
customer.legal_namestring—
customer.trade_namestring ou null—
customer.tax_idstring ou null—
customer.tax_id_typestring ou null—
customer.country_codestring—
invoice_datestring (date)—
origin_state_codestring ou null—
origin_country_codestring ou null—
destination_state_codestring ou null—
destination_country_codestring ou null—
customer_tax_typestring ou nullValores: individual, company.
salesperson_namestring ou null—
fiscal_notesstring ou null—
internal_notesstring ou null—
discount_amountstring—
discount_ratestring—
tax_engine_providerstring ou null—
sales_order_idstring (UUID) ou null—
subtotalstring—
items_discountstring—
total_discountstring—
total_taxstring—
withheld_totalstring—
net_receivable_totalstring—
totalstring—
itemsarray de objetos—
items[].idstring (UUID)—
items[].invoice_idstring (UUID)—
items[].product_idstring (UUID) ou null—
items[].sales_order_item_idstring (UUID) ou null—
items[].item_descriptionstring—
items[].quantitystring—
items[].unit_pricestring—
items[].discount_amountstring—
items[].subtotalstring—
items[].totalstring—
taxesarray de objetos—
taxes[].idstring (UUID)—
taxes[].invoice_idstring (UUID)—
taxes[].invoice_item_idstring (UUID) ou null—
taxes[].tax_codestring—
taxes[].tax_namestring—
taxes[].base_amountstring—
taxes[].ratestring—
taxes[].amountstring—
taxes[].jurisdictionstring ou null—
taxes[].is_withheldboolean—
taxes[].is_includedboolean—
taxes[].sourcestring—
taxes[].positioninteger—
deleted_by_user_idstring (UUID) ou null—
created_atstring (date-time)—
updated_atstring (date-time)—
deleted_atstring (date-time) ou null—
_tenantobject—
_tenant.idstring (UUID)—
_tenant.slugstring—
_tenant.company_namestring—

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"
                }
            ]
        }
    }
}

Nesta página