usas_autocomplete_recipient
Autocomplete recipient names using USAspending-canonical legal names to prevent hallucinations in searches. Returns up to 10 fuzzy matches with UEI/DUNS.
Instructions
Autocomplete recipient names. ANTI-HALLUCINATION — confirm a recipient's exact USAspending-canonical legal name before searching by name. Returns up to 10 fuzzy matches with UEI/DUNS where available.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| searchText | Yes | ||
| limit | No |
Implementation Reference
- src/usaspending.ts:835-857 (handler)The core handler function `autocompleteRecipient` that calls the USAspending API endpoint `autocomplete/recipient/` and returns fuzzy-matched recipient names with UEI/DUNS.
export async function autocompleteRecipient(args: { searchText: string; limit?: number; }) { type Resp = { results?: { recipient_name?: string; uei?: string; duns?: string; }[]; }; const json = await postUsas<Resp>("autocomplete/recipient/", { search_text: args.searchText, limit: args.limit ?? 10, }); return { recipients: (json.results ?? []).map((r) => ({ name: r.recipient_name ?? "", uei: r.uei, duns: r.duns, })), }; } - src/server.ts:188-191 (schema)The Zod schema `UsasAutocompleteInput` defining input parameters: searchText (string) and optional limit (1-20).
const UsasAutocompleteInput = z.object({ searchText: z.string(), limit: z.number().min(1).max(20).optional(), }); - src/server.ts:447-452 (registration)Registration of the tool in the tools list with name 'usas_autocomplete_recipient', description, and inputSchema reference.
{ name: "usas_autocomplete_recipient", description: "Autocomplete recipient names. ANTI-HALLUCINATION — confirm a recipient's exact USAspending-canonical legal name before searching by name. Returns up to 10 fuzzy matches with UEI/DUNS where available.", inputSchema: UsasAutocompleteInput, }, - src/server.ts:757-760 (registration)The switch-case handler that routes the tool call to `usas.autocompleteRecipient(UsasAutocompleteInput.parse(args))`.
case "usas_autocomplete_recipient": return await usas.autocompleteRecipient( UsasAutocompleteInput.parse(args), );