@cyanheads/usaspending-mcp-server 0.4.5 → 0.5.0

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.
Files changed (67) hide show
  1. package/AGENTS.md +3 -3
  2. package/CLAUDE.md +3 -3
  3. package/Dockerfile +3 -3
  4. package/README.md +30 -24
  5. package/changelog/0.5.x/0.5.0.md +50 -0
  6. package/dist/config/server-config.d.ts.map +1 -1
  7. package/dist/config/server-config.js +3 -3
  8. package/dist/config/server-config.js.map +1 -1
  9. package/dist/index.js +1 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts +8 -1
  12. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts.map +1 -1
  13. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js +94 -35
  14. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js.map +1 -1
  15. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts +2 -1
  16. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js +60 -26
  18. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js.map +1 -1
  19. package/dist/mcp-server/tools/definitions/filters.d.ts +73 -4
  20. package/dist/mcp-server/tools/definitions/filters.d.ts.map +1 -1
  21. package/dist/mcp-server/tools/definitions/filters.js +138 -4
  22. package/dist/mcp-server/tools/definitions/filters.js.map +1 -1
  23. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts +22 -3
  24. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts.map +1 -1
  25. package/dist/mcp-server/tools/definitions/get-agency.tool.js +166 -29
  26. package/dist/mcp-server/tools/definitions/get-agency.tool.js.map +1 -1
  27. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts +8 -3
  28. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts.map +1 -1
  29. package/dist/mcp-server/tools/definitions/get-award.tool.js +148 -139
  30. package/dist/mcp-server/tools/definitions/get-award.tool.js.map +1 -1
  31. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts.map +1 -1
  32. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js +14 -12
  33. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js.map +1 -1
  34. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts +2 -8
  35. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts.map +1 -1
  36. package/dist/mcp-server/tools/definitions/get-recipient.tool.js +28 -28
  37. package/dist/mcp-server/tools/definitions/get-recipient.tool.js.map +1 -1
  38. package/dist/mcp-server/tools/definitions/index.d.ts +130 -28
  39. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  40. package/dist/mcp-server/tools/definitions/locations.d.ts +45 -0
  41. package/dist/mcp-server/tools/definitions/locations.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/locations.js +206 -0
  43. package/dist/mcp-server/tools/definitions/locations.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts +28 -8
  45. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts.map +1 -1
  46. package/dist/mcp-server/tools/definitions/search-awards.tool.js +107 -79
  47. package/dist/mcp-server/tools/definitions/search-awards.tool.js.map +1 -1
  48. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts +21 -2
  49. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts.map +1 -1
  50. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js +77 -12
  51. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js.map +1 -1
  52. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts +21 -2
  53. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts.map +1 -1
  54. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js +93 -20
  55. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js.map +1 -1
  56. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts +19 -1
  57. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts.map +1 -1
  58. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js +60 -12
  59. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js.map +1 -1
  60. package/dist/services/usaspending/types.d.ts +24 -16
  61. package/dist/services/usaspending/types.d.ts.map +1 -1
  62. package/dist/services/usaspending/usaspending-service.d.ts +45 -27
  63. package/dist/services/usaspending/usaspending-service.d.ts.map +1 -1
  64. package/dist/services/usaspending/usaspending-service.js +93 -53
  65. package/dist/services/usaspending/usaspending-service.js.map +1 -1
  66. package/package.json +5 -5
  67. package/server.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/locations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AA8G3C,mEAAmE;AACnE,eAAO,MAAM,oBAAoB;;;;;mBAuB9B,CAAC;AAEJ,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GAChD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC;AAInC;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,GAAG,kBAAkB,CA0FhG;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAI/D"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * @fileoverview Location inputs for `usaspending_search_awards`: the advertised
3
+ * code schemas, the US state/territory postal ↔ FIPS table, and resolution of a
4
+ * caller's location into the shape `search/spending_by_award/` matches.
5
+ * @module mcp-server/tools/definitions/locations
6
+ */
7
+ import { z } from '@cyanheads/mcp-ts-core';
8
+ /**
9
+ * Two-digit FIPS code of every place with one that a US `state` can name: the
10
+ * 50 states, DC, the five inhabited territories, the freely associated states
11
+ * (FM, MH, PW), and the U.S. Minor Outlying Islands (UM). Upstream records
12
+ * each as a state under country USA.
13
+ */
14
+ const STATE_FIPS = {
15
+ AL: '01',
16
+ AK: '02',
17
+ AZ: '04',
18
+ AR: '05',
19
+ CA: '06',
20
+ CO: '08',
21
+ CT: '09',
22
+ DE: '10',
23
+ DC: '11',
24
+ FL: '12',
25
+ GA: '13',
26
+ HI: '15',
27
+ ID: '16',
28
+ IL: '17',
29
+ IN: '18',
30
+ IA: '19',
31
+ KS: '20',
32
+ KY: '21',
33
+ LA: '22',
34
+ ME: '23',
35
+ MD: '24',
36
+ MA: '25',
37
+ MI: '26',
38
+ MN: '27',
39
+ MS: '28',
40
+ MO: '29',
41
+ MT: '30',
42
+ NE: '31',
43
+ NV: '32',
44
+ NH: '33',
45
+ NJ: '34',
46
+ NM: '35',
47
+ NY: '36',
48
+ NC: '37',
49
+ ND: '38',
50
+ OH: '39',
51
+ OK: '40',
52
+ OR: '41',
53
+ PA: '42',
54
+ RI: '44',
55
+ SC: '45',
56
+ SD: '46',
57
+ TN: '47',
58
+ TX: '48',
59
+ UT: '49',
60
+ VT: '50',
61
+ VA: '51',
62
+ WA: '53',
63
+ WV: '54',
64
+ WI: '55',
65
+ WY: '56',
66
+ AS: '60',
67
+ GU: '66',
68
+ MP: '69',
69
+ PR: '72',
70
+ VI: '78',
71
+ FM: '64',
72
+ MH: '68',
73
+ PW: '70',
74
+ UM: '74',
75
+ };
76
+ const POSTAL_BY_FIPS = Object.fromEntries(Object.entries(STATE_FIPS).map(([postal, fips]) => [fips, postal]));
77
+ /**
78
+ * Armed-forces postal codes (Americas, Europe, Pacific). Upstream records them
79
+ * as states under country USA; they have no FIPS code, so no 5-digit county.
80
+ */
81
+ const ARMED_FORCES_STATES = new Set(['AA', 'AE', 'AP']);
82
+ /**
83
+ * Territories by their ISO 3166-1 alpha-3 code. Upstream records them as
84
+ * country USA with the territory's postal code as state, so the ISO code
85
+ * alone matches nothing.
86
+ */
87
+ const TERRITORY_STATES = {
88
+ PRI: 'PR',
89
+ GUM: 'GU',
90
+ VIR: 'VI',
91
+ ASM: 'AS',
92
+ MNP: 'MP',
93
+ };
94
+ /**
95
+ * A code input that also accepts `""` — what form-based clients send for an
96
+ * untouched field — as unset, advertised as `anyOf ["", pattern]`. A
97
+ * whitespace-only value reads as blank; a whitespace-padded code fails the
98
+ * pattern.
99
+ */
100
+ function blankableCode(pattern, message, description) {
101
+ return z
102
+ .preprocess((value) => (typeof value === 'string' && value.trim() === '' ? '' : value), z.union([z.literal(''), z.string().regex(pattern, message)]))
103
+ .describe(description)
104
+ .optional();
105
+ }
106
+ /** The `location_filter` object of `usaspending_search_awards`. */
107
+ export const LocationFilterSchema = z
108
+ .object({
109
+ country: blankableCode(/^[A-Za-z]{3}$/, 'Expected a 3-letter ISO 3166-1 alpha-3 country code (e.g. USA)', 'ISO 3166-1 alpha-3 country code (e.g., USA); USA when omitted. A US territory code — PRI, GUM, VIR, ASM, MNP — is sent as USA with the territory as state.'),
110
+ state: blankableCode(/^(?:[A-Za-z]{2}|\d{2})$/, 'Expected a 2-letter US postal code (e.g. NM) or a 2-digit state FIPS code (e.g. 35)', "Under USA (the default): a US state, DC, territory, freely associated state, or armed-forces code as a 2-letter postal code (NM, PR, FM, AE) or 2-digit FIPS code (35). Under another country: that country's own 2-letter subdivision code (ON with CAN)."),
111
+ county: blankableCode(/^(?:\d{3}|\d{5})$/, 'Expected a county FIPS code: 3 digits with state (e.g. 049) or 5 digits (e.g. 35049)', 'US county FIPS code: 3 digits with state (049 with state NM), or the 5-digit state + county code (35049, Santa Fe County, NM), whose first two digits set the state — the form usaspending_spending_by_geography county rows carry as shape_code.'),
112
+ city: z.string().optional().describe('City name'),
113
+ })
114
+ .strict()
115
+ .optional()
116
+ .describe('Filter by place of performance. Takes codes, not place names — use a geocoding server to resolve names to codes first. Blank fields are ignored, and an all-blank object is no location filter. The location sent is echoed as applied_location.');
117
+ const fail = (message) => ({ ok: false, message });
118
+ /**
119
+ * Resolves a caller's location into the shape upstream matches: country
120
+ * defaults to USA, a territory code becomes USA plus its postal state, a FIPS
121
+ * state becomes its postal code, and a 5-digit county splits into state and
122
+ * the 3-digit county code. Under another country, a letter state is that
123
+ * country's own subdivision code and passes through. Shapes that would draw
124
+ * upstream's 422 or an empty page — an unknown US state, a county without a
125
+ * state or under an armed-forces code, a county or FIPS-number state under
126
+ * another country, or parts that
127
+ * name different states — come back as a message naming the field and the form
128
+ * it accepts.
129
+ */
130
+ export function resolveLocation(input) {
131
+ const read = (value) => value?.trim() || undefined;
132
+ const countryIn = read(input?.country)?.toUpperCase();
133
+ const stateIn = read(input?.state)?.toUpperCase();
134
+ const countyIn = read(input?.county);
135
+ const city = read(input?.city);
136
+ if (!countryIn && !stateIn && !countyIn && !city)
137
+ return { ok: true, location: undefined };
138
+ const territory = countryIn ? TERRITORY_STATES[countryIn] : undefined;
139
+ const country = territory || !countryIn ? 'USA' : countryIn;
140
+ if (country !== 'USA') {
141
+ if (countyIn) {
142
+ return fail(`location_filter.county "${countyIn}" is a US county FIPS code, but location_filter.country is ${country}. Drop county, or set country to USA.`);
143
+ }
144
+ if (stateIn && /^\d{2}$/.test(stateIn)) {
145
+ return fail(`location_filter.state "${stateIn}" is a US state FIPS code, but location_filter.country is ${country}. Send ${country}'s own 2-letter subdivision code as state, or set country to USA.`);
146
+ }
147
+ return {
148
+ ok: true,
149
+ location: { country, ...(stateIn ? { state: stateIn } : {}), ...(city ? { city } : {}) },
150
+ };
151
+ }
152
+ let state;
153
+ if (stateIn) {
154
+ state =
155
+ stateIn in STATE_FIPS || ARMED_FORCES_STATES.has(stateIn) ? stateIn : POSTAL_BY_FIPS[stateIn];
156
+ if (!state) {
157
+ return fail(`location_filter.state "${stateIn}" is not a US state, DC, territory, freely associated state, or armed-forces code. Send its 2-letter postal code (NM) or 2-digit FIPS code (35).`);
158
+ }
159
+ }
160
+ if (territory) {
161
+ if (state && state !== territory) {
162
+ return fail(`location_filter.state "${stateIn}" contradicts location_filter.country ${countryIn}, which is sent as country USA with state ${territory}. Drop state, or send ${territory}.`);
163
+ }
164
+ state = territory;
165
+ }
166
+ let county;
167
+ if (countyIn?.length === 5) {
168
+ const prefixState = POSTAL_BY_FIPS[countyIn.slice(0, 2)];
169
+ if (!prefixState) {
170
+ return fail(`location_filter.county "${countyIn}" starts with ${countyIn.slice(0, 2)}, which is not the FIPS code of a US state, DC, or territory. Send the 5-digit state + county code, or the 3-digit county code with state.`);
171
+ }
172
+ if (state && ARMED_FORCES_STATES.has(state)) {
173
+ return fail(`location_filter.county "${countyIn}" lies in ${prefixState} (FIPS ${countyIn.slice(0, 2)}), but the state is ${state}, an armed-forces code with no FIPS code. Drop county, or drop state to search that county in ${prefixState}.`);
174
+ }
175
+ if (state && state !== prefixState) {
176
+ return fail(`location_filter.county "${countyIn}" lies in ${prefixState} (FIPS ${countyIn.slice(0, 2)}), but the state is ${state}. Send a county in ${state}: its 3-digit code, or a 5-digit code starting ${STATE_FIPS[state]}.`);
177
+ }
178
+ state = prefixState;
179
+ county = countyIn.slice(2);
180
+ }
181
+ else if (countyIn) {
182
+ if (!state) {
183
+ return fail(`location_filter.county "${countyIn}" needs location_filter.state: a 3-digit county code is unique only within its state. Add state, or send the 5-digit state + county code.`);
184
+ }
185
+ if (ARMED_FORCES_STATES.has(state)) {
186
+ return fail(`location_filter.county "${countyIn}" cannot be sent with state ${state}, an armed-forces code with no counties. Drop county, or send a US state with it.`);
187
+ }
188
+ county = countyIn;
189
+ }
190
+ return {
191
+ ok: true,
192
+ location: {
193
+ country,
194
+ ...(state ? { state } : {}),
195
+ ...(county ? { county } : {}),
196
+ ...(city ? { city } : {}),
197
+ },
198
+ };
199
+ }
200
+ /** The location as sent, for echoes and notices: `country=USA, state=NM, county=049`. */
201
+ export function describeLocation(location) {
202
+ return Object.entries(location)
203
+ .map(([key, value]) => `${key}=${value}`)
204
+ .join(', ');
205
+ }
206
+ //# sourceMappingURL=locations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locations.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/locations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE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,29 @@
1
1
  /**
2
2
  * @fileoverview Tool to search federal awards by keyword, recipient, agency, award type,
3
- * NAICS code, location, or date range.
3
+ * NAICS, Assistance Listing, PSC, or DEF code, location, or date range.
4
4
  * @module mcp-server/tools/definitions/search-awards.tool
5
5
  */
6
6
  import { z } from '@cyanheads/mcp-ts-core';
7
7
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
8
8
  export declare const searchAwardsTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
9
+ assistance_listings: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ psc_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ def_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
12
  keyword: z.ZodOptional<z.ZodString>;
10
13
  award_type_codes: z.ZodDefault<z.ZodArray<z.ZodString>>;
11
14
  agency_name: z.ZodOptional<z.ZodString>;
12
15
  recipient_name: z.ZodOptional<z.ZodString>;
13
16
  naics_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
- assistance_listings: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
17
  time_period: z.ZodOptional<z.ZodObject<{
16
18
  start_date: z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>;
17
19
  end_date: z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>;
18
- }, z.core.$strip>>;
20
+ }, z.core.$strict>>;
19
21
  location_filter: z.ZodOptional<z.ZodObject<{
20
- country: z.ZodOptional<z.ZodString>;
21
- state: z.ZodOptional<z.ZodString>;
22
- county: z.ZodOptional<z.ZodString>;
22
+ country: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
23
+ state: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
24
+ county: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
23
25
  city: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strip>>;
26
+ }, z.core.$strict>>;
25
27
  sort: z.ZodOptional<z.ZodEnum<{
26
28
  "Award Amount": "Award Amount";
27
29
  "Awarding Agency": "Awarding Agency";
@@ -42,6 +44,9 @@ export declare const searchAwardsTool: import("@cyanheads/mcp-ts-core").ToolDefi
42
44
  last_record_sort_value: z.ZodOptional<z.ZodString>;
43
45
  last_record_unique_id: z.ZodOptional<z.ZodNumber>;
44
46
  filters: z.ZodOptional<z.ZodObject<{
47
+ assistance_listings: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ psc_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
+ def_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
50
  keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
51
  award_type_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
52
  agency_name: z.ZodOptional<z.ZodString>;
@@ -49,7 +54,7 @@ export declare const searchAwardsTool: import("@cyanheads/mcp-ts-core").ToolDefi
49
54
  naics_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
55
  time_period_start: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
51
56
  time_period_end: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
52
- }, z.core.$strip>>;
57
+ }, z.core.$strict>>;
53
58
  }, z.core.$strip>, z.ZodObject<{
54
59
  results: z.ZodArray<z.ZodObject<{
55
60
  award_id: z.ZodOptional<z.ZodString>;
@@ -125,6 +130,18 @@ export declare const searchAwardsTool: import("@cyanheads/mcp-ts-core").ToolDefi
125
130
  readonly when: "assistance_listings was given while the award type codes include contract or IDV codes, or were left at the contract default.";
126
131
  readonly retryable: false;
127
132
  readonly recovery: "Set award_type_codes to one assistance group — grants 02/03/04/05/F001/F002, direct payments 06/10/F006/F007, loans 07/08/F003/F004, or other assistance 09/11/-1/F005/F008/F009/F010 — alongside assistance_listings.";
133
+ }, {
134
+ readonly reason: "psc_codes_type_mismatch";
135
+ readonly code: JsonRpcErrorCode.ValidationError;
136
+ readonly when: "psc_codes was given while the award type codes include assistance codes.";
137
+ readonly retryable: false;
138
+ readonly recovery: "Set award_type_codes to contracts A/B/C/D (the default) or IDVs IDV_A/IDV_B/IDV_B_A/IDV_B_B/IDV_B_C/IDV_C/IDV_D/IDV_E alongside psc_codes.";
139
+ }, {
140
+ readonly reason: "invalid_location";
141
+ readonly code: JsonRpcErrorCode.ValidationError;
142
+ readonly when: "location_filter names an unknown US state, a county without a state or under an armed-forces code, a county or FIPS-number state under a non-USA country, or parts that place it in different states.";
143
+ readonly retryable: false;
144
+ readonly recovery: "Under country USA (the default) or a US territory code, send location_filter.state as a postal code (NM) or 2-digit FIPS code (35), and location_filter.county as 3 digits with that state or as the 5-digit state + county code (35049). Under another country, send state as that country's own 2-letter subdivision code and no county.";
128
145
  }], {
129
146
  readonly page: z.ZodNumber;
130
147
  readonly has_next: z.ZodBoolean;
@@ -136,6 +153,9 @@ export declare const searchAwardsTool: import("@cyanheads/mcp-ts-core").ToolDefi
136
153
  readonly applied_agency_name: z.ZodOptional<z.ZodString>;
137
154
  readonly applied_naics_codes: z.ZodOptional<z.ZodString>;
138
155
  readonly applied_assistance_listings: z.ZodOptional<z.ZodString>;
156
+ readonly applied_psc_codes: z.ZodOptional<z.ZodString>;
157
+ readonly applied_def_codes: z.ZodOptional<z.ZodString>;
158
+ readonly applied_location: z.ZodOptional<z.ZodString>;
139
159
  readonly applied_time_period_start: z.ZodOptional<z.ZodString>;
140
160
  readonly applied_time_period_end: z.ZodOptional<z.ZodString>;
141
161
  readonly notice: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"search-awards.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-awards.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,+BAA+B,CAAC;AAiJlF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4rB3B,CAAC"}
1
+ {"version":3,"file":"search-awards.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-awards.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,+BAA+B,CAAC;AA2IlF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2uB3B,CAAC"}