create_invoice_draft
ChatGPTCreates a Draft invoice from an exact previously generated invoice Preview. LEGAL ENTITY RULE: Use legalEntityRef returned by list_legal_entities. If the user identifies the Legal Entity only by display name, legal name or tax identifier, first call list_legal_entities automatically and use the matching legalEntityRef. Do not ask the user for legalEntityRef. CONFIRMATION REQUIRED: Never call this tool immediately after preview_invoice_draft. First present the Preview to the user and stop. Call this tool only after the user explicitly confirms creation, for example 'Create it', 'Create the Draft', 'Yes, create it' or equivalent. This tool accepts only the exact previewRef returned by preview_invoice_draft. Never ask the user for previewRef and never construct, shorten or modify it. The Preview is retrieved server-side, recalculated and compared cryptographically with the originally Previewed invoice. If the invoice data has changed, creation is rejected and a new Preview must be generated and confirmed. Only after the Preview matches does this tool obtain the current serial number and call the existing AsesorFacturas create-invoice API.
get_invoice
ChatGPTRetrieve invoice details for one invoice in the selected Legal Entity. Requires legalEntityRef and invoiceRef, which are opaque public references. Use list_legal_entities to obtain legalEntityRef when the intended Legal Entity has not already been resolved. Ask the user to choose when the selection is ambiguous. Use search_invoices for the selected Legal Entity to obtain invoiceRef when only an invoice number, official reference or customer is known. Pass the references exactly as returned by those tools. Do not pass names, invoice numbers or internal database IDs in reference fields. Use get_invoice_pdf to retrieve the invoice PDF. This operation does not modify the invoice.
get_invoice_pdf
ChatGPTRetrieves an invoice PDF from AsesorFacturas. When the user provides a visible invoice number or reference, pass it in invoiceNumber. The server searches for that invoice only inside the selected Legal Entity. IMPORTANT: Draft, Scheduled or other invoices may have the same visible invoice number. If exactly one invoice matches, the PDF is downloaded automatically. If several invoices match, this tool returns the matching invoices with opaque invoiceRef values and enough information for the user to choose the intended invoice. Do not choose one automatically. After the user selects an invoice, call this tool again using its invoiceRef. Never ask for or expose an internal InvoiceID or LegalEntityID. Internally, the server resolves legalEntityRef and invoiceRef and calls the AsesorFacturas PDF API using LegalEntityID and InvoiceID. Downloading the PDF is read-only and never issues, schedules, signs, sends, rectifies, deletes or submits an invoice to AEAT.RESPONSE RULE: When the PDF is successfully retrieved, present the document.downloadUrl returned by this tool as a clickable download link using document.fileName as the link text. Do not merely say that the file was downloaded. The user must receive a link they can click to download it.
get_legal_entity_filter
ChatGPTRetrieves the available invoice filter values for one Legal Entity from AsesorFacturas. Returns the filter groups supplied by the API. Requires legalEntityRef returned by list_legal_entities. If the Legal Entity has not already been resolved, call list_legal_entities and match the user's requested entity by name or tax identifier. If multiple entities match, ask the user which one to use. Never invent a reference or ask the user to provide an internal identifier. This tool retrieves the available groups together; it does not accept a filterTypes parameter. It does not modify data.
get_legal_entity_master_data
ChatGPTReturns selected master data for one AsesorFacturas Legal Entity. Use list_legal_entities first when the Legal Entity is not already known. Only request the data types needed for the current task. This is a read-only operation.
list_legal_entities
ChatGPTLists all AI-enabled Legal Entities accessible to the authenticated user. Use this tool whenever another AsesorFacturas tool requires a Legal Entity and the user has identified it only by name, short name or tax identifier. Each Legal Entity is returned with an opaque legalEntityRef that may be used in subsequent MCP tool calls. Never ask the user to provide, type or know a legalEntityRef or any internal LegalEntityID. When only one AI-enabled Legal Entity is available and the user has not specified one, it may be used automatically. When more than one AI-enabled Legal Entity is available and the user has not specified which one to use, do not choose one automatically. Present the available Legal Entity names and ask the user which Legal Entity should be used before continuing the requested operation. When the user has already identified a Legal Entity by name, short name or tax identifier, match it against the returned Legal Entities and continue automatically when exactly one match is found. Users interact with Legal Entities using their business-visible names or tax identifiers; opaque references and internal database identifiers are implementation details and must not be requested from the user.
preview_invoice_draft
ChatGPTCalculates an invoice draft preview using AsesorFacturas and stores a temporary preview workflow record. Returns previewRef for use with create_invoice_draft. This operation does not create or issue an invoice. Use legalEntityRef returned by list_legal_entities. Resolve clientRef, invoiceTypeRef, paymentMethodRef, currencyRef, languageRef, vatTypeRef and whTaxTypeRef using get_legal_entity_master_data for that legal entity. Use the returned references unchanged. Never invent references or ask the user to provide internal identifiers. Ask for clarification when the requested business record is ambiguous. Provide invoice line details and dates in YYYY-MM-DD format. Each line may specify at most one special fiscal treatment: disbursement, reverse charge, VAT exemption or non-subject operation. Returns supplier, customer and invoice information together with calculated items, totals and available tax breakdowns. Present preview.items, preview.totals, preview.vatGroups and preview.esGroups using the values returned by AsesorFacturas. Do not invent missing values or independently replace the backend calculations. After presenting the preview, ask whether the user wants to create the draft and wait for explicit confirmation. Preserve legalEntityRef and previewRef for create_invoice_draft. If the user changes invoice details, generate and present a new preview before requesting confirmation.
search_invoices
ChatGPTSearch invoices for one accessible Legal Entity using the filters, sorting and pagination defined in the input schema. Requires a legalEntityRef returned by list_legal_entities. Resolve the user's intended Legal Entity before calling this tool; ask the user to choose when the selection is ambiguous. For a named invoice series, call get_legal_entity_filter for the same Legal Entity and pass the matching returned seriesRef in seriesRefs. For a named customer, retrieve customer data using get_legal_entity_master_data and pass the matching returned FiscalID in clientFiscalIds. Do not use query for customer searches. Use public references for Legal Entities and invoice series, and customer fiscal identifiers for clientFiscalIds. Do not request or expose internal database IDs. Dates must use YYYY-MM-DD. This tool does not modify invoices.