@cyanheads/usaspending-mcp-server 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +8 -5
- package/CLAUDE.md +8 -5
- package/README.md +34 -27
- package/changelog/0.7.x/0.7.2.md +33 -0
- package/changelog/template.md +10 -3
- package/dist/config/server-config.d.ts +13 -0
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +24 -0
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts +14 -2
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js +136 -40
- package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/count-limit.d.ts +69 -0
- package/dist/mcp-server/tools/definitions/count-limit.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/count-limit.js +87 -0
- package/dist/mcp-server/tools/definitions/count-limit.js.map +1 -0
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.js +24 -18
- package/dist/mcp-server/tools/definitions/disaster-spending.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/filters.d.ts +51 -1
- package/dist/mcp-server/tools/definitions/filters.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/filters.js +57 -1
- package/dist/mcp-server/tools/definitions/filters.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts +7 -0
- package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-agency.tool.js +85 -48
- package/dist/mcp-server/tools/definitions/get-agency.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js +14 -11
- package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js +14 -11
- package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js +17 -11
- package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award.tool.d.ts +30 -0
- package/dist/mcp-server/tools/definitions/get-award.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-award.tool.js +110 -2
- package/dist/mcp-server/tools/definitions/get-award.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js +18 -11
- package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js +18 -18
- package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts +40 -1
- package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-recipient.tool.js +184 -4
- package/dist/mcp-server/tools/definitions/get-recipient.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +234 -4
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-agencies.tool.js +2 -4
- package/dist/mcp-server/tools/definitions/list-agencies.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/locations.d.ts +20 -9
- package/dist/mcp-server/tools/definitions/locations.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/locations.js +106 -84
- package/dist/mcp-server/tools/definitions/locations.js.map +1 -1
- package/dist/mcp-server/tools/definitions/pagination.d.ts +9 -8
- package/dist/mcp-server/tools/definitions/pagination.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/pagination.js +9 -8
- package/dist/mcp-server/tools/definitions/pagination.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts +38 -3
- package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-awards.tool.js +170 -64
- package/dist/mcp-server/tools/definitions/search-awards.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js +15 -13
- package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts +5 -0
- package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-recipients.tool.js +12 -12
- package/dist/mcp-server/tools/definitions/search-recipients.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts +28 -0
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.js +78 -27
- package/dist/mcp-server/tools/definitions/spending-by-category.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts +20 -0
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js +31 -11
- package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts +20 -0
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.js +26 -3
- package/dist/mcp-server/tools/definitions/spending-over-time.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/unavailable-sections.d.ts +42 -0
- package/dist/mcp-server/tools/definitions/unavailable-sections.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/unavailable-sections.js +63 -0
- package/dist/mcp-server/tools/definitions/unavailable-sections.js.map +1 -0
- package/dist/services/usaspending/types.d.ts +88 -5
- package/dist/services/usaspending/types.d.ts.map +1 -1
- package/dist/services/usaspending/types.js +5 -1
- package/dist/services/usaspending/types.js.map +1 -1
- package/dist/services/usaspending/usaspending-service.d.ts +65 -2
- package/dist/services/usaspending/usaspending-service.d.ts.map +1 -1
- package/dist/services/usaspending/usaspending-service.js +119 -11
- package/dist/services/usaspending/usaspending-service.js.map +1 -1
- package/package.json +4 -4
- package/server.json +3 -3
- package/skills/usaspending-guide/SKILL.md +6 -4
|
@@ -1,33 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Tool to look up valid code values for filter fields: NAICS, PSC, CFDA,
|
|
3
|
-
* agency names, and
|
|
3
|
+
* agency names, recipient names, and US state, county, and congressional district codes.
|
|
4
4
|
* @module mcp-server/tools/definitions/autocomplete-filters.tool
|
|
5
5
|
*/
|
|
6
6
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
7
7
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
8
8
|
import { escapeMarkdownInline } from '@cyanheads/mcp-ts-core/utils';
|
|
9
|
+
import { LOCATION_AUTOCOMPLETE_LIMIT_MAX, } from '../../../services/usaspending/types.js';
|
|
9
10
|
import { getUSASpendingService } from '../../../services/usaspending/usaspending-service.js';
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
import { countLimit, LimitClampSchema, limitClampTrailer } from './count-limit.js';
|
|
12
|
+
import { postalForStateFips, postalForUpstreamStateName, stateFipsForPostal } from './locations.js';
|
|
13
|
+
/** Capped at the largest `limit` the code and name autocomplete routes accept; 501 is rejected with HTTP 400. */
|
|
14
|
+
const LIMIT = countLimit({ tool: 'usaspending_autocomplete_filters', default: 10, cap: 500 });
|
|
15
|
+
/** A congressional district as `autocomplete/location/` writes it: postal code, dash, two-digit district. */
|
|
16
|
+
const CURRENT_DISTRICT = /^([A-Z]{2})-(\d{2})$/;
|
|
17
|
+
/**
|
|
18
|
+
* Rows a location filter or `shape_codes` takes, in table order: states (postal code,
|
|
19
|
+
* from upstream's name), counties (5-digit FIPS code, state from its prefix), current
|
|
20
|
+
* districts (state FIPS + district number). A row whose state the postal ↔ FIPS table
|
|
21
|
+
* lacks is dropped, never guessed. `full` names each bucket that came back holding
|
|
22
|
+
* `requested` rows, so more of that kind may exist.
|
|
23
|
+
*/
|
|
24
|
+
function mapLocationBuckets(resp, requested) {
|
|
25
|
+
const states = resp.results?.states ?? [];
|
|
26
|
+
const counties = resp.results?.counties ?? [];
|
|
27
|
+
const districts = resp.results?.districts_current ?? [];
|
|
28
|
+
const rows = [
|
|
29
|
+
...states.flatMap(({ state_name: name }) => {
|
|
30
|
+
const postal = name ? postalForUpstreamStateName(name) : undefined;
|
|
31
|
+
return name && postal ? [{ kind: 'state', code: postal, name }] : [];
|
|
32
|
+
}),
|
|
33
|
+
...counties.flatMap(({ county_fips: fips, county_name: name }) => {
|
|
34
|
+
const state = fips && /^\d{5}$/.test(fips) ? postalForStateFips(fips.slice(0, 2)) : undefined;
|
|
35
|
+
return fips && state
|
|
36
|
+
? [{ kind: 'county', code: fips, ...(name ? { name } : {}), state }]
|
|
37
|
+
: [];
|
|
38
|
+
}),
|
|
39
|
+
...districts.flatMap(({ current_cd }) => {
|
|
40
|
+
const match = current_cd ? CURRENT_DISTRICT.exec(current_cd) : null;
|
|
41
|
+
const fips = match?.[1] ? stateFipsForPostal(match[1]) : undefined;
|
|
42
|
+
return match?.[1] && fips
|
|
43
|
+
? [
|
|
44
|
+
{
|
|
45
|
+
kind: 'district',
|
|
46
|
+
code: `${fips}${match[2]}`,
|
|
47
|
+
name: match[0],
|
|
48
|
+
state: match[1],
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
: [];
|
|
52
|
+
}),
|
|
53
|
+
];
|
|
54
|
+
const buckets = [
|
|
55
|
+
['state', states],
|
|
56
|
+
['county', counties],
|
|
57
|
+
['district', districts],
|
|
58
|
+
];
|
|
59
|
+
const full = buckets.filter(([, bucket]) => bucket.length >= requested).map(([kind]) => kind);
|
|
60
|
+
return { rows, full };
|
|
61
|
+
}
|
|
12
62
|
export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters', {
|
|
13
63
|
title: 'Autocomplete Codes and Names',
|
|
14
|
-
description: 'Look up valid code values for filter fields by searching free-text descriptions. Use the type parameter to select the lookup table: naics (NAICS industry codes), psc (product/service codes), cfda (CFDA/Assistance Listing program numbers), awarding_agency (agency and sub-agency names, each with its tier and top-tier parent — agency_name filters take the matched name; a sub-tier name shared by several parents matches under all parents),
|
|
64
|
+
description: 'Look up valid code values for filter fields by searching free-text descriptions. Use the type parameter to select the lookup table: naics (NAICS industry codes), psc (product/service codes), cfda (CFDA/Assistance Listing program numbers), awarding_agency (agency and sub-agency names, each with its tier and top-tier parent — agency_name filters take the matched name; a sub-tier name shared by several parents matches under all parents), recipient (recipient names with UEI/DUNS), or location (US state, county, and congressional district names, resolved to the codes the location filters and usaspending_spending_by_geography shape_codes take). Call this before filtering awards when you know a description but not the exact code. Returns matching codes and names for use in other tool filters.',
|
|
15
65
|
annotations: { readOnlyHint: true, openWorldHint: true, idempotentHint: true },
|
|
16
66
|
input: z.object({
|
|
17
67
|
type: z
|
|
18
|
-
.enum(['naics', 'psc', 'cfda', 'awarding_agency', 'recipient'])
|
|
19
|
-
.describe('Lookup table to search: naics (industry codes), psc (product/service codes, for the psc_codes filter), cfda (Assistance Listing program numbers, for the assistance_listings filter), awarding_agency (agency and sub-agency names), recipient (recipient names).
|
|
68
|
+
.enum(['naics', 'psc', 'cfda', 'awarding_agency', 'recipient', 'location'])
|
|
69
|
+
.describe('Lookup table to search: naics (industry codes), psc (product/service codes, for the psc_codes filter), cfda (Assistance Listing program numbers, for the assistance_listings filter), awarding_agency (agency and sub-agency names), recipient (recipient names), location (US states with DC and the territories, counties, and current congressional districts, matched from the start of their name: "King County", "Santa Fe", "WA-07"; countries, cities, and ZIP codes are not returned). The psc_codes and assistance_listings filters are taken by usaspending_search_awards and by the filters object of usaspending_spending_by_category, usaspending_spending_by_geography, and usaspending_spending_over_time.'),
|
|
20
70
|
search_text: z
|
|
21
71
|
.string()
|
|
22
72
|
.min(1)
|
|
23
73
|
.describe('Free-text search string — use a description, keyword, or partial code to find matches'),
|
|
24
|
-
limit:
|
|
25
|
-
.number()
|
|
26
|
-
.int()
|
|
27
|
-
.min(1)
|
|
28
|
-
.max(UPSTREAM_LIMIT_MAX)
|
|
29
|
-
.default(10)
|
|
30
|
-
.describe('Maximum number of results to return (1–500), enforced client-side. Agency matches combine independently capped top-tier then sub-tier buckets, preserving their order without deduplicating names; offices are excluded. The recipient lookup unions three upstream match buckets (name, UEI, DUNS) and can return up to 3x this value, so its results are capped to this limit before returning — the cap keeps them in bucket order, so name matches fill the page first and identifier matches appear only in whatever room is left. To resolve a specific UEI or DUNS, pass the identifier itself as search_text. Every lookup returns at most limit rows.'),
|
|
74
|
+
limit: LIMIT.schema.describe('Maximum number of results to return. Default 10, at most 500 per call. Agency matches combine independently capped top-tier then sub-tier buckets, preserving their order without deduplicating names; offices are excluded. Location matches combine state, then county, then district rows, and upstream returns at most 100 of each kind. The recipient lookup unions three upstream match buckets (name, UEI, DUNS) and can return up to 3x this value, so its results are capped to this limit before returning — the cap keeps them in bucket order, so name matches fill the page first and identifier matches appear only in whatever room is left. To resolve a specific UEI or DUNS, pass the identifier itself as search_text. Every lookup returns at most limit rows.'),
|
|
31
75
|
}),
|
|
32
76
|
output: z.object({
|
|
33
77
|
type: z.string().describe('Lookup table searched'),
|
|
@@ -35,14 +79,22 @@ export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters',
|
|
|
35
79
|
results: z
|
|
36
80
|
.array(z
|
|
37
81
|
.object({
|
|
82
|
+
kind: z
|
|
83
|
+
.enum(['state', 'county', 'district'])
|
|
84
|
+
.optional()
|
|
85
|
+
.describe('location only: what the row names — a US state, DC, or territory; a county; or a current congressional district'),
|
|
38
86
|
code: z
|
|
39
87
|
.string()
|
|
40
88
|
.optional()
|
|
41
|
-
.describe(
|
|
89
|
+
.describe("Code value (NAICS code, PSC code, Assistance Listing/CFDA number, or location code); use this in filter parameters — an Assistance Listing number goes in usaspending_search_awards assistance_listings. A location row's code by kind: state, the 2-letter postal code for a location filter's state and state shape_codes; county, the 5-digit state + county FIPS code for a location filter's county and county shape_codes; district, the 4-digit state FIPS + district number for district shape_codes on usaspending_spending_by_geography. Agency rows carry toptier_code instead."),
|
|
42
90
|
name: z
|
|
43
91
|
.string()
|
|
44
92
|
.optional()
|
|
45
|
-
.describe("Human-readable name or description; for awarding_agency, the matched agency's own name, which for a sub-agency differs from toptier_name"),
|
|
93
|
+
.describe("Human-readable name or description; for awarding_agency, the matched agency's own name, which for a sub-agency differs from toptier_name; for location, upstream's uppercase name (WASHINGTON, KING, WA-07)"),
|
|
94
|
+
state: z
|
|
95
|
+
.string()
|
|
96
|
+
.optional()
|
|
97
|
+
.describe('location only: the 2-letter postal code of the state a county or district lies in'),
|
|
46
98
|
abbreviation: z
|
|
47
99
|
.string()
|
|
48
100
|
.optional()
|
|
@@ -72,7 +124,7 @@ export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters',
|
|
|
72
124
|
.optional()
|
|
73
125
|
.describe('DUNS number (legacy) — recipient type only; populated when the search text matches a DUNS'),
|
|
74
126
|
})
|
|
75
|
-
.describe('Matched entry — code/name for code lookups, name with tier and top-tier parent for agencies, name plus optional UEI/DUNS for recipients'))
|
|
127
|
+
.describe('Matched entry — code/name for code lookups, name with tier and top-tier parent for agencies, name plus optional UEI/DUNS for recipients, kind/code/name plus state for locations'))
|
|
76
128
|
.describe('Matching codes and names'),
|
|
77
129
|
total: z.number().describe('Number of results returned'),
|
|
78
130
|
}),
|
|
@@ -89,19 +141,21 @@ export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters',
|
|
|
89
141
|
.describe('True when more matches exist beyond the limit and were left out. Absent when every match was returned.'),
|
|
90
142
|
shown: z.number().optional().describe('Number of results returned, when truncated.'),
|
|
91
143
|
cap: z.number().optional().describe('The limit that was applied, when truncated.'),
|
|
144
|
+
limitClamp: LimitClampSchema,
|
|
92
145
|
notice: z
|
|
93
146
|
.string()
|
|
94
147
|
.optional()
|
|
95
|
-
.describe('
|
|
148
|
+
.describe('A reduced limit; how to reach the matches left out when truncated; and that an upstream maximum was reached so more matches may exist — all 500 slots filled at limit 500, or 100 rows of one location kind. Absent when none applies.'),
|
|
96
149
|
},
|
|
97
150
|
enrichmentTrailer: {
|
|
151
|
+
limitClamp: limitClampTrailer,
|
|
98
152
|
notice: { render: (notice) => (notice ? `> ${escapeMarkdownInline(notice)}` : '') },
|
|
99
153
|
},
|
|
100
154
|
errors: [
|
|
101
155
|
{
|
|
102
156
|
reason: 'no_match',
|
|
103
157
|
code: JsonRpcErrorCode.NotFound,
|
|
104
|
-
when: 'No codes or names matched the search text.',
|
|
158
|
+
when: 'No codes or names matched the search text; for location, no US state, county, or congressional district did.',
|
|
105
159
|
recovery: 'Try a broader search term, different spelling, or shorter keyword fragment.',
|
|
106
160
|
},
|
|
107
161
|
{
|
|
@@ -126,15 +180,26 @@ export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters',
|
|
|
126
180
|
type: input.type,
|
|
127
181
|
search_text: input.search_text,
|
|
128
182
|
});
|
|
183
|
+
const limit = LIMIT.apply(ctx, 'limit', input.limit);
|
|
184
|
+
const notices = limit.notice ? [limit.notice] : [];
|
|
129
185
|
const svc = getUSASpendingService();
|
|
130
186
|
let rawResults = [];
|
|
187
|
+
/** Location buckets that came back holding `requested` rows: more of that kind may exist. */
|
|
188
|
+
let fullLocationKinds = [];
|
|
131
189
|
/**
|
|
132
190
|
* One row past `limit` tells a capped list from one that exactly fills the page. Every
|
|
133
|
-
*
|
|
134
|
-
*
|
|
191
|
+
* code and name route rejects `limit` above 500 with HTTP 400, and the location route
|
|
192
|
+
* fails above 100, so at that ceiling there is no room for the extra row and a full
|
|
193
|
+
* page or bucket can only say the ceiling was reached.
|
|
135
194
|
*/
|
|
136
|
-
const requested = Math.min(
|
|
137
|
-
if (input.type === '
|
|
195
|
+
const requested = Math.min(limit.applied + 1, input.type === 'location' ? LOCATION_AUTOCOMPLETE_LIMIT_MAX : LIMIT.cap);
|
|
196
|
+
if (input.type === 'location') {
|
|
197
|
+
const resp = await svc.autocompleteLocation(input.search_text, requested, ctx);
|
|
198
|
+
const mapped = mapLocationBuckets(resp, requested);
|
|
199
|
+
rawResults = mapped.rows;
|
|
200
|
+
fullLocationKinds = mapped.full;
|
|
201
|
+
}
|
|
202
|
+
else if (input.type === 'naics') {
|
|
138
203
|
const resp = await svc.autocompleteNaics(input.search_text, requested, ctx);
|
|
139
204
|
rawResults = (resp.results ?? []).map((r) => ({
|
|
140
205
|
...(r.naics ? { code: r.naics } : {}),
|
|
@@ -189,11 +254,19 @@ export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters',
|
|
|
189
254
|
/**
|
|
190
255
|
* `autocomplete/recipient/` applies `limit` per match bucket (name, UEI, DUNS) and
|
|
191
256
|
* unions them. Agency autocomplete caps each tier independently; omit offices and
|
|
192
|
-
* union top-tier then sub-tier rows.
|
|
257
|
+
* union top-tier then sub-tier rows. Location autocomplete caps each kind; union
|
|
258
|
+
* states, counties, then districts. Judge truncation on the relevant bucket union
|
|
193
259
|
* before the combined caller slice to `limit`.
|
|
194
260
|
*/
|
|
195
261
|
const received = rawResults.length;
|
|
196
|
-
rawResults = rawResults.slice(0,
|
|
262
|
+
rawResults = rawResults.slice(0, limit.applied);
|
|
263
|
+
if (rawResults.length === 0 && input.type === 'location') {
|
|
264
|
+
throw ctx.fail('no_match', `No US state, county, or congressional district matched "${input.search_text}"`, {
|
|
265
|
+
recovery: {
|
|
266
|
+
hint: `The location lookup resolves US states, counties, and congressional districts only, not countries, cities, or ZIP codes. Names match from their start: search "King County", "District of Columbia", or "WA-07", or check the spelling.`,
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
}
|
|
197
270
|
if (rawResults.length === 0) {
|
|
198
271
|
throw ctx.fail('no_match', `No ${input.type} results matched "${input.search_text}"`, {
|
|
199
272
|
recovery: {
|
|
@@ -206,27 +279,46 @@ export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters',
|
|
|
206
279
|
query: input.search_text,
|
|
207
280
|
result_count: rawResults.length,
|
|
208
281
|
});
|
|
209
|
-
const narrow =
|
|
210
|
-
? `Raise limit (max ${
|
|
282
|
+
const narrow = limit.applied < LIMIT.cap
|
|
283
|
+
? `Raise limit (max ${LIMIT.cap}) or use a more specific search term.`
|
|
211
284
|
: 'Use a more specific search term.';
|
|
212
|
-
|
|
285
|
+
/**
|
|
286
|
+
* A location bucket holding the probe row proves more matches of its kind even when
|
|
287
|
+
* rows dropped for an unmapped state leave fewer than `limit` kept. A bucket that
|
|
288
|
+
* filled the 100-row ceiling without a probe row can only say the ceiling was reached.
|
|
289
|
+
*/
|
|
290
|
+
const truncated = received > limit.applied || (requested > limit.applied && fullLocationKinds.length > 0);
|
|
291
|
+
const kindsAtCeiling = requested <= limit.applied ? fullLocationKinds : [];
|
|
292
|
+
if (truncated) {
|
|
293
|
+
/**
|
|
294
|
+
* The recipient cap is a head-slice over name-then-UEI-then-DUNS, and upstream
|
|
295
|
+
* fills the name bucket to the requested size on its own whenever the corpus
|
|
296
|
+
* allows. So a saturated recipient page holds name matches only, and raising
|
|
297
|
+
* `limit` raises the name bucket with it — it never reaches the identifier buckets
|
|
298
|
+
* behind it. Pointing that caller at `limit` alone would misdirect them.
|
|
299
|
+
*/
|
|
300
|
+
notices.push(input.type === 'recipient'
|
|
301
|
+
? `More matches exist beyond limit. ${narrow} Matches on a UEI or DUNS are not reachable this way once name matches fill the page; to resolve one, pass the identifier itself as search_text.`
|
|
302
|
+
: `More matches exist beyond limit. ${narrow}`);
|
|
303
|
+
}
|
|
304
|
+
else if (input.type !== 'location' &&
|
|
305
|
+
requested === limit.applied &&
|
|
306
|
+
received === limit.applied) {
|
|
307
|
+
notices.push(`Returned the upstream maximum of ${LIMIT.cap} matches, so more may exist. ${narrow}`);
|
|
308
|
+
}
|
|
309
|
+
if (kindsAtCeiling.length > 0) {
|
|
310
|
+
notices.push(`Upstream returns at most ${LOCATION_AUTOCOMPLETE_LIMIT_MAX} location matches of each kind, and the ${kindsAtCeiling.join(' and ')} matches reached it, so more may exist. Use a more specific search term.`);
|
|
311
|
+
}
|
|
312
|
+
// `notice` is last-wins and `truncated({ guidance })` writes it too, so every sentence joins into one write.
|
|
313
|
+
if (truncated) {
|
|
213
314
|
ctx.enrich.truncated({
|
|
214
315
|
shown: rawResults.length,
|
|
215
|
-
cap:
|
|
216
|
-
|
|
217
|
-
* The recipient cap is a head-slice over name-then-UEI-then-DUNS, and upstream
|
|
218
|
-
* fills the name bucket to the requested size on its own whenever the corpus
|
|
219
|
-
* allows. So a saturated recipient page holds name matches only, and raising
|
|
220
|
-
* `limit` raises the name bucket with it — it never reaches the identifier buckets
|
|
221
|
-
* behind it. Pointing that caller at `limit` alone would misdirect them.
|
|
222
|
-
*/
|
|
223
|
-
guidance: input.type === 'recipient'
|
|
224
|
-
? `More matches exist beyond limit. ${narrow} Matches on a UEI or DUNS are not reachable this way once name matches fill the page; to resolve one, pass the identifier itself as search_text.`
|
|
225
|
-
: `More matches exist beyond limit. ${narrow}`,
|
|
316
|
+
cap: limit.applied,
|
|
317
|
+
guidance: notices.join(' '),
|
|
226
318
|
});
|
|
227
319
|
}
|
|
228
|
-
else if (
|
|
229
|
-
ctx.enrich.notice(
|
|
320
|
+
else if (notices.length) {
|
|
321
|
+
ctx.enrich.notice(notices.join(' '));
|
|
230
322
|
}
|
|
231
323
|
return {
|
|
232
324
|
type: input.type,
|
|
@@ -242,10 +334,14 @@ export const autocompleteFiltersTool = tool('usaspending_autocomplete_filters',
|
|
|
242
334
|
];
|
|
243
335
|
for (const r of result.results) {
|
|
244
336
|
const parts = [];
|
|
337
|
+
if (r.kind)
|
|
338
|
+
parts.push(`**Kind:** ${escapeMarkdownInline(r.kind)}`);
|
|
245
339
|
if (r.code)
|
|
246
340
|
parts.push(`**Code:** ${escapeMarkdownInline(r.code)}`);
|
|
247
341
|
if (r.name)
|
|
248
342
|
parts.push(`**Name:** ${escapeMarkdownInline(r.name)}${r.abbreviation ? ` (${escapeMarkdownInline(r.abbreviation)})` : ''}`);
|
|
343
|
+
if (r.state)
|
|
344
|
+
parts.push(`**State:** ${escapeMarkdownInline(r.state)}`);
|
|
249
345
|
if (r.tier)
|
|
250
346
|
parts.push(`**Tier:** ${escapeMarkdownInline(r.tier)}`);
|
|
251
347
|
if (r.toptier_name)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-filters.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/autocomplete-filters.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,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IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Result-count inputs (`limit`) and their per-call caps. With
|
|
3
|
+
* USASPENDING_CLAMP_LIMITS on (the default), a capped count input advertises no
|
|
4
|
+
* `maximum`, and a larger value is reduced to the cap: disclosed as the `limitClamp`
|
|
5
|
+
* enrichment plus a notice sentence, with one log record and one counter increment.
|
|
6
|
+
* Off, the cap is the advertised `maximum` and a larger value is rejected. The shape
|
|
7
|
+
* follows the framework helper planned in cyanheads/mcp-ts-core#796
|
|
8
|
+
* (`countLimit({ default, cap })` → `.schema` + `.apply(ctx, field, value)`), so
|
|
9
|
+
* adopting it later renames nothing on the wire.
|
|
10
|
+
* @module mcp-server/tools/definitions/count-limit
|
|
11
|
+
*/
|
|
12
|
+
import { type Context, z } from '@cyanheads/mcp-ts-core';
|
|
13
|
+
/**
|
|
14
|
+
* A positive integer count with no advertised `maximum`, for a count input that has
|
|
15
|
+
* no per-call cap. `.int()` alone emits Zod's safe-integer bound
|
|
16
|
+
* (`maximum: 9007199254740991`); the `maximum: undefined` metadata drops it from the
|
|
17
|
+
* emitted JSON Schema while the safe-integer check still runs.
|
|
18
|
+
*/
|
|
19
|
+
export declare function countInput(): z.ZodNumber;
|
|
20
|
+
/** The `limitClamp` enrichment field. Declare it in each clamping tool's `enrichment` block. */
|
|
21
|
+
export declare const LimitClampSchema: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
field: z.ZodString;
|
|
23
|
+
requested: z.ZodNumber;
|
|
24
|
+
applied: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
export type LimitClamp = NonNullable<z.infer<typeof LimitClampSchema>>;
|
|
27
|
+
/** The `limitClamp` entry for a clamping tool's `enrichmentTrailer`. */
|
|
28
|
+
export declare const limitClampTrailer: {
|
|
29
|
+
render: (clamp: LimitClamp | undefined) => string;
|
|
30
|
+
};
|
|
31
|
+
/** What {@link CountLimit.apply} decided for one call. */
|
|
32
|
+
export interface AppliedCount {
|
|
33
|
+
/** The value the call uses: the caller's, or the cap a larger one was reduced to. */
|
|
34
|
+
applied: number;
|
|
35
|
+
/**
|
|
36
|
+
* The clamp sentence, present only when the value was reduced. `ctx.enrich.notice()`
|
|
37
|
+
* is last-wins, so the tool joins it with its other notices into one call.
|
|
38
|
+
*/
|
|
39
|
+
notice?: string;
|
|
40
|
+
}
|
|
41
|
+
/** A capped count input: its schema, its cap, and the per-call clamp. */
|
|
42
|
+
export interface CountLimit {
|
|
43
|
+
/**
|
|
44
|
+
* The value a call uses. Over the cap (reachable only while clamping), returns the
|
|
45
|
+
* cap and the clamp sentence, writes `limitClamp` through `ctx.enrich`, logs one
|
|
46
|
+
* record, and adds 1 to `usaspending.limit.clamped`.
|
|
47
|
+
*/
|
|
48
|
+
apply(ctx: Context, field: string, value: number): AppliedCount;
|
|
49
|
+
/** The per-call cap. */
|
|
50
|
+
readonly cap: number;
|
|
51
|
+
/**
|
|
52
|
+
* Integer, minimum 1, defaulted. Its `maximum` and the strict `too_big` check follow
|
|
53
|
+
* the switch, read on every parse and every `tools/list` emission, so nothing is read
|
|
54
|
+
* at import. Add the tool's `.describe()`, worded true in both switch states.
|
|
55
|
+
*/
|
|
56
|
+
readonly schema: ReturnType<typeof capped>;
|
|
57
|
+
}
|
|
58
|
+
declare function capped(defaultValue: number, cap: number): z.ZodDefault<z.ZodNumber>;
|
|
59
|
+
/**
|
|
60
|
+
* Builds a capped count input for one tool.
|
|
61
|
+
* @throws {Error} At definition time when `default` exceeds `cap`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function countLimit(options: {
|
|
64
|
+
cap: number;
|
|
65
|
+
default: number;
|
|
66
|
+
tool: string;
|
|
67
|
+
}): CountLimit;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=count-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count-limit.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/count-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAWzD;;;;;GAKG;AACH,wBAAgB,UAAU,gBAEzB;AAED,gGAAgG;AAChG,eAAO,MAAM,gBAAgB;;;;kBAO2D,CAAC;AAEzF,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;AAEvE,wEAAwE;AACxE,eAAO,MAAM,iBAAiB;IAC5B,MAAM,UAAU,UAAU,GAAG,SAAS;CAIvC,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;IAChE,wBAAwB;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;CAC5C;AAED,iBAAS,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,6BAmBhD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAoB9F"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Result-count inputs (`limit`) and their per-call caps. With
|
|
3
|
+
* USASPENDING_CLAMP_LIMITS on (the default), a capped count input advertises no
|
|
4
|
+
* `maximum`, and a larger value is reduced to the cap: disclosed as the `limitClamp`
|
|
5
|
+
* enrichment plus a notice sentence, with one log record and one counter increment.
|
|
6
|
+
* Off, the cap is the advertised `maximum` and a larger value is rejected. The shape
|
|
7
|
+
* follows the framework helper planned in cyanheads/mcp-ts-core#796
|
|
8
|
+
* (`countLimit({ default, cap })` → `.schema` + `.apply(ctx, field, value)`), so
|
|
9
|
+
* adopting it later renames nothing on the wire.
|
|
10
|
+
* @module mcp-server/tools/definitions/count-limit
|
|
11
|
+
*/
|
|
12
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
13
|
+
import { ATTR_MCP_TOOL_NAME, createCounter } from '@cyanheads/mcp-ts-core/utils';
|
|
14
|
+
import { clampLimitsEnabled } from '../../../config/server-config.js';
|
|
15
|
+
/** Every count input reduced to its cap, attributed by tool and input name. */
|
|
16
|
+
const limitClamps = createCounter('usaspending.limit.clamped', 'Result-count inputs above their per-call cap, reduced to the cap', '{clamp}');
|
|
17
|
+
/**
|
|
18
|
+
* A positive integer count with no advertised `maximum`, for a count input that has
|
|
19
|
+
* no per-call cap. `.int()` alone emits Zod's safe-integer bound
|
|
20
|
+
* (`maximum: 9007199254740991`); the `maximum: undefined` metadata drops it from the
|
|
21
|
+
* emitted JSON Schema while the safe-integer check still runs.
|
|
22
|
+
*/
|
|
23
|
+
export function countInput() {
|
|
24
|
+
return z.number().int().min(1).meta({ maximum: undefined });
|
|
25
|
+
}
|
|
26
|
+
/** The `limitClamp` enrichment field. Declare it in each clamping tool's `enrichment` block. */
|
|
27
|
+
export const LimitClampSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
field: z.string().describe('Input that was reduced (e.g., limit)'),
|
|
30
|
+
requested: z.number().describe('Value the caller sent'),
|
|
31
|
+
applied: z.number().describe('Value the call used: the per-call cap'),
|
|
32
|
+
})
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Present when a count input above its per-call cap was reduced to the cap.');
|
|
35
|
+
/** The `limitClamp` entry for a clamping tool's `enrichmentTrailer`. */
|
|
36
|
+
export const limitClampTrailer = {
|
|
37
|
+
render: (clamp) => clamp
|
|
38
|
+
? `**Limit clamp:** \`${clamp.field}\` requested ${clamp.requested}, applied ${clamp.applied}`
|
|
39
|
+
: '',
|
|
40
|
+
};
|
|
41
|
+
function capped(defaultValue, cap) {
|
|
42
|
+
return countInput()
|
|
43
|
+
.check((payload) => {
|
|
44
|
+
if (payload.value > cap && !clampLimitsEnabled()) {
|
|
45
|
+
payload.issues.push({
|
|
46
|
+
code: 'too_big',
|
|
47
|
+
origin: 'number',
|
|
48
|
+
maximum: cap,
|
|
49
|
+
inclusive: true,
|
|
50
|
+
input: payload.value,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
.default(defaultValue)
|
|
55
|
+
.meta({
|
|
56
|
+
get maximum() {
|
|
57
|
+
return clampLimitsEnabled() ? undefined : cap;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Builds a capped count input for one tool.
|
|
63
|
+
* @throws {Error} At definition time when `default` exceeds `cap`.
|
|
64
|
+
*/
|
|
65
|
+
export function countLimit(options) {
|
|
66
|
+
const { cap, tool } = options;
|
|
67
|
+
if (options.default > cap) {
|
|
68
|
+
throw new Error(`countLimit for ${tool}: default ${options.default} exceeds cap ${cap}`);
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
cap,
|
|
72
|
+
schema: capped(options.default, cap),
|
|
73
|
+
apply(ctx, field, value) {
|
|
74
|
+
if (value <= cap)
|
|
75
|
+
return { applied: value };
|
|
76
|
+
const limitClamp = { field, requested: value, applied: cap };
|
|
77
|
+
ctx.log.info('Clamped a count input to its per-call cap', { tool, ...limitClamp });
|
|
78
|
+
limitClamps.add(1, { [ATTR_MCP_TOOL_NAME]: tool, 'usaspending.count_input': field });
|
|
79
|
+
ctx.enrich({ limitClamp });
|
|
80
|
+
return {
|
|
81
|
+
applied: cap,
|
|
82
|
+
notice: `${field} ${value} exceeds the per-call maximum of ${cap}; this call used ${field} ${cap}.`,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=count-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count-limit.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/count-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAgB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,+EAA+E;AAC/E,MAAM,WAAW,GAAG,aAAa,CAC/B,2BAA2B,EAC3B,kEAAkE,EAClE,SAAS,CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,gGAAgG;AAChG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAClE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACvD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;CACtE,CAAC;KACD,QAAQ,EAAE;KACV,QAAQ,CAAC,2EAA2E,CAAC,CAAC;AAIzF,wEAAwE;AACxE,MAAM,CAAC,MAAM,iBAAiB,GAA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AI,GAAG;gBAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YAC5C,MAAM,UAAU,GAAe,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;YACzE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,2CAA2C,EAAE,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;YACnF,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,yBAAyB,EAAE,KAAK,EAAE,CAAC,CAAC;YACrF,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YAC3B,OAAO;gBACL,OAAO,EAAE,GAAG;gBACZ,MAAM,EAAE,GAAG,KAAK,IAAI,KAAK,oCAAoC,GAAG,oBAAoB,KAAK,IAAI,GAAG,GAAG;aACpG,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -114,6 +114,11 @@ export declare const disasterSpendingTool: import("@cyanheads/mcp-ts-core").Tool
|
|
|
114
114
|
readonly shown: z.ZodOptional<z.ZodNumber>;
|
|
115
115
|
readonly cap: z.ZodOptional<z.ZodNumber>;
|
|
116
116
|
readonly truncationCeiling: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
readonly limitClamp: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
field: z.ZodString;
|
|
119
|
+
requested: z.ZodNumber;
|
|
120
|
+
applied: z.ZodNumber;
|
|
121
|
+
}, z.core.$strip>>;
|
|
117
122
|
readonly notice: z.ZodOptional<z.ZodString>;
|
|
118
123
|
}>;
|
|
119
124
|
//# sourceMappingURL=disaster-spending.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disaster-spending.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/disaster-spending.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"disaster-spending.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/disaster-spending.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAmGjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4mB/B,CAAC"}
|