@cyanheads/usaspending-mcp-server 0.1.1

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 (88) hide show
  1. package/CLAUDE.md +405 -0
  2. package/Dockerfile +98 -0
  3. package/README.md +391 -0
  4. package/changelog/0.1.x/0.1.0.md +26 -0
  5. package/changelog/0.1.x/0.1.1.md +16 -0
  6. package/changelog/template.md +119 -0
  7. package/dist/config/server-config.d.ts +13 -0
  8. package/dist/config/server-config.d.ts.map +1 -0
  9. package/dist/config/server-config.js +29 -0
  10. package/dist/config/server-config.js.map +1 -0
  11. package/dist/index.d.ts +8 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +25 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/mcp-server/tools/definitions/autocomplete.tool.d.ts +39 -0
  16. package/dist/mcp-server/tools/definitions/autocomplete.tool.d.ts.map +1 -0
  17. package/dist/mcp-server/tools/definitions/autocomplete.tool.js +138 -0
  18. package/dist/mcp-server/tools/definitions/autocomplete.tool.js.map +1 -0
  19. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts +78 -0
  20. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts.map +1 -0
  21. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js +300 -0
  22. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js.map +1 -0
  23. package/dist/mcp-server/tools/definitions/filters.d.ts +15 -0
  24. package/dist/mcp-server/tools/definitions/filters.d.ts.map +1 -0
  25. package/dist/mcp-server/tools/definitions/filters.js +26 -0
  26. package/dist/mcp-server/tools/definitions/filters.js.map +1 -0
  27. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts +50 -0
  28. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts.map +1 -0
  29. package/dist/mcp-server/tools/definitions/get-agency.tool.js +217 -0
  30. package/dist/mcp-server/tools/definitions/get-agency.tool.js.map +1 -0
  31. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts +56 -0
  32. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts.map +1 -0
  33. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js +154 -0
  34. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js.map +1 -0
  35. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts +53 -0
  36. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts.map +1 -0
  37. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js +147 -0
  38. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js.map +1 -0
  39. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts +91 -0
  40. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts.map +1 -0
  41. package/dist/mcp-server/tools/definitions/get-award.tool.js +433 -0
  42. package/dist/mcp-server/tools/definitions/get-award.tool.js.map +1 -0
  43. package/dist/mcp-server/tools/definitions/get-federal-account.tool.d.ts +32 -0
  44. package/dist/mcp-server/tools/definitions/get-federal-account.tool.d.ts.map +1 -0
  45. package/dist/mcp-server/tools/definitions/get-federal-account.tool.js +107 -0
  46. package/dist/mcp-server/tools/definitions/get-federal-account.tool.js.map +1 -0
  47. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts +55 -0
  48. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts.map +1 -0
  49. package/dist/mcp-server/tools/definitions/get-recipient.tool.js +194 -0
  50. package/dist/mcp-server/tools/definitions/get-recipient.tool.js.map +1 -0
  51. package/dist/mcp-server/tools/definitions/index.d.ts +678 -0
  52. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  53. package/dist/mcp-server/tools/definitions/index.js +49 -0
  54. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  55. package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts +36 -0
  56. package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts.map +1 -0
  57. package/dist/mcp-server/tools/definitions/list-agencies.tool.js +93 -0
  58. package/dist/mcp-server/tools/definitions/list-agencies.tool.js.map +1 -0
  59. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts +77 -0
  60. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts.map +1 -0
  61. package/dist/mcp-server/tools/definitions/search-awards.tool.js +300 -0
  62. package/dist/mcp-server/tools/definitions/search-awards.tool.js.map +1 -0
  63. package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts +46 -0
  64. package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts.map +1 -0
  65. package/dist/mcp-server/tools/definitions/search-recipients.tool.js +143 -0
  66. package/dist/mcp-server/tools/definitions/search-recipients.tool.js.map +1 -0
  67. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts +57 -0
  68. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts.map +1 -0
  69. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js +136 -0
  70. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js.map +1 -0
  71. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts +51 -0
  72. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts.map +1 -0
  73. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js +153 -0
  74. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js.map +1 -0
  75. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts +53 -0
  76. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts.map +1 -0
  77. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js +163 -0
  78. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js.map +1 -0
  79. package/dist/services/usaspending/types.d.ts +489 -0
  80. package/dist/services/usaspending/types.d.ts.map +1 -0
  81. package/dist/services/usaspending/types.js +6 -0
  82. package/dist/services/usaspending/types.js.map +1 -0
  83. package/dist/services/usaspending/usaspending-service.d.ts +137 -0
  84. package/dist/services/usaspending/usaspending-service.d.ts.map +1 -0
  85. package/dist/services/usaspending/usaspending-service.js +201 -0
  86. package/dist/services/usaspending/usaspending-service.js.map +1 -0
  87. package/package.json +80 -0
  88. package/server.json +99 -0
@@ -0,0 +1,433 @@
1
+ /**
2
+ * @fileoverview Tool to fetch full details of a federal award by its generated ID.
3
+ * @module mcp-server/tools/definitions/get-award.tool
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getUSASpendingService } from '../../../services/usaspending/usaspending-service.js';
8
+ export const getAwardTool = tool('usaspending_get_award', {
9
+ title: 'Get Award Details',
10
+ description: 'Fetch full details of a federal award by its generated unique award ID. Returns contract or assistance award data including recipient info, agency hierarchy, period of performance, place of performance, funding account linkages (account_obligations_by_defc), parent IDV information, and subaward count. Use generated_internal_id values from usaspending_search_awards as input. Recipient hashes can be passed to usaspending_get_recipient; NAICS codes can be used in usaspending_search_awards filters.',
11
+ annotations: { readOnlyHint: true, openWorldHint: false, idempotentHint: true },
12
+ input: z.object({
13
+ award_id: z
14
+ .string()
15
+ .min(1)
16
+ .describe('Generated unique award ID (e.g., CONT_AWD_FA862118F6251_9700_FA862115D6276_9700) — use generated_internal_id from usaspending_search_awards'),
17
+ }),
18
+ output: z.object({
19
+ generated_unique_award_id: z.string().optional().describe('Generated unique award ID'),
20
+ piid: z.string().optional().describe('Procurement Instrument Identifier (for contracts)'),
21
+ fain: z.string().optional().describe('Federal Award Identification Number (for assistance)'),
22
+ type: z.string().optional().describe('Award type code'),
23
+ type_description: z.string().optional().describe('Human-readable award type'),
24
+ category: z
25
+ .string()
26
+ .optional()
27
+ .describe('Award category (contract, grant, direct_payment, loan, idv, other)'),
28
+ description: z.string().optional().describe('Award description'),
29
+ total_obligation: z.number().optional().describe('Total obligation amount in USD'),
30
+ total_outlays: z.number().optional().describe('Total outlay amount in USD'),
31
+ base_and_all_options_value: z
32
+ .number()
33
+ .optional()
34
+ .describe('Base and all options value in USD (contracts)'),
35
+ subaward_count: z
36
+ .number()
37
+ .optional()
38
+ .describe('Number of subawards; use with usaspending_get_award_subawards'),
39
+ date_signed: z.string().optional().describe('Date award was signed (YYYY-MM-DD)'),
40
+ period_of_performance: z
41
+ .object({
42
+ start_date: z.string().optional().describe('Performance start date'),
43
+ end_date: z.string().optional().describe('Performance end date'),
44
+ potential_end_date: z.string().optional().describe('Potential end date including options'),
45
+ })
46
+ .optional()
47
+ .describe('Period of performance dates'),
48
+ place_of_performance: z
49
+ .object({
50
+ city_name: z.string().optional().describe('City of performance'),
51
+ state_code: z.string().optional().describe('State code of performance'),
52
+ country_code: z.string().optional().describe('Country code of performance'),
53
+ zip5: z.string().optional().describe('ZIP code of performance'),
54
+ })
55
+ .optional()
56
+ .describe('Place of performance'),
57
+ recipient: z
58
+ .object({
59
+ recipient_name: z.string().optional().describe('Recipient legal business name'),
60
+ uei: z.string().optional().describe('Unique Entity Identifier'),
61
+ recipient_id: z
62
+ .string()
63
+ .optional()
64
+ .describe('Recipient hash ID — pass to usaspending_get_recipient for full profile'),
65
+ parent_recipient_name: z.string().optional().describe('Parent organization name'),
66
+ business_types: z.array(z.string()).optional().describe('Recipient business type codes'),
67
+ location: z
68
+ .object({
69
+ city_name: z.string().optional().describe('Recipient city'),
70
+ state_code: z.string().optional().describe('Recipient state code'),
71
+ country_code: z.string().optional().describe('Recipient country code'),
72
+ })
73
+ .optional()
74
+ .describe('Recipient address'),
75
+ })
76
+ .optional()
77
+ .describe('Recipient details'),
78
+ awarding_agency: z
79
+ .object({
80
+ toptier_name: z.string().optional().describe('Top-tier agency name'),
81
+ toptier_code: z.string().optional().describe('Top-tier agency code'),
82
+ toptier_slug: z.string().optional().describe('Top-tier agency slug'),
83
+ subtier_name: z.string().optional().describe('Sub-tier agency name'),
84
+ })
85
+ .optional()
86
+ .describe('Awarding agency hierarchy'),
87
+ funding_agency: z
88
+ .object({
89
+ toptier_name: z.string().optional().describe('Top-tier funding agency name'),
90
+ toptier_code: z.string().optional().describe('Top-tier funding agency code'),
91
+ subtier_name: z.string().optional().describe('Sub-tier funding agency name'),
92
+ })
93
+ .optional()
94
+ .describe('Funding agency hierarchy'),
95
+ parent_award: z
96
+ .object({
97
+ award_id: z.string().optional().describe('Parent award display ID'),
98
+ generated_unique_award_id: z
99
+ .string()
100
+ .optional()
101
+ .describe('Parent award chaining ID — pass to usaspending_get_award for parent IDV details'),
102
+ agency_name: z.string().optional().describe('Parent award agency name'),
103
+ type_description: z.string().optional().describe('Parent award type description'),
104
+ })
105
+ .optional()
106
+ .describe('Parent IDV information (contracts only)'),
107
+ naics: z
108
+ .object({
109
+ code: z.string().optional().describe('NAICS industry code'),
110
+ description: z.string().optional().describe('NAICS industry description'),
111
+ })
112
+ .optional()
113
+ .describe('NAICS code (contracts)'),
114
+ product_or_service_code: z
115
+ .object({
116
+ code: z.string().optional().describe('PSC product or service code'),
117
+ description: z.string().optional().describe('PSC description'),
118
+ })
119
+ .optional()
120
+ .describe('Product or service code (contracts)'),
121
+ cfda: z
122
+ .object({
123
+ number: z.string().optional().describe('CFDA/Assistance Listing number'),
124
+ title: z.string().optional().describe('CFDA program title'),
125
+ })
126
+ .optional()
127
+ .describe('CFDA program (grants/assistance)'),
128
+ account_obligations_by_defc: z
129
+ .array(z
130
+ .object({
131
+ code: z.string().optional().describe('DEF code identifying the emergency supplemental'),
132
+ amount: z.number().optional().describe('Obligation amount in USD for this DEF code'),
133
+ })
134
+ .describe('DEF code entry with code and obligation amount'))
135
+ .optional()
136
+ .describe('Funding breakdown by Disaster/Emergency Funding (DEF) code — links to disaster appropriations'),
137
+ transactions_count: z
138
+ .number()
139
+ .optional()
140
+ .describe('Number of transactions; use with usaspending_get_award_transactions'),
141
+ }),
142
+ errors: [
143
+ {
144
+ reason: 'award_not_found',
145
+ code: JsonRpcErrorCode.NotFound,
146
+ when: 'No award exists for the given award ID.',
147
+ recovery: 'Verify the award_id from usaspending_search_awards results. IDs are case-sensitive and use the generated_internal_id format.',
148
+ },
149
+ {
150
+ reason: 'api_unavailable',
151
+ code: JsonRpcErrorCode.ServiceUnavailable,
152
+ when: 'USAspending.gov API is unreachable or returns an error.',
153
+ retryable: true,
154
+ recovery: 'The API may be temporarily down. Retry the request after a few seconds.',
155
+ },
156
+ ],
157
+ async handler(input, ctx) {
158
+ ctx.log.info('usaspending_get_award', { award_id: input.award_id });
159
+ const svc = getUSASpendingService();
160
+ const r = await svc.getAward(input.award_id, ctx);
161
+ if (!r || (!r.generated_unique_award_id && !r.piid && !r.fain)) {
162
+ throw ctx.fail('award_not_found', `Award not found: ${input.award_id}`, {
163
+ recovery: {
164
+ hint: 'Use generated_internal_id from usaspending_search_awards results — not display Award IDs.',
165
+ },
166
+ });
167
+ }
168
+ const contractData = r.latest_transaction_contract_data;
169
+ const assistanceData = r.latest_transaction_assistance_data;
170
+ return {
171
+ ...(r.generated_unique_award_id
172
+ ? { generated_unique_award_id: r.generated_unique_award_id }
173
+ : {}),
174
+ ...(r.piid ? { piid: r.piid } : {}),
175
+ ...(r.fain ? { fain: r.fain } : {}),
176
+ ...(r.type ? { type: r.type } : {}),
177
+ ...(r.type_description ? { type_description: r.type_description } : {}),
178
+ ...(r.category ? { category: r.category } : {}),
179
+ ...(r.description ? { description: r.description } : {}),
180
+ ...(typeof r.total_obligation === 'number' ? { total_obligation: r.total_obligation } : {}),
181
+ ...(typeof r.total_outlays === 'number' ? { total_outlays: r.total_outlays } : {}),
182
+ ...(typeof r.base_and_all_options_value === 'number'
183
+ ? { base_and_all_options_value: r.base_and_all_options_value }
184
+ : {}),
185
+ ...(typeof r.subaward_count === 'number' ? { subaward_count: r.subaward_count } : {}),
186
+ ...(r.date_signed ? { date_signed: r.date_signed } : {}),
187
+ ...(r.period_of_performance
188
+ ? {
189
+ period_of_performance: {
190
+ ...(r.period_of_performance.start_date
191
+ ? { start_date: r.period_of_performance.start_date }
192
+ : {}),
193
+ ...(r.period_of_performance.end_date
194
+ ? { end_date: r.period_of_performance.end_date }
195
+ : {}),
196
+ ...(r.period_of_performance.potential_end_date
197
+ ? { potential_end_date: r.period_of_performance.potential_end_date }
198
+ : {}),
199
+ },
200
+ }
201
+ : {}),
202
+ ...(r.place_of_performance
203
+ ? {
204
+ place_of_performance: {
205
+ ...(r.place_of_performance.city_name
206
+ ? { city_name: r.place_of_performance.city_name }
207
+ : {}),
208
+ ...(r.place_of_performance.state_code
209
+ ? { state_code: r.place_of_performance.state_code }
210
+ : {}),
211
+ ...(r.place_of_performance.country_code
212
+ ? { country_code: r.place_of_performance.country_code }
213
+ : {}),
214
+ ...(r.place_of_performance.zip5 ? { zip5: r.place_of_performance.zip5 } : {}),
215
+ },
216
+ }
217
+ : {}),
218
+ ...(r.recipient
219
+ ? {
220
+ recipient: {
221
+ ...(r.recipient.recipient_name ? { recipient_name: r.recipient.recipient_name } : {}),
222
+ ...(r.recipient.uei ? { uei: r.recipient.uei } : {}),
223
+ ...(r.recipient.recipient_hash
224
+ ? { recipient_id: r.recipient.recipient_hash }
225
+ : r.recipient.recipient_id
226
+ ? { recipient_id: r.recipient.recipient_id }
227
+ : {}),
228
+ ...(r.recipient.parent_recipient_name
229
+ ? { parent_recipient_name: r.recipient.parent_recipient_name }
230
+ : {}),
231
+ ...(r.recipient.business_types?.length
232
+ ? { business_types: r.recipient.business_types }
233
+ : {}),
234
+ ...(r.recipient.location
235
+ ? {
236
+ location: {
237
+ ...(r.recipient.location.city_name
238
+ ? { city_name: r.recipient.location.city_name }
239
+ : {}),
240
+ ...(r.recipient.location.state_code
241
+ ? { state_code: r.recipient.location.state_code }
242
+ : {}),
243
+ ...(r.recipient.location.country_code
244
+ ? { country_code: r.recipient.location.country_code }
245
+ : {}),
246
+ },
247
+ }
248
+ : {}),
249
+ },
250
+ }
251
+ : {}),
252
+ ...(r.awarding_agency
253
+ ? {
254
+ awarding_agency: {
255
+ ...(r.awarding_agency.toptier_agency?.name
256
+ ? { toptier_name: r.awarding_agency.toptier_agency.name }
257
+ : {}),
258
+ ...(r.awarding_agency.toptier_agency?.code
259
+ ? { toptier_code: r.awarding_agency.toptier_agency.code }
260
+ : {}),
261
+ ...(r.awarding_agency.toptier_agency?.slug
262
+ ? { toptier_slug: r.awarding_agency.toptier_agency.slug }
263
+ : {}),
264
+ ...(r.awarding_agency.subtier_agency?.name
265
+ ? { subtier_name: r.awarding_agency.subtier_agency.name }
266
+ : {}),
267
+ },
268
+ }
269
+ : {}),
270
+ ...(r.funding_agency
271
+ ? {
272
+ funding_agency: {
273
+ ...(r.funding_agency.toptier_agency?.name
274
+ ? { toptier_name: r.funding_agency.toptier_agency.name }
275
+ : {}),
276
+ ...(r.funding_agency.toptier_agency?.code
277
+ ? { toptier_code: r.funding_agency.toptier_agency.code }
278
+ : {}),
279
+ ...(r.funding_agency.subtier_agency?.name
280
+ ? { subtier_name: r.funding_agency.subtier_agency.name }
281
+ : {}),
282
+ },
283
+ }
284
+ : {}),
285
+ ...(r.parent_award
286
+ ? {
287
+ parent_award: {
288
+ ...(r.parent_award.piid ? { award_id: r.parent_award.piid } : {}),
289
+ ...(r.parent_award.generated_unique_award_id
290
+ ? { generated_unique_award_id: r.parent_award.generated_unique_award_id }
291
+ : {}),
292
+ ...(r.parent_award.agency_name ? { agency_name: r.parent_award.agency_name } : {}),
293
+ ...(r.parent_award.idv_type_description
294
+ ? { type_description: r.parent_award.idv_type_description }
295
+ : {}),
296
+ },
297
+ }
298
+ : {}),
299
+ ...(contractData?.naics
300
+ ? {
301
+ naics: {
302
+ code: contractData.naics,
303
+ ...(contractData.naics_description
304
+ ? { description: contractData.naics_description }
305
+ : {}),
306
+ },
307
+ }
308
+ : {}),
309
+ ...(contractData?.product_or_service_code
310
+ ? {
311
+ product_or_service_code: {
312
+ code: contractData.product_or_service_code,
313
+ ...(contractData.product_or_service_code_description
314
+ ? { description: contractData.product_or_service_code_description }
315
+ : {}),
316
+ },
317
+ }
318
+ : {}),
319
+ ...(assistanceData?.cfda_number
320
+ ? {
321
+ cfda: {
322
+ number: assistanceData.cfda_number,
323
+ ...(assistanceData.cfda_title ? { title: assistanceData.cfda_title } : {}),
324
+ },
325
+ }
326
+ : {}),
327
+ ...(r.account_obligations_by_defc?.length
328
+ ? {
329
+ account_obligations_by_defc: r.account_obligations_by_defc
330
+ .filter((d) => d.code || typeof d.amount === 'number')
331
+ .map((d) => ({
332
+ ...(d.code ? { code: d.code } : {}),
333
+ ...(typeof d.amount === 'number' ? { amount: d.amount } : {}),
334
+ })),
335
+ }
336
+ : {}),
337
+ ...(typeof r.transactions_count === 'number'
338
+ ? { transactions_count: r.transactions_count }
339
+ : {}),
340
+ };
341
+ },
342
+ format: (result) => {
343
+ const lines = ['## Award Details'];
344
+ if (result.generated_unique_award_id)
345
+ lines.push(`**Award ID:** ${result.generated_unique_award_id}`);
346
+ if (result.piid)
347
+ lines.push(`**PIID:** ${result.piid}`);
348
+ if (result.fain)
349
+ lines.push(`**FAIN:** ${result.fain}`);
350
+ if (result.type)
351
+ lines.push(`**Type Code:** ${result.type}`);
352
+ if (result.type_description)
353
+ lines.push(`**Type:** ${result.type_description}`);
354
+ if (result.category)
355
+ lines.push(`**Category:** ${result.category}`);
356
+ if (result.description)
357
+ lines.push(`**Description:** ${result.description}`);
358
+ if (typeof result.total_obligation === 'number')
359
+ lines.push(`**Total Obligation:** $${result.total_obligation.toLocaleString()}`);
360
+ if (typeof result.total_outlays === 'number')
361
+ lines.push(`**Total Outlays:** $${result.total_outlays.toLocaleString()}`);
362
+ if (typeof result.base_and_all_options_value === 'number')
363
+ lines.push(`**Base + All Options:** $${result.base_and_all_options_value.toLocaleString()}`);
364
+ if (result.date_signed)
365
+ lines.push(`**Date Signed:** ${result.date_signed}`);
366
+ if (result.period_of_performance) {
367
+ const p = result.period_of_performance;
368
+ lines.push(`**Period:** ${p.start_date ?? 'N/A'} → ${p.end_date ?? 'N/A'}${p.potential_end_date ? ` (potential: ${p.potential_end_date})` : ''}`);
369
+ }
370
+ if (result.place_of_performance) {
371
+ const pop = result.place_of_performance;
372
+ const loc = [pop.city_name, pop.state_code, pop.zip5, pop.country_code]
373
+ .filter(Boolean)
374
+ .join(', ');
375
+ if (loc)
376
+ lines.push(`**Place of Performance:** ${loc}`);
377
+ }
378
+ if (result.recipient) {
379
+ lines.push('\n### Recipient');
380
+ if (result.recipient.recipient_name)
381
+ lines.push(`**Name:** ${result.recipient.recipient_name}`);
382
+ if (result.recipient.uei)
383
+ lines.push(`**UEI:** ${result.recipient.uei}`);
384
+ if (result.recipient.recipient_id)
385
+ lines.push(`**Recipient ID (for get_recipient):** ${result.recipient.recipient_id}`);
386
+ if (result.recipient.parent_recipient_name)
387
+ lines.push(`**Parent:** ${result.recipient.parent_recipient_name}`);
388
+ if (result.recipient.business_types?.length)
389
+ lines.push(`**Business Types:** ${result.recipient.business_types.join(', ')}`);
390
+ if (result.recipient.location) {
391
+ const loc = result.recipient.location;
392
+ lines.push(`**Location:** ${[loc.city_name, loc.state_code, loc.country_code].filter(Boolean).join(', ')}`);
393
+ }
394
+ }
395
+ if (result.awarding_agency) {
396
+ const a = result.awarding_agency;
397
+ lines.push(`\n**Awarding Agency:** ${a.toptier_name ?? 'N/A'}${a.subtier_name ? ` / ${a.subtier_name}` : ''}${a.toptier_code ? ` (code: ${a.toptier_code})` : ''}${a.toptier_slug ? ` (slug: ${a.toptier_slug})` : ''}`);
398
+ }
399
+ if (result.funding_agency) {
400
+ const f = result.funding_agency;
401
+ lines.push(`**Funding Agency:** ${f.toptier_name ?? 'N/A'}${f.subtier_name ? ` / ${f.subtier_name}` : ''}${f.toptier_code ? ` (code: ${f.toptier_code})` : ''}`);
402
+ }
403
+ if (result.naics)
404
+ lines.push(`**NAICS:** ${result.naics.code}${result.naics.description ? ` — ${result.naics.description}` : ''}`);
405
+ if (result.product_or_service_code)
406
+ lines.push(`**PSC:** ${result.product_or_service_code.code}${result.product_or_service_code.description ? ` — ${result.product_or_service_code.description}` : ''}`);
407
+ if (result.cfda)
408
+ lines.push(`**CFDA:** ${result.cfda.number}${result.cfda.title ? ` — ${result.cfda.title}` : ''}`);
409
+ if (typeof result.subaward_count === 'number')
410
+ lines.push(`**Subaward Count:** ${result.subaward_count}`);
411
+ if (typeof result.transactions_count === 'number')
412
+ lines.push(`**Transaction Count:** ${result.transactions_count}`);
413
+ if (result.parent_award) {
414
+ lines.push('\n### Parent Award (IDV)');
415
+ if (result.parent_award.award_id)
416
+ lines.push(`**PIID:** ${result.parent_award.award_id}`);
417
+ if (result.parent_award.generated_unique_award_id)
418
+ lines.push(`**Chain ID (for get_award):** ${result.parent_award.generated_unique_award_id}`);
419
+ if (result.parent_award.agency_name)
420
+ lines.push(`**Agency:** ${result.parent_award.agency_name}`);
421
+ if (result.parent_award.type_description)
422
+ lines.push(`**Type:** ${result.parent_award.type_description}`);
423
+ }
424
+ if (result.account_obligations_by_defc?.length) {
425
+ lines.push('\n### Disaster/Emergency Funding (DEF Codes)');
426
+ for (const d of result.account_obligations_by_defc) {
427
+ lines.push(`- **${d.code ?? 'N/A'}:** ${typeof d.amount === 'number' ? `$${d.amount.toLocaleString()}` : 'N/A'}`);
428
+ }
429
+ }
430
+ return [{ type: 'text', text: lines.join('\n') }];
431
+ },
432
+ });
433
+ //# sourceMappingURL=get-award.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-award.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-award.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,uBAAuB,EAAE;IACxD,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,qfAAqf;IACvf,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,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,IAAI,MAAM,CAAC,YAAY,CAAC,WAAW;gBACjC,KAAK,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;YAC/D,IAAI,MAAM,CAAC,YAAY,CAAC,gBAAgB;gBACtC,KAAK,CAAC,IAAI,CAAC,aAAa,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,MAAM,CAAC,2BAA2B,EAAE,MAAM,EAAE,CAAC;YAC/C,KAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;YAC3D,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,2BAA2B,EAAE,CAAC;gBACnD,KAAK,CAAC,IAAI,CACR,OAAO,CAAC,CAAC,IAAI,IAAI,KAAK,OAAO,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CACtG,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @fileoverview Tool to fetch a federal account's budget data, obligations, and outlays.
3
+ * @module mcp-server/tools/definitions/get-federal-account.tool
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const getFederalAccountTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ account_code: z.ZodString;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ account_title: z.ZodOptional<z.ZodString>;
11
+ federal_account_code: z.ZodOptional<z.ZodString>;
12
+ agency_identifier: z.ZodOptional<z.ZodString>;
13
+ main_account_code: z.ZodOptional<z.ZodString>;
14
+ parent_agency_name: z.ZodOptional<z.ZodString>;
15
+ bureau_name: z.ZodOptional<z.ZodString>;
16
+ total_obligated_amount: z.ZodOptional<z.ZodNumber>;
17
+ total_gross_outlay_amount: z.ZodOptional<z.ZodNumber>;
18
+ total_budgetary_resources: z.ZodOptional<z.ZodNumber>;
19
+ fiscal_year: z.ZodOptional<z.ZodNumber>;
20
+ }, z.core.$strip>, readonly [{
21
+ readonly reason: "account_not_found";
22
+ readonly code: JsonRpcErrorCode.NotFound;
23
+ readonly when: "No federal account found for the given account code.";
24
+ readonly recovery: "Account codes come from usaspending_get_award account_obligations_by_defc field. Verify the AGENCY-MAIN format (e.g., 097-0100).";
25
+ }, {
26
+ readonly reason: "api_unavailable";
27
+ readonly code: JsonRpcErrorCode.ServiceUnavailable;
28
+ readonly when: "USAspending.gov API is unreachable or returns an error.";
29
+ readonly retryable: true;
30
+ readonly recovery: "The API may be temporarily down. Retry the request after a few seconds.";
31
+ }]>;
32
+ //# sourceMappingURL=get-federal-account.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-federal-account.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-federal-account.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;GAgHhC,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @fileoverview Tool to fetch a federal account's budget data, obligations, and outlays.
3
+ * @module mcp-server/tools/definitions/get-federal-account.tool
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getUSASpendingService } from '../../../services/usaspending/usaspending-service.js';
8
+ export const getFederalAccountTool = tool('usaspending_get_federal_account', {
9
+ title: 'Get Federal Account',
10
+ description: "Fetch a federal account's budget data: total obligations, gross outlays, and budgetary resources. Federal accounts connect appropriations law to actual agency spending. Account codes appear in usaspending_get_award account_obligations_by_defc field and are formatted as AGENCY-MAIN (e.g., 097-0100 for DoD Operation and Maintenance). Returns account metadata and current fiscal year financial totals.",
11
+ annotations: { readOnlyHint: true, openWorldHint: false, idempotentHint: true },
12
+ input: z.object({
13
+ account_code: z
14
+ .string()
15
+ .min(1)
16
+ .describe('Federal account code in AGENCY-MAIN format (e.g., 097-0100). Appears in award funding details from usaspending_get_award.'),
17
+ }),
18
+ output: z.object({
19
+ account_title: z.string().optional().describe('Full account title'),
20
+ federal_account_code: z.string().optional().describe('Federal account code'),
21
+ agency_identifier: z.string().optional().describe('Agency identifier code'),
22
+ main_account_code: z.string().optional().describe('Main account code'),
23
+ parent_agency_name: z.string().optional().describe('Managing parent agency name'),
24
+ bureau_name: z.string().optional().describe('Bureau name within the agency'),
25
+ total_obligated_amount: z.number().optional().describe('Total obligated amount in USD'),
26
+ total_gross_outlay_amount: z.number().optional().describe('Total gross outlay amount in USD'),
27
+ total_budgetary_resources: z.number().optional().describe('Total budgetary resources in USD'),
28
+ fiscal_year: z.number().optional().describe('Fiscal year of the financial data'),
29
+ }),
30
+ errors: [
31
+ {
32
+ reason: 'account_not_found',
33
+ code: JsonRpcErrorCode.NotFound,
34
+ when: 'No federal account found for the given account code.',
35
+ recovery: 'Account codes come from usaspending_get_award account_obligations_by_defc field. Verify the AGENCY-MAIN format (e.g., 097-0100).',
36
+ },
37
+ {
38
+ reason: 'api_unavailable',
39
+ code: JsonRpcErrorCode.ServiceUnavailable,
40
+ when: 'USAspending.gov API is unreachable or returns an error.',
41
+ retryable: true,
42
+ recovery: 'The API may be temporarily down. Retry the request after a few seconds.',
43
+ },
44
+ ],
45
+ async handler(input, ctx) {
46
+ ctx.log.info('usaspending_get_federal_account', { account_code: input.account_code });
47
+ const svc = getUSASpendingService();
48
+ const account = await svc.getFederalAccount(input.account_code, ctx);
49
+ if (!account?.account_title) {
50
+ throw ctx.fail('account_not_found', `Federal account not found: ${input.account_code}`, {
51
+ recovery: {
52
+ hint: 'Use account codes from usaspending_get_award account_obligations_by_defc. Format: AGENCY-MAIN (e.g., 097-0100).',
53
+ },
54
+ });
55
+ }
56
+ return {
57
+ ...(account.account_title ? { account_title: account.account_title } : {}),
58
+ ...(account.federal_account_code
59
+ ? { federal_account_code: account.federal_account_code }
60
+ : {}),
61
+ ...(account.agency_identifier ? { agency_identifier: account.agency_identifier } : {}),
62
+ ...(account.main_account_code ? { main_account_code: account.main_account_code } : {}),
63
+ ...(account.parent_agency_name ? { parent_agency_name: account.parent_agency_name } : {}),
64
+ ...(account.bureau_name ? { bureau_name: account.bureau_name } : {}),
65
+ ...(typeof account.total_obligated_amount === 'number'
66
+ ? { total_obligated_amount: account.total_obligated_amount }
67
+ : {}),
68
+ ...(typeof account.total_gross_outlay_amount === 'number'
69
+ ? { total_gross_outlay_amount: account.total_gross_outlay_amount }
70
+ : {}),
71
+ ...(typeof account.total_budgetary_resources === 'number'
72
+ ? { total_budgetary_resources: account.total_budgetary_resources }
73
+ : {}),
74
+ ...(typeof account.fiscal_year === 'number' ? { fiscal_year: account.fiscal_year } : {}),
75
+ };
76
+ },
77
+ format: (result) => {
78
+ const lines = [
79
+ `## Federal Account: ${result.account_title ?? result.federal_account_code ?? 'Unknown'}`,
80
+ ];
81
+ if (result.federal_account_code)
82
+ lines.push(`**Code:** ${result.federal_account_code}`);
83
+ if (result.agency_identifier)
84
+ lines.push(`**Agency Identifier:** ${result.agency_identifier}`);
85
+ if (result.main_account_code)
86
+ lines.push(`**Main Account Code:** ${result.main_account_code}`);
87
+ if (result.parent_agency_name)
88
+ lines.push(`**Parent Agency:** ${result.parent_agency_name}`);
89
+ if (result.bureau_name)
90
+ lines.push(`**Bureau:** ${result.bureau_name}`);
91
+ if (result.fiscal_year)
92
+ lines.push(`**Fiscal Year:** ${result.fiscal_year}`);
93
+ if (typeof result.total_obligated_amount === 'number' ||
94
+ typeof result.total_gross_outlay_amount === 'number' ||
95
+ typeof result.total_budgetary_resources === 'number') {
96
+ lines.push('\n### Financial Totals');
97
+ if (typeof result.total_budgetary_resources === 'number')
98
+ lines.push(`- **Budgetary Resources:** $${result.total_budgetary_resources.toLocaleString()}`);
99
+ if (typeof result.total_obligated_amount === 'number')
100
+ lines.push(`- **Total Obligated:** $${result.total_obligated_amount.toLocaleString()}`);
101
+ if (typeof result.total_gross_outlay_amount === 'number')
102
+ lines.push(`- **Total Gross Outlays:** $${result.total_gross_outlay_amount.toLocaleString()}`);
103
+ }
104
+ return [{ type: 'text', text: lines.join('\n') }];
105
+ },
106
+ });
107
+ //# sourceMappingURL=get-federal-account.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-federal-account.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-federal-account.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,iCAAiC,EAAE;IAC3E,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,kZAAkZ;IACpZ,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE;IAE/E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,2HAA2H,CAC5H;KACJ,CAAC;IAEF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EA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