Skip to main content

Capabilities and tools

A capability is something the assistant can do for a claim: summarise it, validate the policy, run a fraud check. A tool is a function the model can call to read or compute something from the claim. Capabilities own playbooks; tools do the reading and the arithmetic.

A capability has two halves​

The public half (CapabilityMeta) is what the UI needs: the label and one-line description, the group, whether it is a pinned chip, and the message a quick action sends so it reads naturally in the transcript. The assistant reads the same rows when asked what it can do.

The server half (Capability in api/src/capabilities/types.ts):

export interface Capability {
id: string; // must match the shared catalogue
promptId: string; // the playbook in prompts/catalogue.ts
tools?: ChatTool[]; // tools this capability brings
thinkingLevel?: ThinkingLevel; // 'low' | 'medium' | 'high' for this task
}

Server capabilities are declared one object per capability in five group files, understand.ts, decide.ts, protect.ts, produce.ts and help.ts, and gathered in registry.ts:

api/src/capabilities/decide.ts
export const decideCapabilities: Capability[] = [
{ id: 'policy_validation', promptId: 'capability.policy_validation', tools: [checkPolicyInForce], thinkingLevel: 'high' },
{ id: 'next_actions', promptId: 'capability.next_actions', tools: [listDeadlines], thinkingLevel: 'medium' },
// …
];

assertCatalogueMatches() runs at Worker start-up and throws if an id exists on one side and not the other. A unit test checks the same thing, and that every promptId exists in the prompt catalogue.

Quick actions and free chat​

A quick action (a chip, the More menu, or a demo hint) sends the capability's quickActionMessage with capability: '<id>'. The system prompt then carries ## Task: <label> and that capability's playbook, and the capability's thinking level applies.

Free chat sends no capability. The prompt carries the claim_qa playbook plus a short guide listing what each specialist task does, so when a free question amounts to one of them the model can do it to the same standard.

Tools​

api/src/capabilities/types.ts
export interface ChatTool {
definition: ToolDefinition; // name, description, JSON-schema parameters (provider-neutral)
screenAction?: boolean; // acts on the page, not the claim
activity: (input) => string; // the chip: "Reading the policy…"
run: (input, { claim, today }) => ToolOutcome | Promise<ToolOutcome>;
}

export interface ToolOutcome {
result: string; // back to the model; keep it compact
clientActions?: ClientAction[]; // for the browser to perform
}

Rules every tool follows:

  • Read-only. A tool reads the one claim it is given. It cannot write, fetch or reach another claim.
  • Deterministic. Same claim and same today, same result. today is passed in rather than read from the clock, so tests can pin it.
  • Compact JSON out, plain numbers in. The result lives in the model's context for the rest of the turn. Return what the model needs to reason with, not the whole section again. Compute with plain numbers and ISO dates; runTool formats them for the model (below).
  • Honest about absence. Say "No diagnosis recorded on this claim." rather than returning an empty object the model might misread.
  • Says which view it used. A tool whose output depends on a choice (which entries it searched, which dates it covers, which date a clock runs from, why something was not scored) says so in a why string, and takes an argument for the other view. See below.
  • Errors are results. runTool catches a throw and returns Tool failed: <message> with isError, which the model can read and work around.

Figures reach the model formatted​

Given raw numbers (27800, 0.31, 2026-07-22), a model formats them inconsistently and sometimes wrongly. So runTool presents every result before the model sees it (api/src/capabilities/present.ts), with the same helpers the claim screen uses (packages/shared/src/format.ts):

In the tool's JSONThe model sees
Money, e.g. amount: 27800"£27,800" in the claim's currency and the reader's locale
An ISO date anywhere"22/07/2026" (en-GB) or "07/22/2026" (en-US)
A rate held as a fraction, e.g. lurkRate: 0.31"31%"
A percentage, e.g. discountPct: 28"28%"
A multiple, e.g. revivalMultiple: 14"14×"
A count, days or a scorethe number, unchanged

Numbers are classified by key. Keys that mean money everywhere (the Claim's money fields, and computed amounts such as estimatedSaving) are listed in present.ts. A tool that reuses a generic key for money declares it, so the same key elsewhere is left alone:

const financialSummary: ChatTool = {
present: { money: ['total'], moneyMaps: ['paymentsByStatus'] },
// …
};

moneyMaps is for maps keyed by a name, such as spend by provider. present.test.ts runs every tool on four claims and fails on any unformatted date, or any number under a key not known to be a count, so a new money field cannot reach the model raw. Formatted figures also let the figure check match an answer against what the tools returned.

Tests call tool.run directly and see the plain numbers.

Personal data stays behind​

Tools may return whole claim sections, contact details included: the egress check withholds those fields before anything reaches the model. Where a tool needs a personal value to do its work, it computes from it and hands over the result instead; the lurk assessment gives the claimant's age at the loss, not the date of birth.

Shared tools and capability tools​

Six shared tools are the general readers, always first in the list: get_claim_section, search_claim, get_document, financial_summary, get_claim_alerts, and the screen action highlight_panel.

The capability tools do the work a model should not do in its head: build_timeline, money_timeline, claim_metrics, check_policy_in_force, list_deadlines, settlement_position, indemnity_savings_sweep, scan_psych_signals, run_risk_cross_checks, scan_vulnerability_signals, scan_expressions_of_dissatisfaction, run_handling_checks, opponent_intelligence, lurk_assessment, get_party, supplier_instructions and list_capabilities.

Every tool is offered on every turn, deduplicated by name. A capability "owns" a tool in the sense that its playbook tells the model to call it first; the model can still use any tool in any task. The tools reference lists every one with its parameters.

Tools say which view they used​

A tool that silently picks a default leads the model to tell the handler something cannot be done when it can: a search that found nothing because it needed every word, a deadline list that left out what was done, a lurk score of nothing on a claim that was never scored. So a tool whose output depends on a choice returns a short why naming the choice and the argument that gets the alternative, and system.base tells the model to read it before saying something cannot be done.

ToolThe choice it namesThe argument for the other view
search_claimWhich sections it searched; every word or any; how many matched beyond the first 25match: "any", sections
build_timeline, money_timelineThe dates coveredfrom, to
money_timelineReserve movements come from diary entries (the record holds only the current reserve); which payments the running total countssearch_claim for other wording
list_deadlinesCompleted tasks and met deadlines left out; what the next reserve review is counted fromincludeCompleted
settlement_positionOffers are found by wordingsearch_claim for other wording
scan_expressions_of_dissatisfactionWhich date the complaint clocks run fromclockFrom: "logged_complaint"
opponent_intelligenceWhich parties were checked against the intelligencename
get_partyWhen nothing matches, who is on the claimask again with one of those
lurk_assessmentWhy the claim was or was not scored, and what would change thatnone: the rule is the point

why.test.ts checks each one, and fails if a tool gains an optional argument without returning why.

One lookup per common question​

Each question has eight rounds, and a model that pieces an answer together from several lookups can run out of them. Where a question recurs, one tool answers it whole:

  • money_timeline: how the money moved. Reserve notes, payments with a running total paid, provider bills, recovery notes and status changes in date order, with the reserve, paid and outstanding by head now.
  • check_policy_in_force: cover. It carries the policy details, what happened and the investigation's coverage and liability position, so validating cover no longer needs four more section reads.
  • list_deadlines: what is due and overdue.

Feedback traces with three or more lookups are where to look for the next one (the Prompt Lab trace and GET /api/feedback both list them).

Screen actions​

highlight_panel returns a ClientAction instead of reading anything. The Worker forwards it to the browser as a client_action event and the browser performs it. It is flagged screenAction: true, so allTools() leaves it out unless the request says the caller can act on the screen. The panel names are the shared MATTER_PANELS list, so the tool's enum, the prompt and the data-panel anchors in the DOM cannot drift apart.

Dates​

api/src/capabilities/dates.ts holds the date arithmetic the tools share. daysBetween and addDays work on YYYY-MM-DD strings, which Date.parse reads as UTC midnight, so daylight saving cannot shift a deadline by a day. ageInYears is the one helper that reads the clock, because an age is "as of now" by definition.

Adding to them​