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 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 purchase invoice with line items. reference_code is never auto-generated — omit or pass null unless the origin system provides one.
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. |
supplier_id | string (UUID) | Sim | Supplier UUID. Use list_suppliers to find suppliers. |
reference_code | string ou null | Não | Origin system reference code. Null when created directly in bitERP. Never auto-generated. |
invoice_number | string | Sim | Supplier invoice number. |
invoice_series | string | Não | Invoice series. |
operation_type | string | Não | Operation type code. Defaults to purchase. |
document_type | string | Sim | Document 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_type | string | Não | Product 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_date | string (date) | Sim | Issue date (YYYY-MM-DD). |
received_date | string (date) | Não | Received date (YYYY-MM-DD). |
due_date | string (date) | Não | Due date (YYYY-MM-DD). |
description | string | Não | Description. |
notes | string | Não | Internal notes. |
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[].product_id | string (UUID) | Não | Product UUID. Use list_products to find products. |
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 |
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. ICMS, PIS). |
taxes[].tax_name | string | Não | 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 payable. |
taxes[].is_included | boolean | Não | When true, tax is already included in item subtotal. |
taxes[].jurisdiction | string | Não | Tax jurisdiction label. |
taxes[].position | integer | Sim | Sort position among tax lines. |
payables | array de objetos | Não | — |
payables[].amount | decimal (string ou number) | Sim | Payable 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_date | string (date) | Sim | Due date (YYYY-MM-DD). |
payables[].financial_account_id | string (UUID) | Sim | Financial 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_id | string (UUID) | Não | Optional financial category UUID. |
payables[].payment_method_id | string (UUID) | Não | Optional payment method UUID. |
payables[].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) | — |
supplier_id | string (UUID) | — |
supplier | object ou null | — |
supplier.id | string (UUID) | — |
supplier.legal_name | string | — |
supplier.trade_name | string ou null | — |
supplier.tax_id | string ou null | — |
supplier.tax_id_type | string ou null | — |
supplier.country_code | string | — |
reference_code | string ou null | — |
invoice_number | string | — |
invoice_series | string ou null | — |
status | string | Valores: draft, finalized. |
situation | string | Valores: draft, manual, imported, validated, rejected, booked, finalized. |
operation_type | string | — |
product_type | string | Valores: goods, service, mixed. |
document_type | string | Valores: nfe, nfce, cfe, nfse, cte, receipt, other. |
issue_date | string (date) | — |
due_date | string (date) ou null | — |
received_date | string (date) ou null | — |
description | string ou null | — |
notes | string ou null | — |
discount_amount | string | — |
discount_rate | string | — |
subtotal | string | — |
items_discount | string | — |
total_discount | string | — |
total_tax | string | — |
withheld_total | string | — |
net_payable_total | string | — |
covered_amount | string | — |
uncovered_amount | string | — |
total | string | — |
pending_payables | array de objetos ou null | — |
pending_payables[].amount | string | — |
pending_payables[].due_date | string (date) | — |
pending_payables[].financial_account_id | string (UUID) | — |
pending_payables[].financial_category_id | string (UUID) ou null | — |
pending_payables[].payment_method_id | string (UUID) ou null | — |
pending_payables[].description | string ou null | — |
items | array de objetos | — |
items[].id | string (UUID) | — |
items[].purchase_invoice_id | string (UUID) | — |
items[].product_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 | — |
items[].position | integer | — |
items[].br_data | object ou null | — |
items[].deleted_at | string (date-time) ou null | — |
taxes | array de objetos | — |
taxes[].id | string (UUID) | — |
taxes[].purchase_invoice_id | string (UUID) | — |
taxes[].purchase_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[].position | integer | — |
taxes[].imported_missing_fields | array de string | — |
taxes[].deleted_at | string (date-time) ou null | — |
br_data | object ou null | — |
br_data.purchase_invoice_id | string (UUID) | — |
br_data.nfe_access_key | string ou null | — |
br_data.nfse_access_key | string ou null | — |
br_data.capture_status | string ou null | — |
us_data | object ou null | — |
us_data.purchase_invoice_id | string (UUID) | — |
us_data.po_number | string ou null | — |
us_data.net_terms | integer ou null | — |
us_data.form_1099_type | string ou null | — |
us_data.form_1099_reportable | boolean | — |
us_data.use_tax_self_assessed | boolean | — |
nfe_import | object ou null | — |
nfe_import.access_key | string | — |
nfe_import.installments | array de objetos | — |
nfe_import.dfe_inbound_nfe_id | string (UUID) ou null | — |
nfse_import | object ou null | — |
nfse_import.access_key | string | — |
nfse_import.dfe_inbound_nfse_id | string (UUID) ou null | — |
nfse_import.origin | string | Valores: created, linked. |
nfse_import.net_amount | string ou null | — |
nfse_import.conditional_discount | string ou null | — |
nfse_import.warnings | array de string | — |
cte_import | object ou null | — |
cte_import.access_key | string | — |
cte_import.cte_type | string | Valores: normal, complement, substitution. |
cte_import.referenced_access_key | string ou null | — |
cte_import.installments | array de objetos | — |
cte_import.dfe_inbound_cte_id | string (UUID) ou null | — |
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_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"
}
]
}
}
}
