Skip to content

MCP gateway tools ​

The tools the MCP gateway offers, what each takes and answers, and how each refuses. Every tool is read-only, and nothing a tool answers is ever spend, a rate, a contract value or an invoice; the only budget it answers is the monthly AI budget. For how a request reaches a tool, see the overview; for full protocol detail, see the gateway README.

Every row that names an engagement, an organisation or an invoice carries urls, its links into the Luna web app of that environment: engagement (/engagements/<engagementId>), organisation (/organisations/details/<organisationId>) and invoice (/engagements/invoicing/<invoiceId>/preview), each present only when the row carries that id. Each tool's description tells the agent to always give the link with whatever it names, not only when asked.

People tools ​

whoami, list_my_engagements and get_engagement are for people only and take the caller's identity from the delegated identity token, never from an argument. They are not registered in production for now; see the gateway README.

ToolArgumentsAnswer
whoaminoneandiId, firstName, lastName, knownAs, businessUnit, roles: the identity Luna acts as for this request. No domain service is called.
list_my_engagementsnoneallocations: one row per allocation of the caller's from today through 92 days ahead, internal projects included and archived or deleted allocations left out, each with engagementId, name, organisationId, organisationName, isInternal, claudeEnabled, endDate, urls (engagement, and organisation when it has one), then the allocation's own start, end and roleTitle (the role's type, then its seniority when it has one; null when the role has no type)
get_engagementengagementId (string, required)engagementId, name, description, organisationId, organisationName, deliveryBusinessUnit, agreement, isInternal, claudeEnabled, startDate, endDate, urls (engagement, and organisation when it has one), the caller's own allocations (myAllocations: start, end, roleTitle) and support roles (mySupportRoles)
  • claudeEnabled is Luna's Claude eligibility: the engagement uses the AND Claude instance and is not archived.
  • agreement is the engagement's commercial agreement, such as Time & Materials or Fixed Price (null when Luna holds none); never its amounts or threshold.
  • Dates are ISO dates (2026-10-01); Luna's half-day markers (#AM, #PM) are dropped.
  • get_engagement answers only an engagement the caller holds a support role on, or has an allocation on within 92 days either side of today, so every engagement list_my_engagements answers can be fetched. An archived or deleted allocation does not count.

Both engagement tools read from the engagements querier.

Billing tools ​

list_engagements_for_billing, list_invoices_for_billing, get_invoice_readiness, get_invoicing_calendar, get_billable_amounts_time_and_materials, get_engagement_billable_amounts and find_organisations are for people and agents; list_engagement_budgets is for agents only. An agent sees and calls each only when its record in the agent registry grants it, within that grant's data scope; see Agent access and grants.

A person calls them within the business units they may read: their own and any additional business units on their delegated identity, or every business unit when they hold the CommercialAdmin role. That is their scope wherever this page says the grant's businessUnits. Every person is listed every one of these tools but list_engagement_budgets and, unless one of their roles has a read Actuals row (whatever its fields or conditions), the billable amounts tools, which they are then answered not_permitted; a person with no business unit is answered not_permitted by each of them. The billable amounts tools, get_billable_amounts_time_and_materials and get_engagement_billable_amounts, read the actuals querier's GET /actuals/billable route, which requires the read Actuals permission on the caller's Luna roles. A person needs the CommercialAdmin, BusinessUnitLead or ClientServices role. An agent needs both the tool grant and the HarnessBillingAgent role (one row, read Actuals), held beside HarnessAgent. A caller without the permission is refused by the querier and answered not_permitted.

get_invoicing_calendar names no engagement, business unit or organisation, so any grant of it may call it, scoped or not: the same business-unit grant an agent holds for the billing tools is enough. A person may call it like the other billing tools, when they have a business unit.

ToolArgumentsAnswer
list_engagements_for_billingperiodStart and periodEnd (strings, optional: YYYY-MM-DD, the first and last day of the period, given together; today alone when omitted); businessUnits (string, optional: comma-separated business units the caller may read, all of them by default); organisationId (string, optional: a Luna organisation id from find_organisations, to list that client's engagements alone, within those business units, including those still to start in a period reaching today or later); afterEngagementId (string, optional: the last engagementId of a truncated answer, for the next page)which engagements are pre-ready to bill in the period, before invoices are raised: engagements, one row per engagement of those business units that it keeps (below), each with engagementId, name, organisationId, organisationName, deliveryBusinessUnit, agreement, urls (engagement and organisation, each when the row has it), owner (name, role), documents (msa, sow, po) and preReady; and truncated
list_invoices_for_billingfrom and to (strings, required: YYYY-MM-DD, the first and last day of the range); businessUnits (string, optional: comma-separated business units the caller may read, all of them by default); organisationId (string, optional: a Luna organisation id from find_organisations, to list that client's invoices alone); offset (string, optional: the nextOffset of the previous answer, for the next page)which invoices being prepared, on Time & Materials or Capped Time & Materials engagements, are ready to bill or finalise, which are not, and why: invoices, each with invoiceId, invoiceNumber, from, to, status, engagementId, engagementName, agreement, organisationId (the Luna organisation id of the invoice's client; null when the invoice records none), organisationName, businessUnit, timeApproval, urls (invoice, and engagement and organisation, each when the invoice names it), documents (msa, sow, po), preReady, readyToBill, readyToFinalise, availableAmount (value, currency), blockers and criteria (as get_invoice_readiness answers them); and nextOffset
get_invoice_readinessinvoiceId (string), or engagementId (string) with from and to (strings: YYYY-MM-DD, the first and last day of the period)whether one invoice, by id or by engagement and period, can be billed or finalised: exactly a list_invoices_for_billing row, its criteria each with key, documentType, status, documentIds and documents (each documentId with its reference and level)
list_engagement_budgetsnonebudgets: one row per Claude-enabled engagement the grant's data scope keeps, each with engagementId, budgetUsd (the monthly AI budget in force today), updatedAt (when that budget was set, an ISO 8601 timestamp), period (always month) and enforce (always false: Luna holds no per-budget enforcement switch) and urls with its engagement link. An engagement without a budget is left out.
get_invoicing_calendarcycle (string, optional: Normal (3+1), the default, or Monthly), year (string, optional: YYYY, this year by default, when a period of next year's calendar covering today is listed too, so the current period shows across the turn of the year)the AND invoicing calendar for that billing cycle and year of invoice lock dates: cycle, year, today and updatedAt (when the calendar was written, an ISO 8601 timestamp, null when none is published), and periods, each with periodStart, periodEnd, weeks (given for Normal (3+1) periods, absent for Monthly ones), status (past, current or upcoming) and its deadlines generateInvoices, sendTimeApprovals, timeApprovalsReceived, confirmEngagements and invoiceLockDate
get_billable_amounts_time_and_materialsperiodStart and periodEnd (strings, required: YYYY-MM-DD, at most 92 days counting both); businessUnit (string, optional: one the caller may read, all of them by default); afterEngagementId (string, optional: the afterEngagementId of a truncated answer, for the next page)the Time & Materials time available to bill in the period, per engagement and per currency, over the engagements of the business units the caller may read on a Time & Materials or Capped Time & Materials agreement and the Normal (3+1) cycle with a role billable in the period: periodStart, periodEnd, totalDays, currencies (each client billing currency's notInvoiced, invoiceRaised and total as days and amount, engagementCount and cappedEngagementCount), missingCurrency (the same total for engagements whose client has no billing currency, in no currency's total), engagements (each engagementId, name, organisationId, organisationName, deliveryBusinessUnit, agreement, urls, currency, currencyDefaulted, notInvoiced, invoiceRaised and total, or error for one that could not be read), truncated and afterEngagementId. Pages of 50 engagements, each totalled on its own.
get_engagement_billable_amountsengagementId (string, required), periodStart and periodEnd (as above)one engagement's Time & Materials time available to bill: engagementId, name, organisationId, organisationName, deliveryBusinessUnit, agreement, urls, periodStart, periodEnd, currency, currencyDefaulted, lines (one per role: roleId, roleType, seniority and dailyRates, each with notInvoiced, invoiceRaised and total), total and provisionalInvoiceIds; another agreement answers error not_time_and_materials with no lines or total
find_organisationsname (string, required: at least 2 characters once trimmed)the Luna organisations, clients and prospects, whose name or trading name contains name, ignoring case, owned by the business units the caller may read, by name: organisations (each organisationId, name, tradingName, businessUnit (the club that owns the organisation), status (Active or Inactive) and type (Client or Prospect), the last four null when Luna holds none, and urls with its organisation link) and truncated (true when more than 25 match). An agent uses it to turn a client's name into the organisationId other tools take, and asks which one is meant when more than one matches. Identification only: never billing, bank, contact or company details.
  • list_engagements_for_billing identifies the engagement by engagementId and name (its title), and its organisation by organisationId and organisationName: both null when the engagement has no organisation, and organisationName also when its organisation has no name. It also answers its commercial agreement, as get_engagement does.
  • list_engagements_for_billing answers the engagement's owner: its Client Services Manager, else its Client Services Director, as name (first and last name) and role (that support role). owner is absent when the engagement has neither, or Luna holds no name for them. It never carries an email address. The invoice tools answer no owner.
  • The invoice tools, list_invoices_for_billing and get_invoice_readiness, judge an invoice in exactly the same way, only on the documents Luna evidenced on it (its readiness), against the invoice's own period. Only documents attached to the engagement count: its own (ENGAGEMENTS level), and the client documents applied to it (ORGANISATION level), each counting at either level; a document held only on the organisation never counts. An invoice Luna has not evaluated yet has no documents and no criteria, is not pre-ready, and is blocked not_evaluated; no document attached to its engagement stands in. Every invoice is judged on the same criteria: an MSA, a SOW and a PO, an MSA or SOW having dates overlapping the period, while a PO Luna evidenced on the invoice counts whatever its dates.
  • Each criterion asks for one document (MSA, SOW or PO) at either level. Its status is met, missing, not_overlapping_period (no matching document's dates overlap the period: its start is after the period's last day or its end before its first) or period_unknown (a matching document's date is not a date, or the invoice has no dates); a document starting or ending mid-period counts, and a missing date leaves that side open, so a document without dates overlaps any period. documentIds lists the matching documents that have a file, and documents every matching document with its reference (its PO number or title, null when it has none) and its level (ORGANISATION for a client document, ENGAGEMENTS for the engagement's own): a PO evidenced by its number alone has a null documentId.
  • When Luna has checked the invoice against its purchase order's budget, both invoice tools answer a further po_budget criterion: met when the invoice is within that budget, else over_budget, with the PO number as its reference. It is reported but never decides readiness, and the budget's amounts and currency are never answered.
  • agreement is the invoice's own commercial agreement, recorded on it when it is created (null when the invoice records none).
  • timeApproval is the invoice's time approval in Luna, Unsent, Pending or Approved (null when Luna records none). preReady is true when any one of the MSA, SOW or PO criteria is met; readyToBill when the invoice is pre-ready and its timeApproval is Approved; and readyToFinalise when it is ready to bill and its status is READY (Luna moves a DRAFT or TIME_APPROVAL invoice to READY on its issue date). blockers names what stands between the invoice and finalising it: not_evaluated (Luna has not judged its documents yet) or else no_document (none of the MSA, SOW or PO is evidenced), then time_approval_pending (its timeApproval is not Approved) and status_not_ready (it is not READY); a ready to finalise invoice has none.
  • availableAmount is the invoice's subtotal before tax, as value with its currency, answered on every invoice row whatever its readiness; it is absent only when Luna records no subtotal or currency. It is the one amount the billing tools answer, a deliberate exception to their no-amounts rule, and list_engagements_for_billing answers none.
  • list_engagements_for_billing reads the engagements of each business unit its businessUnits argument names, each of which the grant's scope must name, or else of every business unit the grant's scope names; a grant without businessUnits is refused. It keeps only those on a Time & Materials or Capped Time & Materials agreement (Fixed Price and any other agreement are left out, before paging, so pages and truncated count only these), invoiced on the Normal (3+1) cycle with a role billable in the period (the role's own dates overlap it, and on some day of that overlap the rate period spanning the day, or else the role itself, is Billable), neither internal nor archived, and within the scope's engagementIds and organisationIds when it names them. A billableOnly grant lists the same engagements, as each has a role billable in the period. It reads no invoice. msa, sow and po are uploaded when that criterion (below) is met on what is attached to the engagement and overlaps the period, else missing: its available documents, its own or client documents applied to it (a document held only on the organisation never counts), and its purchase orders. A document overlaps the period when its dates do (a missing date leaves that side open, so an undated document overlaps any period); it need not cover the whole period. A purchase order counts when its start and end overlap the period and it is not marked expired, and only while it has money left (provisionalAmountRemaining above zero, or unknown), as Luna's own evidence counts a purchase order no invoice names yet. If the client then names an exhausted purchase order on the invoice, Luna counts it, so the invoice can become pre-ready after the list said the engagement was not. preReady is true when any one of msa, sow and po is uploaded. For whether an engagement's invoice can be billed or finalised, ask list_invoices_for_billing or get_invoice_readiness. A row whose engagement could not be read answers only its identification fields, error: "luna_unavailable" and preReady: null; ask for that engagement again later. A refusal of the caller's identity still refuses the whole list. It answers at most 50 engagements per call in engagement id order, with truncated true when more qualified. To read the next page, call it again with the same periodStart and periodEnd and afterEngagementId set to the last engagementId of the truncated answer; it lists the engagements whose id sorts after it, so pages neither skip nor repeat one, and a cursor past the last engagement answers an empty list.
  • list_engagements_for_billing's period runs from periodStart to periodEnd, both inclusive; without them it is today alone. To list an invoicing period, pass the periodStart and periodEnd of the current period from get_invoicing_calendar. One without the other, a date that is not a real calendar date, or a periodEnd before periodStart, is refused as an invalid argument.
  • The invoice tools answer a document's reference but, beyond availableAmount, no amount (no invoice total, tax or purchase order balance), and never a rate, a file name, a size, an email address or a document's owner id; list_engagements_for_billing answers no amount at all, and no purchase order number, document title or file name either.
  • list_invoices_for_billing lists the invoices in DRAFT, TIME_APPROVAL or READY whose period overlaps from to to, in the business units businessUnits names, each of which the grant's scope must name, or else in every business unit the grant's scope names; a grant without businessUnits is refused. It lists only the invoices of Time & Materials or Capped Time & Materials engagements: Fixed Price and any other agreement, and an invoice without an engagement, are left out before paging, so they never shorten a page. The invoices of an internal or archived engagement are left out too, as the engagements read leaves those out. It keeps those within the scope's engagementIds and organisationIds when it names them. Each row is the invoice's own, with no owner. Each invoice is judged as above, so msa, sow and po are uploaded when that criterion is met on the invoice, and each row carries its criteria: a row is exactly what get_invoice_readiness answers for that invoice, the full readiness answer. It answers at most 50 invoices per call; when nextOffset is a number, call again with the same arguments and offset set to it. A page can hold fewer than 50 invoices, or none, and still have more after it, as the rows outside the grant or the range are left out of a page; keep calling while nextOffset is a number. Invoices come in order of their period start, ties broken by invoice id, the same on every page, so pages neither repeat nor skip an invoice while none changes; one whose status changes while you page (for example READY to FINAL) can move between pages. An invoice row names no billable flag, so a billableOnly grant is refused any row.
  • get_invoice_readiness answers one invoice: the one named by invoiceId, whatever its period, or else the engagement's newest invoice whose period overlaps from to to. Either way it judges only an invoice in DRAFT, TIME_APPROVAL or READY: a FINAL, VOID or SELF_BILLED invoice named by id is refused like one Luna does not have. Give invoiceId alone, or engagementId with both dates. It is for one invoice, by id or by engagement and period: it answers exactly the row list_invoices_for_billing answers for that invoice, criteria included. An invoice Luna does not have, or an engagement with no such invoice, is not_permitted, so the answer never reveals which invoices exist. Its answer names the invoice's engagement, business unit and organisation for the grant's scope and no billable flag, so a billableOnly grant is refused it.
  • list_engagement_budgets keeps the engagements within the scope's engagementIds, businessUnits (the engagement's delivery business unit) and organisationIds when it names them. A budget carries no billable flag, so a billableOnly grant keeps only the budgets whose engagement has a role billable today, by the same rule list_engagements_for_billing applies when given no period. It answers budgets only, never spend, a rate, a contract value or an invoice.
  • get_invoicing_calendar lists only the periods finance has confirmed, in order; a period not listed has no confirmed dates yet, and an empty periods means no calendar is published for that cycle and year. A period is current from its periodStart to its periodEnd inclusive, so two periods sharing a boundary day are both current on it. cycle takes an engagement's billingCycle; Other has no calendar and is refused as an invalid argument, as is a year that is not four digits. Dates are YYYY-MM-DD and today is UTC. It answers dates only, never an invoice, an amount or an engagement.

list_engagements_for_billing reads each listed engagement, with its purchase orders and attached documents, from the engagements querier, and no invoice. get_invoice_readiness reads invoices only, never an engagement, from the invoices querier. list_invoices_for_billing reads its invoices from the invoices service's search function, which holds the invoice search index, and each business unit's engagements from the engagements querier only to filter the invoices.

The invoices querier answers only an identity that may read invoices: an agent needs an unconditioned read Invoice row on its HarnessAgent role, entered per environment in the Luna admin app, or list_invoices_for_billing and get_invoice_readiness answer not_permitted. The invoice search checks the same permission. A person is answered by their own roles, so a person whose roles may not read invoices is answered not_permitted too.

list_engagement_budgets reads from the ai-scribe querier, which answers only the engagements whose AI budget the delegated identity may read: an agent needs the HarnessBudgetReader role, or the call is not_permitted. For a billableOnly grant it also reads the engagements of each business unit its scope keeps from the engagements querier.

get_invoicing_calendar reads nothing from Luna, which does not hold the invoicing calendar yet: the gateway reads it from its own SSM parameters, one per billing cycle and year (/luna/<env>/mcp-gateway/invoicing-calendar/<normal|monthly>/<year>), written by the luna invoicing-calendar CLI command. Once Luna owns the calendar, only that source changes.

find_organisations reads the organisations service's search (GET /v2/organisations), asking for its index's rows in name order and only their name, trading name, business unit, status and type, so an organisation's billing and bank details are never loaded. The search also matches on industry, so a match on neither name is dropped. It checks no permission, so the gateway keeps only organisations within the grant's organisationIds and businessUnits (an organisation's own business unit). An organisation names no engagement and no billable flag, so grant it without engagementIds or billableOnly, or every call is not_permitted. An organisation's business unit is the club that owns it, which need not be the club delivering its engagements, so a grant left unscoped finds every organisation.

Answer shape ​

A tool answers its fields as structuredContent, plus a text block holding the same JSON for clients that do not read structured content. Every result, error results included, carries resultType: "complete".

Each tool declares an output allowlist, and the gateway cuts every result down to it. A field Luna adds to an engagement later never reaches and-harness unless the tool's allowlist names it.

tools/list carries each tool's output schema (outputSchema) beside its input schema, and clients may validate structuredContent against it. It admits either the tool's answer, naming exactly its fields with each field's type and whether it may be null, or the error result described under Refusals. Every tool declares one. Error results share one shape whichever tool answers them, so a client validates them the same way for every tool.

Refusals ​

OutcomeAnswer
the tool does not exist, is not listed for the caller's principal kind, or is not granted to the agentJSON-RPC -32602 Unknown tool: <name>
the arguments do not match the tool's input schema (including a value outside an argument's allowed values or pattern), a string argument is blank, or list_engagements_for_billing is given only one of periodStart and periodEnd, a date that is not a real calendar date, a periodEnd before periodStart, or a businessUnits naming none, or list_invoices_for_billing is given a from or to that is not a real calendar date, a to before from, or a businessUnits naming none, or get_invoice_readiness is given neither an invoiceId nor an engagementId with both dates, an invoiceId beside them, or the same date errorsJSON-RPC -32602 naming the problem
the domain service refuses the record, or get_engagement refuses an engagement the caller is not assigned toisError: true, structuredContent {"error":"not_permitted"}
get_invoice_readiness is named an invoiceId Luna does not have, or one that is FINAL, VOID or SELF_BILLED, an engagement has no such invoice, or the answer is outside the grant's data scopeisError: true, structuredContent {"error":"not_permitted"}
list_engagements_for_billing is called under a grant that names no businessUnits, is named a business unit the grant does not, or any row it would answer is outside the grant's data scopeisError: true, structuredContent {"error":"not_permitted"}
list_invoices_for_billing is called under a grant that names no businessUnits, is named a business unit the grant does not, or any row it would answer is outside the grant's data scopeisError: true, structuredContent {"error":"not_permitted"}
a person with no business unit calls a billing tool, get_invoicing_calendar includedisError: true, structuredContent {"error":"not_permitted"}
an agent holding a list grant calls any other toolisError: true, structuredContent {"error":"not_permitted"}
the domain service fails, or get_invoicing_calendar cannot read a valid calendar parameterisError: true, structuredContent {"error":"luna_unavailable","requestId":"<correlation id>"}

An engagement that does not exist is refused with not_permitted, the same as one the caller is not assigned to. A tool's error result arrives inside a 200; it is not one of the gateway's HTTP refusals.

A new tool is defined, with its input and output schemas, and registered as the gateway README's code layout describes, and the change that adds a tool also adds its row to this page.

Made with ❤️ by the Luna team