biterp

create_purchase_invoice

Referência da tool create_purchase_invoice do MCP Server do bitERP (Notas fiscais de entrada).

Create Purchase Invoice · Notas fiscais de entrada

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 purchase invoice with line items. reference_code is never auto-generated — omit or pass null unless the origin system provides one.

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.
supplier_idstring (UUID)SimSupplier UUID. Use list_suppliers to find suppliers.
reference_codestring ou nullNãoOrigin system reference code. Null when created directly in bitERP. Never auto-generated.
invoice_numberstringSimSupplier invoice number.
invoice_seriesstringNãoInvoice series.
operation_typestringNãoOperation type code. Defaults to purchase.
document_typestringSimDocument type: nfe (NF-e), nfce (NFC-e), cfe (SAT/MF-e coupon), nfse (NFS-e), cte (CT-e), receipt (receipt or bill without a fiscal document), other. nfe, nfce, cfe, nfse and cte are Brazil-only; outside Brazil only receipt and other are accepted. Required: ask the user which document it is before product_type. Valores: nfe, nfce, cfe, nfse, cte, receipt, other.
product_typestringNãoProduct type: goods, service, or mixed. Must fit the document type: nfse and cte are always service; the other types accept any value. When omitted on create, defaults from document_type (nfe/nfce/cfe → goods, nfse/cte/receipt → service, other → mixed). Valores: goods, service, mixed.
issue_datestring (date)SimIssue date (YYYY-MM-DD).
received_datestring (date)NãoReceived date (YYYY-MM-DD).
due_datestring (date)NãoDue date (YYYY-MM-DD).
descriptionstringNãoDescription.
notesstringNãoInternal notes.
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[].product_idstring (UUID)NãoProduct UUID. Use list_products to find products.
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
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. ICMS, PIS).
taxes[].tax_namestringNãoDisplay 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 payable.
taxes[].is_includedbooleanNãoWhen true, tax is already included in item subtotal.
taxes[].jurisdictionstringNãoTax jurisdiction label.
taxes[].positionintegerSimSort position among tax lines.
payablesarray de objetosNão—
payables[].amountdecimal (string ou number)SimPayable 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
payables[].due_datestring (date)SimDue date (YYYY-MM-DD).
payables[].financial_account_idstring (UUID)SimFinancial account UUID for this payable. A credit card account turns the invoice into a card purchase, which requires a single payable: installments on a card are not supported yet.
payables[].financial_category_idstring (UUID)NãoOptional financial category UUID.
payables[].payment_method_idstring (UUID)NãoOptional payment method UUID.
payables[].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)—
supplier_idstring (UUID)—
supplierobject ou null—
supplier.idstring (UUID)—
supplier.legal_namestring—
supplier.trade_namestring ou null—
supplier.tax_idstring ou null—
supplier.tax_id_typestring ou null—
supplier.country_codestring—
reference_codestring ou null—
invoice_numberstring—
invoice_seriesstring ou null—
statusstringValores: draft, finalized.
situationstringValores: draft, manual, imported, validated, rejected, booked, finalized.
operation_typestring—
product_typestringValores: goods, service, mixed.
document_typestringValores: nfe, nfce, cfe, nfse, cte, receipt, other.
issue_datestring (date)—
due_datestring (date) ou null—
received_datestring (date) ou null—
descriptionstring ou null—
notesstring ou null—
discount_amountstring—
discount_ratestring—
subtotalstring—
items_discountstring—
total_discountstring—
total_taxstring—
withheld_totalstring—
net_payable_totalstring—
covered_amountstring—
uncovered_amountstring—
totalstring—
pending_payablesarray de objetos ou null—
pending_payables[].amountstring—
pending_payables[].due_datestring (date)—
pending_payables[].financial_account_idstring (UUID)—
pending_payables[].financial_category_idstring (UUID) ou null—
pending_payables[].payment_method_idstring (UUID) ou null—
pending_payables[].descriptionstring ou null—
itemsarray de objetos—
items[].idstring (UUID)—
items[].purchase_invoice_idstring (UUID)—
items[].product_idstring (UUID) ou null—
items[].item_descriptionstring—
items[].quantitystring—
items[].unit_pricestring—
items[].discount_amountstring—
items[].subtotalstring—
items[].totalstring—
items[].positioninteger—
items[].br_dataobject ou null—
items[].deleted_atstring (date-time) ou null—
taxesarray de objetos—
taxes[].idstring (UUID)—
taxes[].purchase_invoice_idstring (UUID)—
taxes[].purchase_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[].positioninteger—
taxes[].imported_missing_fieldsarray de string—
taxes[].deleted_atstring (date-time) ou null—
br_dataobject ou null—
br_data.purchase_invoice_idstring (UUID)—
br_data.nfe_access_keystring ou null—
br_data.nfse_access_keystring ou null—
br_data.capture_statusstring ou null—
us_dataobject ou null—
us_data.purchase_invoice_idstring (UUID)—
us_data.po_numberstring ou null—
us_data.net_termsinteger ou null—
us_data.form_1099_typestring ou null—
us_data.form_1099_reportableboolean—
us_data.use_tax_self_assessedboolean—
nfe_importobject ou null—
nfe_import.access_keystring—
nfe_import.installmentsarray de objetos—
nfe_import.dfe_inbound_nfe_idstring (UUID) ou null—
nfse_importobject ou null—
nfse_import.access_keystring—
nfse_import.dfe_inbound_nfse_idstring (UUID) ou null—
nfse_import.originstringValores: created, linked.
nfse_import.net_amountstring ou null—
nfse_import.conditional_discountstring ou null—
nfse_import.warningsarray de string—
cte_importobject ou null—
cte_import.access_keystring—
cte_import.cte_typestringValores: normal, complement, substitution.
cte_import.referenced_access_keystring ou null—
cte_import.installmentsarray de objetos—
cte_import.dfe_inbound_cte_idstring (UUID) ou null—
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_purchase_invoice",
        "arguments": {
            "tenant": "minha-empresa",
            "supplier_id": "<uuid>",
            "invoice_number": "<invoice_number>",
            "document_type": "nfe",
            "issue_date": "2026-01-15",
            "items": [
                {
                    "item_description": "<item_description>",
                    "quantity": "100.00",
                    "unit_price": "100.00"
                }
            ]
        }
    }
}

Nesta página