biterp

issue_invoice

Referência da tool issue_invoice do MCP Server do bitERP (Notas fiscais de saída).

Issue Invoice · Notas fiscais de saída

Somente leituraDestrutivaIdempotenteMundo aberto
NãoSimNãoSim

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.

Transmits a draft BR service invoice to the municipal NFS-e provider. Optional fields are applied before transmission.

Parâmetros

ParâmetroTipoObrigatórioDescrição
reference_codestringNãoUser-owned reference code. Free-form; send "" to clear it. Editable even after the invoice is transmitted (it is not part of the fiscal document).
product_typestringNãoDocument product type: goods, service, or mixed. Rejected once the invoice is transmitted, or if it originated from a sales order. Valores: goods, service, mixed.
invoice_datestringNãoInvoice date (calendar date, YYYY-MM-DD). Rejected once the invoice is transmitted.
origin_state_codestringNãoOrigin state code. Rejected once the invoice is transmitted.
origin_country_codestringNãoOrigin country ISO-3166 alpha-2 code. Rejected once the invoice is transmitted.
destination_state_codestringNãoDestination state code. Rejected once the invoice is transmitted.
destination_country_codestringNãoDestination country ISO-3166 alpha-2 code. Rejected once the invoice is transmitted.
customer_tax_typestringNãoCustomer tax profile for the invoice. Rejected once the invoice is transmitted. Valores: individual, company.
salesperson_namestringNãoSalesperson name. Rejected once the invoice is transmitted, or if it originated from a sales order.
fiscal_notesstringNãoFiscal notes printed on the document. Rejected once the invoice is transmitted, or if it originated from a sales order.
internal_notesstringNãoInternal notes (not transmitted). The only free-text field still editable after the invoice is transmitted.
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. Rejected once the invoice is transmitted, or if it originated from a sales order.
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. Rejected once the invoice is transmitted, or if it originated from a sales order.
itemsarray de objetosNãoLine items. Include all lines to keep (others are soft-deleted). Rejected entirely once the invoice is transmitted. If it originated from a sales order, the set/order of lines and product_id/quantity/unit_price/discount_amount/sales_order_item_id cannot change - only item_description, po_number and fiscal fields do.
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ãoManual or header-level tax lines. Rejected once the invoice is transmitted; stays editable pre-transmission even for sales-order-linked invoices.
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.
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.
idstring (UUID)SimUUID of the invoice to issue.

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
stage_reachedstringValores: patch, readiness, dispatched.
invoiceobject—
invoice.idstring (UUID)—
invoice.tenant_idstring (UUID)—
invoice.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.
invoice.reference_codestring ou null—
invoice.statusstring—
invoice.operation_typestring—
invoice.product_typestring—
invoice.originstringProcedência do registro: internal (nasceu no bitERP) ou imported. Valores: internal, imported.
invoice.has_source_xmlbooleanTrue quando a nota tem arquivo XML de origem preservado no storage (import).
invoice.source_data_import_idstring (UUID) ou null—
invoice.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.
invoice.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.
invoice.br_dataobject—
invoice.customer_idstring (UUID)—
invoice.customerobject ou null—
invoice.invoice_datestring (date)—
invoice.origin_state_codestring ou null—
invoice.origin_country_codestring ou null—
invoice.destination_state_codestring ou null—
invoice.destination_country_codestring ou null—
invoice.customer_tax_typestring ou nullValores: individual, company.
invoice.salesperson_namestring ou null—
invoice.fiscal_notesstring ou null—
invoice.internal_notesstring ou null—
invoice.discount_amountstring—
invoice.discount_ratestring—
invoice.tax_engine_providerstring ou null—
invoice.sales_order_idstring (UUID) ou null—
invoice.subtotalstring—
invoice.items_discountstring—
invoice.total_discountstring—
invoice.total_taxstring—
invoice.withheld_totalstring—
invoice.net_receivable_totalstring—
invoice.totalstring—
invoice.itemsarray de objetos—
invoice.taxesarray de objetos—
invoice.deleted_by_user_idstring (UUID) ou null—
invoice.created_atstring (date-time)—
invoice.updated_atstring (date-time)—
invoice.deleted_atstring (date-time) ou null—
warningsarray de objetos—
warnings[].item_idstring (UUID)—
warnings[].item_indexinteger—
warnings[].codestring—
warnings[].messagestring—
warnings[].changed_fieldsarray de objetos—
warnings[].tax_resolution_idstring (UUID)—
errorsobject—
errors.patchobject—
errors.readinessobject—
errors.dispatchobject—
_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": "issue_invoice",
        "arguments": {
            "tenant": "minha-empresa",
            "id": "<uuid>"
        }
    }
}

Nesta página