update_purchase_invoice
Referência da tool update_purchase_invoice do MCP Server do bitERP (Notas fiscais de entrada).
Update Purchase Invoice · Notas fiscais de entrada
| Somente leitura | Destrutiva | Idempotente | Mundo aberto |
|---|---|---|---|
| Não | Sim | 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.
Updates a purchase invoice. Only provided fields change. Items/taxes/payables arrays replace the full set when sent. On finalized invoices, items, taxes, discounts and payables are rejected; header fields can still change.
Parâmetros
| Parâmetro | Tipo | Obrigatório | Descrição |
|---|---|---|---|
reference_code | string ou null | Não | Origin system reference code. Null when created directly in bitERP. |
invoice_number | string | Não | Supplier invoice number. |
invoice_series | string | Não | Invoice series. |
product_type | string | Não | Product type: goods, service, or mixed. Must fit the document type already stored on the invoice (document type is fixed after create): nfse and cte are always service; the other types accept any value. Valores: goods, service, mixed. |
issue_date | string (date) | Não | Issue date (YYYY-MM-DD). |
received_date | string (date) ou null | Não | Received date (YYYY-MM-DD). |
due_date | string (date) ou null | Não | Due date (YYYY-MM-DD). |
description | string ou null | Não | Description. |
notes | string ou null | 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 | Não | Line items. Sending the list replaces the full set (missing rows are soft-deleted). Rejected on finalized purchase invoices. |
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 |
items[].id | string (UUID) | Não | Existing purchase invoice item UUID when updating a line. |
items[].position | integer | Não | Ordering hint only when updating items (array order wins). |
taxes | array de objetos | Não | Full replacement of purchase invoice taxes when present. |
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 | Full replacement of pending payables snapshot when present in draft. |
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. |
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. |
id | string (UUID) | Sim | UUID of the purchase invoice to update. |
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": "update_purchase_invoice",
"arguments": {
"tenant": "minha-empresa",
"id": "<uuid>"
}
}
}
