---
title: "MCP recipes: prompts and tool calls"
description: "Worked examples for the Flowie Exchange API MCP server: the prompt you type and the tool calls the agent makes to send an invoice, list what arrived, approve, refuse or mark an invoice paid, onboard a supplier, send in bulk, watch events and check compliance."
canonical: "https://docs.get-flowie.com/mcp/recipes"
source: "https://docs.get-flowie.com/mcp/recipes.html"
---

# MCP recipes: prompts and tool calls

MCP

# Recipes

Each recipe shows a prompt and the calls a capable agent makes on the **Exchange API server**. You don't write the calls: the agent picks them from the tool descriptions. They are here so you can check what happened, and copy the chain into your own agent. Argument names are exact.

For
    Sellers, buyers and agent developers

Server
    Exchange API (`/exchange/mcp`)

Try it on
    Staging, with an `flw_test_…` key

Updated
    1 Dec 2026

## Send an invoice

_"Bill ACME Belgium €4,500 + 21% VAT for November consulting, due in 30 days."_
[code] 
    search_directory({q: "ACME Belgium", country: "BE"})          → peppolId 0208:0123456789
    verify_recipient({peppolId: "0208:0123456789", documentType: "invoice"})   → canReceive: true
    send_document({
      type: "invoice",
      from: "<your company's Peppol id>",
      to:   "0208:0123456789",
      document: {
        number: "INV-2026-0451", issueDate: "2026-12-01", dueDate: "2026-12-31", currency: "EUR",
        lines: [{description: "Consulting — November 2026", quantity: 1, unitPrice: 4500, vatRate: 21}]
      }
    })                                                             → id doc_…, status "sent", deliveryStatus
[/code]

`status: "sent"` means Flowie accepted the document; `deliveryStatus` follows the network (`pending`, then `delivered` or `failed`). Totals are computed from the lines. Sending the same payload again returns the existing document with `200` instead of creating a second one. Full walkthrough: [Send an invoice](<../guides/send-invoice.html>).

## What arrived this week

_"Which supplier invoices arrived since Monday, and how much do they add up to per supplier?"_
[code] 
    list_documents({direction: "incoming", type: "INVOICE", from: "2026-11-30", limit: 50})
      → for each: get_document_structured({document_id})        # flat fields: totals, dates, parties
      → the agent groups by supplier and adds up grossAmount
[/code]

`from` and `to` filter on the issue date. Pass the returned `cursor` to get the next page.

## Approve, dispute or refuse

_"Approve INV-88213 from Globex. Put INV-88214 on hold: the delivery note is missing."_
[code] 
    search_documents({query: "INV-88213"})                          → document_id
    update_lifecycle({document_id, status: "approved", note: "Checked against PO 4500012"})
    
    search_documents({query: "INV-88214"})                          → document_id
    update_lifecycle({document_id, status: "disputed", reasonCode: "suspended",
                      reason: "Delivery note for line 2 missing"})
[/code]

`rejected` and `disputed` require a `reasonCode`. `rejected` is final (in France it sends status 210 and the supplier must issue a corrective invoice), so ask for `disputed` while the issue can still be fixed. The answer lists `allowedTransitions`. In France and Italy the change is reported to the tax platform automatically. See [Track the lifecycle](<../guides/lifecycle.html>).

## Mark as paid

_"INV-2026-0417 was paid yesterday by SEPA transfer, €1,815, reference PAY-2026-0042."_
[code] 
    search_documents({query: "INV-2026-0417"})                     → document_id
    update_lifecycle({
      document_id, status: "paid",
      paymentDate: "2026-11-30", paymentAmount: 1815.00, paymentCurrency: "EUR",
      paymentReference: "PAY-2026-0042"
    })
[/code]

Payment fields are required for `paid` and `partially_paid`. Recording a payment moves no money.

## Onboard a supplier

_"Add Globex SRL, VAT IT09876543210, as a supplier and check they can receive invoices on Peppol."_
[code] 
    resolve_company({countryCode: "IT", vatNumber: "IT09876543210"})   → name, peppolId, address
    verify_recipient({peppolId, documentType: "invoice"})               → exists, canReceive
    create_partner({vatNumber: "IT09876543210", peppolId, role: "supplier"})
[/code]

## Send many at once

_"Send the 40 invoices in this CSV."_
[code] 
    batch_send({documents: [
      {idempotencyKey: "inv-2026-0501", type: "invoice", from, to, document: {…}},
      {idempotencyKey: "inv-2026-0502", type: "invoice", from, to, document: {…}},
      …
    ]})                                       → results[i] per document, summary {total, succeeded, failed}
[/code]

One failed item doesn't stop the others; each result says what happened. Give each item an `idempotencyKey`, so a retry of the batch never sends an invoice twice. Use the Exchange API server for volume: the App server allows 60 calls a minute.

## Catch up on events

_"What happened to our documents since you last checked?"_
[code] 
    list_events({limit: 50})                → document.received, document.delivered, lifecycle.updated…
      → acts on each, then ack_event({event_id}) so it isn't returned again
[/code]

Events are the pull-based copy of [webhooks](<../reference/webhooks.html>): an agent that runs from time to time doesn't need a public endpoint.

## Check compliance

_"Are all our French invoices reported to the tax administration? List anything that failed."_
[code] 
    get_compliance_status({country: "FR"})                         → per company: synced, pending, failed, rejected
    list_compliance_reports({country: "FR", status: "failed"})      → the documents, with the platform's answer
[/code]

## Prompting tips

  * **Name the environment** when both are connected: _"Use flowie-api-staging."_
  * **Ask for a dry run first** : _"Validate it, show me the invoice, and wait for my go before sending."_ The agent then calls `validate_document` before `send_document`.
  * **Give identifiers you have** : a VAT number or a Peppol id beats a company name.
  * **Let reads run, confirm writes.** Most clients can auto-approve read-only tools and ask for the rest.
  * **Want the official answer?** `get_document_xml` returns the e-invoice exactly as exchanged, and `get_document_pdf` a readable copy.
