@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.
Files changed (111) hide show
  1. package/AGENTS.md +8 -5
  2. package/CLAUDE.md +8 -5
  3. package/README.md +34 -27
  4. package/changelog/0.7.x/0.7.2.md +33 -0
  5. package/changelog/template.md +10 -3
  6. package/dist/config/server-config.d.ts +13 -0
  7. package/dist/config/server-config.d.ts.map +1 -1
  8. package/dist/config/server-config.js +24 -0
  9. package/dist/config/server-config.js.map +1 -1
  10. package/dist/index.js +2 -2
  11. package/dist/index.js.map +1 -1
  12. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts +14 -2
  13. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts.map +1 -1
  14. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js +136 -40
  15. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js.map +1 -1
  16. package/dist/mcp-server/tools/definitions/count-limit.d.ts +69 -0
  17. package/dist/mcp-server/tools/definitions/count-limit.d.ts.map +1 -0
  18. package/dist/mcp-server/tools/definitions/count-limit.js +87 -0
  19. package/dist/mcp-server/tools/definitions/count-limit.js.map +1 -0
  20. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts +5 -0
  21. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts.map +1 -1
  22. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js +24 -18
  23. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js.map +1 -1
  24. package/dist/mcp-server/tools/definitions/filters.d.ts +51 -1
  25. package/dist/mcp-server/tools/definitions/filters.d.ts.map +1 -1
  26. package/dist/mcp-server/tools/definitions/filters.js +57 -1
  27. package/dist/mcp-server/tools/definitions/filters.js.map +1 -1
  28. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts +7 -0
  29. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts.map +1 -1
  30. package/dist/mcp-server/tools/definitions/get-agency.tool.js +85 -48
  31. package/dist/mcp-server/tools/definitions/get-agency.tool.js.map +1 -1
  32. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts +5 -0
  33. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts.map +1 -1
  34. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js +14 -11
  35. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js.map +1 -1
  36. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts +5 -0
  37. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts.map +1 -1
  38. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js +14 -11
  39. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js.map +1 -1
  40. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts +5 -0
  41. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts.map +1 -1
  42. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js +17 -11
  43. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js.map +1 -1
  44. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts +30 -0
  45. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts.map +1 -1
  46. package/dist/mcp-server/tools/definitions/get-award.tool.js +110 -2
  47. package/dist/mcp-server/tools/definitions/get-award.tool.js.map +1 -1
  48. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts +5 -0
  49. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts.map +1 -1
  50. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js +18 -11
  51. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js.map +1 -1
  52. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts +5 -0
  53. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts.map +1 -1
  54. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js +18 -18
  55. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js.map +1 -1
  56. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts +40 -1
  57. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts.map +1 -1
  58. package/dist/mcp-server/tools/definitions/get-recipient.tool.js +184 -4
  59. package/dist/mcp-server/tools/definitions/get-recipient.tool.js.map +1 -1
  60. package/dist/mcp-server/tools/definitions/index.d.ts +234 -4
  61. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  62. package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts.map +1 -1
  63. package/dist/mcp-server/tools/definitions/list-agencies.tool.js +2 -4
  64. package/dist/mcp-server/tools/definitions/list-agencies.tool.js.map +1 -1
  65. package/dist/mcp-server/tools/definitions/locations.d.ts +20 -9
  66. package/dist/mcp-server/tools/definitions/locations.d.ts.map +1 -1
  67. package/dist/mcp-server/tools/definitions/locations.js +106 -84
  68. package/dist/mcp-server/tools/definitions/locations.js.map +1 -1
  69. package/dist/mcp-server/tools/definitions/pagination.d.ts +9 -8
  70. package/dist/mcp-server/tools/definitions/pagination.d.ts.map +1 -1
  71. package/dist/mcp-server/tools/definitions/pagination.js +9 -8
  72. package/dist/mcp-server/tools/definitions/pagination.js.map +1 -1
  73. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts +38 -3
  74. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts.map +1 -1
  75. package/dist/mcp-server/tools/definitions/search-awards.tool.js +170 -64
  76. package/dist/mcp-server/tools/definitions/search-awards.tool.js.map +1 -1
  77. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts +5 -0
  78. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts.map +1 -1
  79. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js +15 -13
  80. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js.map +1 -1
  81. package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts +5 -0
  82. package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts.map +1 -1
  83. package/dist/mcp-server/tools/definitions/search-recipients.tool.js +12 -12
  84. package/dist/mcp-server/tools/definitions/search-recipients.tool.js.map +1 -1
  85. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts +28 -0
  86. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts.map +1 -1
  87. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js +78 -27
  88. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js.map +1 -1
  89. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts +20 -0
  90. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts.map +1 -1
  91. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js +31 -11
  92. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js.map +1 -1
  93. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts +20 -0
  94. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts.map +1 -1
  95. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js +26 -3
  96. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js.map +1 -1
  97. package/dist/mcp-server/tools/definitions/unavailable-sections.d.ts +42 -0
  98. package/dist/mcp-server/tools/definitions/unavailable-sections.d.ts.map +1 -0
  99. package/dist/mcp-server/tools/definitions/unavailable-sections.js +63 -0
  100. package/dist/mcp-server/tools/definitions/unavailable-sections.js.map +1 -0
  101. package/dist/services/usaspending/types.d.ts +88 -5
  102. package/dist/services/usaspending/types.d.ts.map +1 -1
  103. package/dist/services/usaspending/types.js +5 -1
  104. package/dist/services/usaspending/types.js.map +1 -1
  105. package/dist/services/usaspending/usaspending-service.d.ts +65 -2
  106. package/dist/services/usaspending/usaspending-service.d.ts.map +1 -1
  107. package/dist/services/usaspending/usaspending-service.js +119 -11
  108. package/dist/services/usaspending/usaspending-service.js.map +1 -1
  109. package/package.json +4 -4
  110. package/server.json +3 -3
  111. package/skills/usaspending-guide/SKILL.md +6 -4
@@ -6,9 +6,12 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
7
  import { escapeMarkdownInline } from '@cyanheads/mcp-ts-core/utils';
8
8
  import { getUSASpendingService } from '../../../services/usaspending/usaspending-service.js';
9
+ import { countLimit, LimitClampSchema, limitClampTrailer } from './count-limit.js';
9
10
  import { accountFiscalYearSchema, normalizeAccountFiscalYear } from './fiscal-year.js';
10
11
  import { formatCurrency } from './formatting.js';
11
12
  import { formatPaginationLine } from './pagination.js';
13
+ /** The `federal_accounts/` page maximum. */
14
+ const LIMIT = countLimit({ tool: 'usaspending_search_federal_accounts', default: 10, cap: 100 });
12
15
  export const searchFederalAccountsTool = tool('usaspending_search_federal_accounts', {
13
16
  title: 'Search Federal Accounts',
14
17
  description: 'List and keyword-search federal accounts by directory toptier code or title keyword. Returns account numbers, names, managing agencies, and budgetary resources. fiscal_year selects the resource amounts, not account membership; omit it for the latest available submission year. Search and detail totals use different calculations and can differ for the same year. Use account_number from results as input to usaspending_get_federal_account for full budget detail. Use usaspending_list_agencies to look up the input agency_identifier (directory toptier_code, e.g. "097" for DoD or "1601" for Labor); account rows return their account-prefix agency_identifier, e.g. "016" for Labor.',
@@ -28,13 +31,7 @@ export const searchFederalAccountsTool = tool('usaspending_search_federal_accoun
28
31
  .default('budgetary_resources')
29
32
  .describe('Field to sort results by'),
30
33
  sort_direction: z.enum(['asc', 'desc']).default('desc').describe('Sort direction'),
31
- limit: z
32
- .number()
33
- .int()
34
- .min(1)
35
- .max(100)
36
- .default(10)
37
- .describe('Maximum results per page (1–100)'),
34
+ limit: LIMIT.schema.describe('Accounts per page. Default 10, at most 100 per call.'),
38
35
  page: z.number().int().min(1).default(1).describe('Page number (1-based)'),
39
36
  }),
40
37
  output: z.object({
@@ -85,12 +82,14 @@ export const searchFederalAccountsTool = tool('usaspending_search_federal_accoun
85
82
  .describe('Total number of matching accounts across all pages (when available)'),
86
83
  page: z.number().describe('Current page number returned'),
87
84
  has_next: z.boolean().describe('Whether there are more pages of results'),
85
+ limitClamp: LimitClampSchema,
88
86
  notice: z
89
87
  .string()
90
88
  .optional()
91
- .describe('Recovery hint when results are empty — echoes applied filters and suggests how to broaden. Absent when results are present.'),
89
+ .describe('A reduced limit, and a recovery hint when results are empty — echoes applied filters and suggests how to broaden. Absent when neither applies.'),
92
90
  },
93
91
  enrichmentTrailer: {
92
+ limitClamp: limitClampTrailer,
94
93
  notice: { render: (notice) => (notice ? `> ${escapeMarkdownInline(notice)}` : '') },
95
94
  },
96
95
  errors: [
@@ -117,11 +116,12 @@ export const searchFederalAccountsTool = tool('usaspending_search_federal_accoun
117
116
  agency_identifier: input.agency_identifier,
118
117
  page: input.page,
119
118
  });
119
+ const limit = LIMIT.apply(ctx, 'limit', input.limit);
120
120
  const svc = getUSASpendingService();
121
121
  const body = {
122
122
  sort: { field: input.sort_field, direction: input.sort_direction },
123
123
  page: input.page,
124
- limit: input.limit,
124
+ limit: limit.applied,
125
125
  };
126
126
  if (input.keyword)
127
127
  body.keyword = input.keyword;
@@ -162,17 +162,19 @@ export const searchFederalAccountsTool = tool('usaspending_search_federal_accoun
162
162
  page: currentPage,
163
163
  has_next: hasNext,
164
164
  });
165
+ const notices = limit.notice ? [limit.notice] : [];
165
166
  if (results.length === 0) {
166
167
  const filterParts = [];
167
168
  if (input.keyword)
168
169
  filterParts.push(`keyword="${input.keyword}"`);
169
170
  if (input.agency_identifier)
170
171
  filterParts.push(`agency_identifier="${input.agency_identifier}"`);
171
- const notice = filterParts.length > 0
172
+ notices.push(filterParts.length > 0
172
173
  ? `No federal accounts matched: ${filterParts.join(', ')}. Try removing filters or using a broader keyword.`
173
- : 'No federal accounts matched. Try a different keyword or agency identifier.';
174
- ctx.enrich.notice(notice);
174
+ : 'No federal accounts matched. Try a different keyword or agency identifier.');
175
175
  }
176
+ if (notices.length)
177
+ ctx.enrich.notice(notices.join(' '));
176
178
  return {
177
179
  ...(fiscalYear !== undefined ? { fiscal_year: fiscalYear } : {}),
178
180
  results,
@@ -180,7 +182,7 @@ export const searchFederalAccountsTool = tool('usaspending_search_federal_accoun
180
182
  ...(total !== undefined ? { count: total } : {}),
181
183
  page: currentPage,
182
184
  has_next: hasNext,
183
- limit: input.limit,
185
+ limit: limit.applied,
184
186
  },
185
187
  };
186
188
  },
@@ -1 +1 @@
1
- {"version":3,"file":"search-federal-accounts.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-federal-accounts.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,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,qCAAqC,EAAE;IACnF,KAAK,EAAE,yBAAyB;IAChC,WAAW,EACT,yqBAAyqB;IAC3qB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;IAE9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,8EAA8E,CAAC;QAC3F,iBAAiB,EAAE,CAAC;aACjB,MAAM,EAAE;aACR,QAAQ,E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AAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,cAAc,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC;YAC3F,IAAI,CAAC,CAAC,cAAc;gBAClB,KAAK,CAAC,IAAI,CAAC,uBAAuB,oBAAoB,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YAC9E,IAAI,CAAC,CAAC,iBAAiB;gBACrB,KAAK,CAAC,IAAI,CAAC,kBAAkB,oBAAoB,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YAC5E,IAAI,CAAC,CAAC,eAAe;gBACnB,KAAK,CAAC,IAAI,CACR,wBAAwB,oBAAoB,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC7J,CAAC;YACJ,IAAI,OAAO,CAAC,CAAC,mBAAmB,KAAK,QAAQ;gBAC3C,KAAK,CAAC,IAAI,CAAC,4BAA4B,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"search-federal-accounts.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-federal-accounts.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,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,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AuB,oBAAoB,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;YAC9E,IAAI,CAAC,CAAC,iBAAiB;gBACrB,KAAK,CAAC,IAAI,CAAC,kBAAkB,oBAAoB,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YAC5E,IAAI,CAAC,CAAC,eAAe;gBACnB,KAAK,CAAC,IAAI,CACR,wBAAwB,oBAAoB,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC7J,CAAC;YACJ,IAAI,OAAO,CAAC,CAAC,mBAAmB,KAAK,QAAQ;gBAC3C,KAAK,CAAC,IAAI,CAAC,4BAA4B,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -49,6 +49,11 @@ export declare const searchRecipientsTool: import("@cyanheads/mcp-ts-core").Tool
49
49
  readonly totalCount: z.ZodOptional<z.ZodNumber>;
50
50
  readonly page: z.ZodNumber;
51
51
  readonly has_next: z.ZodBoolean;
52
+ readonly limitClamp: z.ZodOptional<z.ZodObject<{
53
+ field: z.ZodString;
54
+ requested: z.ZodNumber;
55
+ applied: z.ZodNumber;
56
+ }, z.core.$strip>>;
52
57
  readonly notice: z.ZodOptional<z.ZodString>;
53
58
  }>;
54
59
  //# sourceMappingURL=search-recipients.tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search-recipients.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-recipients.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0M/B,CAAC"}
1
+ {"version":3,"file":"search-recipients.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-recipients.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAUjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuM/B,CAAC"}
@@ -6,8 +6,11 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
7
  import { escapeMarkdownInline } from '@cyanheads/mcp-ts-core/utils';
8
8
  import { getUSASpendingService } from '../../../services/usaspending/usaspending-service.js';
9
+ import { countLimit, LimitClampSchema, limitClampTrailer } from './count-limit.js';
9
10
  import { formatCurrency } from './formatting.js';
10
11
  import { emptyPageNotice, formatPaginationLine } from './pagination.js';
12
+ /** The `recipient/` page maximum; a full 1,000-row page measures about 170–200 KB per surface. */
13
+ const LIMIT = countLimit({ tool: 'usaspending_search_recipients', default: 10, cap: 1000 });
11
14
  export const searchRecipientsTool = tool('usaspending_search_recipients', {
12
15
  title: 'Search Award Recipients',
13
16
  description: 'Search for organizations or individuals receiving federal funds by name, UEI (Unique Entity Identifier), or DUNS. Returns recipient hash IDs, UEI/DUNS identifiers, total award amounts, and hierarchy level. Results are paginated — use page to retrieve matches beyond the first page; page_metadata.total reports the full match count. Recipient hash IDs from this tool can be passed to usaspending_get_recipient for full profiles. Recipient level: P = parent organization, C = child entity, R = standalone.',
@@ -21,13 +24,7 @@ export const searchRecipientsTool = tool('usaspending_search_recipients', {
21
24
  .enum(['contracts', 'grants', 'direct_payments', 'loans', 'other_financial_assistance'])
22
25
  .optional()
23
26
  .describe('Filter by award type category to scope the total amounts returned'),
24
- limit: z
25
- .number()
26
- .int()
27
- .min(1)
28
- .max(100)
29
- .default(10)
30
- .describe('Maximum results per page (1–100)'),
27
+ limit: LIMIT.schema.describe('Recipients per page. Default 10, at most 1,000 per call.'),
31
28
  page: z
32
29
  .number()
33
30
  .int()
@@ -77,12 +74,14 @@ export const searchRecipientsTool = tool('usaspending_search_recipients', {
77
74
  totalCount: z.number().optional().describe('Total matching recipients across all pages'),
78
75
  page: z.number().describe('Current page number returned'),
79
76
  has_next: z.boolean().describe('Whether there are more pages of results'),
77
+ limitClamp: LimitClampSchema,
80
78
  notice: z
81
79
  .string()
82
80
  .optional()
83
- .describe('Blank-keyword disclosure and pagination recovery. An empty page is distinguished from a known zero total; absent when no notice applies.'),
81
+ .describe('A reduced limit, blank-keyword disclosure, and pagination recovery. An empty page is distinguished from a known zero total; absent when no notice applies.'),
84
82
  },
85
83
  enrichmentTrailer: {
84
+ limitClamp: limitClampTrailer,
86
85
  notice: { render: (notice) => (notice ? `> ${escapeMarkdownInline(notice)}` : '') },
87
86
  },
88
87
  errors: [
@@ -109,12 +108,13 @@ export const searchRecipientsTool = tool('usaspending_search_recipients', {
109
108
  page: input.page,
110
109
  limit: input.limit,
111
110
  });
111
+ const limit = LIMIT.apply(ctx, 'limit', input.limit);
112
112
  const svc = getUSASpendingService();
113
113
  const keyword = input.keyword.trim();
114
114
  const data = await svc.searchRecipients({
115
115
  ...(keyword ? { keyword } : {}),
116
116
  ...(input.award_type !== undefined ? { award_type: input.award_type } : {}),
117
- limit: input.limit,
117
+ limit: limit.applied,
118
118
  page: input.page,
119
119
  }, ctx);
120
120
  const results = (data.results ?? []).map((r) => ({
@@ -138,11 +138,11 @@ export const searchRecipientsTool = tool('usaspending_search_recipients', {
138
138
  ctx.enrich({ recipient_count: results.length, page: currentPage, has_next: hasNext });
139
139
  if (total !== undefined)
140
140
  ctx.enrich.total(total);
141
- const notices = [];
141
+ const notices = limit.notice ? [limit.notice] : [];
142
142
  if (!keyword)
143
143
  notices.push('No keyword filter was applied because keyword was blank after trimming; any award_type filter still applies.');
144
144
  if (results.length === 0) {
145
- notices.push(emptyPageNotice(currentPage, input.limit, total, `No recipients matched${keyword ? ` "${keyword}"` : ' the selected filters'}. Try a partial name, different spelling, or a UEI number directly.`));
145
+ notices.push(emptyPageNotice(currentPage, limit.applied, total, `No recipients matched${keyword ? ` "${keyword}"` : ' the selected filters'}. Try a partial name, different spelling, or a UEI number directly.`));
146
146
  }
147
147
  else if (hasNext) {
148
148
  const totalNote = total !== undefined ? ` (${total.toLocaleString()} total)` : '';
@@ -156,7 +156,7 @@ export const searchRecipientsTool = tool('usaspending_search_recipients', {
156
156
  ...(total !== undefined ? { total } : {}),
157
157
  page: currentPage,
158
158
  has_next: hasNext,
159
- limit: input.limit,
159
+ limit: limit.applied,
160
160
  },
161
161
  };
162
162
  },
@@ -1 +1 @@
1
- {"version":3,"file":"search-recipients.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-recipients.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,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,+BAA+B,EAAE;IACxE,KAAK,EAAE,yBAAyB;IAChC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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"search-recipients.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-recipients.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,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAExE,kGAAkG;AAClG,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,+BAA+B,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;AAE5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,+BAA+B,EAAE;IACxE,KAAK,EAAE,yBAAyB;IAChC,WAAW,EACT,yfAAyf;IAC3f,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;IAE9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,sKAAsK,CACvK;QACH,UAAU,EAAE,CAAC;aACV,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE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  awarding_agency: "awarding_agency";
10
10
  awarding_subagency: "awarding_subagency";
11
11
  cfda: "cfda";
12
+ defc: "defc";
13
+ federal_account: "federal_account";
12
14
  funding_agency: "funding_agency";
13
15
  funding_subagency: "funding_subagency";
14
16
  naics: "naics";
@@ -19,6 +21,18 @@ export declare const spendingByCategoryTool: import("@cyanheads/mcp-ts-core").To
19
21
  assistance_listings: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
22
  psc_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
23
  def_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
+ place_of_performance_location: z.ZodOptional<z.ZodObject<{
25
+ country: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
26
+ state: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
27
+ county: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
28
+ city: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>>;
30
+ recipient_location: z.ZodOptional<z.ZodObject<{
31
+ country: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
32
+ state: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
33
+ county: z.ZodOptional<z.ZodPreprocess<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>, unknown>>;
34
+ city: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strict>>;
22
36
  keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
37
  award_type_codes: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
38
  agency_name: z.ZodOptional<z.ZodString>;
@@ -35,6 +49,7 @@ export declare const spendingByCategoryTool: import("@cyanheads/mcp-ts-core").To
35
49
  id: z.ZodOptional<z.ZodString>;
36
50
  code: z.ZodOptional<z.ZodString>;
37
51
  name: z.ZodOptional<z.ZodString>;
52
+ agency_slug: z.ZodOptional<z.ZodString>;
38
53
  amount: z.ZodOptional<z.ZodNumber>;
39
54
  recipient_id: z.ZodOptional<z.ZodString>;
40
55
  uei: z.ZodOptional<z.ZodString>;
@@ -63,6 +78,12 @@ export declare const spendingByCategoryTool: import("@cyanheads/mcp-ts-core").To
63
78
  readonly when: "An active analytics recipient_id is malformed.";
64
79
  readonly retryable: false;
65
80
  readonly recovery: "Use recipient_id from usaspending_search_recipients: hexadecimal 8-4-4-4-12 hash followed by uppercase -P, -C, or -R.";
81
+ }, {
82
+ readonly reason: "invalid_location";
83
+ readonly code: JsonRpcErrorCode.ValidationError;
84
+ readonly when: "filters.place_of_performance_location or filters.recipient_location 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.";
85
+ readonly retryable: false;
86
+ readonly recovery: "Under country USA (the default) or a US territory code, send state as a postal code (NM) or 2-digit FIPS code (35), and 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.";
66
87
  }, {
67
88
  readonly reason: "api_unavailable";
68
89
  readonly code: JsonRpcErrorCode.ServiceUnavailable;
@@ -112,8 +133,15 @@ export declare const spendingByCategoryTool: import("@cyanheads/mcp-ts-core").To
112
133
  readonly applied_assistance_listings: z.ZodOptional<z.ZodString>;
113
134
  readonly applied_psc_codes: z.ZodOptional<z.ZodString>;
114
135
  readonly applied_def_codes: z.ZodOptional<z.ZodString>;
136
+ readonly applied_location: z.ZodOptional<z.ZodString>;
137
+ readonly applied_recipient_location: z.ZodOptional<z.ZodString>;
115
138
  readonly applied_time_period_start: z.ZodOptional<z.ZodString>;
116
139
  readonly applied_time_period_end: z.ZodOptional<z.ZodString>;
140
+ readonly limitClamp: z.ZodOptional<z.ZodObject<{
141
+ field: z.ZodString;
142
+ requested: z.ZodNumber;
143
+ applied: z.ZodNumber;
144
+ }, z.core.$strip>>;
117
145
  readonly notice: z.ZodOptional<z.ZodString>;
118
146
  }>;
119
147
  //# sourceMappingURL=spending-by-category.tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spending-by-category.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/spending-by-category.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAqBjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsWjC,CAAC"}
1
+ {"version":3,"file":"spending-by-category.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/spending-by-category.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA8BjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6ZjC,CAAC"}
@@ -6,13 +6,16 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
7
  import { escapeMarkdownInline } from '@cyanheads/mcp-ts-core/utils';
8
8
  import { getUSASpendingService } from '../../../services/usaspending/usaspending-service.js';
9
+ import { countLimit, LimitClampSchema, limitClampTrailer } from './count-limit.js';
9
10
  import { ANALYTICS_DATE_FIELDS, filledBoundNotice, floorViolationMessage, invertedRangeMessage, optionalIsoDate, } from './dates.js';
10
- import { analyticsTypeMismatch, buildFilters, CODE_FILTER_FIELDS, codeFilterEcho, describeCodeFilters, normalizeEffectiveFilters, } from './filters.js';
11
+ import { analyticsTypeMismatch, applyLocationFilters, buildFilters, CODE_FILTER_FIELDS, codeFilterEcho, describeCodeFilters, describeLocationFilters, LOCATION_FILTER_FIELDS, locationFilterEcho, normalizeEffectiveFilters, resolveLocationFilters, } from './filters.js';
11
12
  import { formatCurrency } from './formatting.js';
12
13
  import { formatPaginationLine } from './pagination.js';
14
+ /** Upstream's page maximum; one above it answers HTTP 422. */
15
+ const LIMIT = countLimit({ tool: 'usaspending_spending_by_category', default: 10, cap: 100 });
13
16
  export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
14
17
  title: 'Spending by Category',
15
- description: 'Aggregate federal spending grouped by a specific dimension: NAICS industry code, PSC product/service code, awarding agency, funding agency, CFDA assistance program, or recipient. Returns top items with obligation amounts — useful for trend and breakdown analysis. Filter by keyword, award type, agency, recipient, NAICS code, Assistance Listing, PSC, DEF code, or date range. Chain NAICS, PSC, and CFDA codes back into these filters, into usaspending_search_awards filters, or into usaspending_autocomplete_filters lookups. recipient_duns rows carry recipient_id, which opens the recipient profile in usaspending_get_recipient, and uei.',
18
+ description: 'Aggregate federal spending grouped by a specific dimension: NAICS industry code, PSC product/service code, awarding or funding agency or subagency, CFDA assistance program, recipient, federal account, or Disaster Emergency Fund Code (DEF). Returns top items with obligation amounts — useful for trend and breakdown analysis. Filter by keyword, award type, agency, recipient, NAICS code, Assistance Listing, PSC, DEF code, place of performance or recipient location, or date range. federal_account and defc amounts are whole transaction obligations, counted under every federal account or DEF code the award carries, so rows overlap and never sum to a total; on defc, filters.def_codes selects awards but the rows still list every code those awards carry. Chain NAICS, PSC, CFDA, and DEF codes back into these filters, into usaspending_search_awards filters, or into usaspending_autocomplete_filters lookups; a federal_account code (AGENCY-MAIN, e.g. 047-4534) opens in usaspending_get_federal_account. Agency rows carry agency_slug, which opens the agency in usaspending_get_agency — on a subagency row, its parent department. recipient_duns rows carry recipient_id, which opens the recipient profile in usaspending_get_recipient, and uei.',
16
19
  annotations: { readOnlyHint: true, openWorldHint: true, idempotentHint: true },
17
20
  input: z.object({
18
21
  category: z
@@ -25,8 +28,10 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
25
28
  'funding_subagency',
26
29
  'cfda',
27
30
  'recipient_duns',
31
+ 'federal_account',
32
+ 'defc',
28
33
  ])
29
- .describe('Breakdown dimension: naics (industry), psc (product/service code), awarding_agency, awarding_subagency, funding_agency, funding_subagency, cfda (assistance programs), or recipient_duns (recipients)'),
34
+ .describe('Breakdown dimension: naics (industry), psc (product/service code), awarding_agency, awarding_subagency, funding_agency, funding_subagency, cfda (assistance programs), recipient_duns (recipients), federal_account (appropriations accounts; code is the AGENCY-MAIN account code usaspending_get_federal_account takes), or defc (Disaster Emergency Fund Codes; code is the DEF code the def_codes filters take). federal_account and defc amounts are whole transaction obligations, counted under every account or DEF code the award carries, so rows overlap and never sum to a total; on defc, filters.def_codes selects awards but the rows still list every code those awards carry.'),
30
35
  filters: z
31
36
  .object({
32
37
  keywords: z
@@ -50,13 +55,14 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
50
55
  .optional()
51
56
  .describe('NAICS codes: canonical 2, 4, or 6 digits; recognized ASCII integer aliases normalize whitespace, plus, leading zeros and digit underscores; unclassified spellings remain provider-validated'),
52
57
  ...CODE_FILTER_FIELDS,
58
+ ...LOCATION_FILTER_FIELDS,
53
59
  time_period_start: optionalIsoDate('Start date (YYYY-MM-DD), 2007-10-01 or later. Given alone, the window runs through today (UTC).'),
54
60
  time_period_end: optionalIsoDate('End date (YYYY-MM-DD). Given alone, the window starts at 2007-10-01, the earliest searchable date.'),
55
61
  })
56
62
  .strict()
57
63
  .optional()
58
64
  .describe('Optional filters to scope the aggregation'),
59
- limit: z.number().int().min(1).max(100).default(10).describe('Maximum items to return (1–100)'),
65
+ limit: LIMIT.schema.describe('Items per page. Default 10, at most 100 per call.'),
60
66
  page: z.number().int().min(1).default(1).describe('Page number (1-based)'),
61
67
  }),
62
68
  output: z.object({
@@ -64,12 +70,19 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
64
70
  results: z
65
71
  .array(z
66
72
  .object({
67
- id: z.string().optional().describe('Item identifier (varies by category)'),
73
+ id: z
74
+ .string()
75
+ .optional()
76
+ .describe('Item identifier (varies by category); absent on recipient_duns and defc rows'),
68
77
  code: z
69
78
  .string()
70
79
  .optional()
71
- .describe('Code value (NAICS, PSC, CFDA number, recipient DUNS, etc.)'),
80
+ .describe('Code value: NAICS, PSC, agency code, CFDA number, recipient DUNS, federal account code (AGENCY-MAIN, e.g. 047-4534), or DEF code (e.g. Z)'),
72
81
  name: z.string().optional().describe('Item name or description'),
82
+ agency_slug: z
83
+ .string()
84
+ .optional()
85
+ .describe("Agency slug (awarding_agency, awarding_subagency, funding_agency, funding_subagency rows; on a subagency row, its parent department's) — pass to usaspending_get_agency as agency_slug. Absent when upstream has none."),
73
86
  amount: z.number().optional().describe('Total obligation amount in USD'),
74
87
  recipient_id: z
75
88
  .string()
@@ -121,6 +134,14 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
121
134
  .string()
122
135
  .optional()
123
136
  .describe('DEF codes sent, uppercased (comma-separated)'),
137
+ applied_location: z
138
+ .string()
139
+ .optional()
140
+ .describe('Place of performance location sent, as normalized (e.g. country=USA, state=NM, county=049)'),
141
+ applied_recipient_location: z
142
+ .string()
143
+ .optional()
144
+ .describe('Recipient location sent, as normalized (e.g. country=USA, state=WA)'),
124
145
  applied_time_period_start: z
125
146
  .string()
126
147
  .optional()
@@ -129,12 +150,14 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
129
150
  .string()
130
151
  .optional()
131
152
  .describe('End date sent (YYYY-MM-DD), including a filled-in end'),
153
+ limitClamp: LimitClampSchema,
132
154
  notice: z
133
155
  .string()
134
156
  .optional()
135
- .describe('Names a date bound that was filled in because only the other was supplied, and — when results are empty — names any Assistance Listing, PSC, or DEF codes sent and suggests how to broaden filters. Absent when neither applies.'),
157
+ .describe('Names a limit reduced to the per-call maximum, a date bound that was filled in because only the other was supplied, and — when results are empty — any Assistance Listing, PSC, or DEF codes, recipient_id, and locations sent, with how to broaden filters. Absent when none applies.'),
136
158
  },
137
159
  enrichmentTrailer: {
160
+ limitClamp: limitClampTrailer,
138
161
  notice: { render: (notice) => (notice ? `> ${escapeMarkdownInline(notice)}` : '') },
139
162
  },
140
163
  errors: [
@@ -159,6 +182,13 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
159
182
  retryable: false,
160
183
  recovery: 'Use recipient_id from usaspending_search_recipients: hexadecimal 8-4-4-4-12 hash followed by uppercase -P, -C, or -R.',
161
184
  },
185
+ {
186
+ reason: 'invalid_location',
187
+ code: JsonRpcErrorCode.ValidationError,
188
+ when: 'filters.place_of_performance_location or filters.recipient_location 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.',
189
+ retryable: false,
190
+ recovery: "Under country USA (the default) or a US territory code, send state as a postal code (NM) or 2-digit FIPS code (35), and 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.",
191
+ },
162
192
  {
163
193
  reason: 'api_unavailable',
164
194
  code: JsonRpcErrorCode.ServiceUnavailable,
@@ -205,16 +235,22 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
205
235
  },
206
236
  ],
207
237
  async handler(input, ctx) {
238
+ const limit = LIMIT.apply(ctx, 'limit', input.limit);
208
239
  ctx.log.info('usaspending_spending_by_category', {
209
240
  category: input.category,
210
- limit: input.limit,
241
+ limit: limit.applied,
211
242
  page: input.page,
212
243
  });
213
244
  const svc = getUSASpendingService();
214
245
  const effective = normalizeEffectiveFilters(input.filters ?? {});
215
246
  if ('reason' in effective)
216
247
  throw ctx.fail(effective.reason, effective.message);
248
+ const located = resolveLocationFilters(input.filters ?? {});
249
+ if (!located.ok)
250
+ throw ctx.fail('invalid_location', located.message);
251
+ const { locations } = located;
217
252
  const { filters, timePeriod, codes } = buildFilters({ ...input.filters, ...effective });
253
+ applyLocationFilters(filters, locations);
218
254
  const inverted = invertedRangeMessage(timePeriod, ANALYTICS_DATE_FIELDS);
219
255
  if (inverted) {
220
256
  throw ctx.fail('date_range_inverted', inverted);
@@ -232,11 +268,12 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
232
268
  if (mismatch?.filter === 'psc_codes') {
233
269
  throw ctx.fail('psc_codes_type_mismatch', mismatch.message);
234
270
  }
235
- const data = await svc.spendingByCategory(input.category, { filters, limit: input.limit, page: input.page }, ctx);
271
+ const data = await svc.spendingByCategory(input.category, { filters, limit: limit.applied, page: input.page }, ctx);
236
272
  const results = (data.results ?? []).map((r) => ({
237
273
  ...(r.id != null ? { id: String(r.id) } : {}),
238
274
  ...(r.code ? { code: r.code } : {}),
239
275
  ...(r.name || r.description ? { name: r.name ?? r.description ?? undefined } : {}),
276
+ ...(r.agency_slug ? { agency_slug: r.agency_slug } : {}),
240
277
  ...(typeof r.amount === 'number' ? { amount: r.amount } : {}),
241
278
  ...(r.recipient_id ? { recipient_id: r.recipient_id } : {}),
242
279
  ...(r.uei ? { uei: r.uei } : {}),
@@ -253,7 +290,7 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
253
290
  has_next: pageMeta.hasNext ?? false,
254
291
  page: pageMeta.page ?? input.page,
255
292
  ...(typeof pageMeta.total === 'number' ? { total: pageMeta.total } : {}),
256
- limit: input.limit,
293
+ limit: limit.applied,
257
294
  };
258
295
  if (typeof page_metadata.total === 'number')
259
296
  ctx.enrich.total(page_metadata.total);
@@ -269,6 +306,7 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
269
306
  ? { applied_naics_codes: effective.naics_codes.join(', ') }
270
307
  : {}),
271
308
  ...codeFilterEcho(codes),
309
+ ...locationFilterEcho(locations),
272
310
  ...(timePeriod
273
311
  ? {
274
312
  applied_time_period_start: timePeriod.start_date,
@@ -277,11 +315,12 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
277
315
  : {}),
278
316
  });
279
317
  // enrich.notice is last-wins, so every notice source joins into one string.
280
- const notices = [filledBoundNotice(timePeriod, ANALYTICS_DATE_FIELDS)];
318
+ const notices = [limit.notice, filledBoundNotice(timePeriod, ANALYTICS_DATE_FIELDS)];
281
319
  if (results.length === 0) {
282
320
  const codeParts = describeCodeFilters(codes);
283
321
  if (effective.recipient_id)
284
322
  codeParts.push(`recipient_id=${effective.recipient_id}`);
323
+ codeParts.push(...describeLocationFilters(locations));
285
324
  notices.push(`No ${input.category} data matched the filters${codeParts.length ? ` (${codeParts.join(', ')})` : ''}. Try broadening filters or selecting a different category.`);
286
325
  }
287
326
  const notice = notices.filter(Boolean).join(' ');
@@ -296,25 +335,37 @@ export const spendingByCategoryTool = tool('usaspending_spending_by_category', {
296
335
  ];
297
336
  if (result.results.length > 0) {
298
337
  /**
299
- * Recipient identifiers get their own columns only when a row carries one, so
300
- * other categories keep their table; a missing one is an empty cell.
338
+ * Recipient identifiers and agency slugs get their own columns only when a row
339
+ * carries one, so other categories keep their table; a missing one is an empty cell.
301
340
  */
302
341
  const recipientCols = result.results.some((r) => r.recipient_id || r.uei);
303
- lines.push('');
304
- if (recipientCols) {
305
- lines.push('| Rank | ID | Name | Code | UEI | Recipient ID | Obligation |');
306
- lines.push('|:-----|:---|:-----|:-----|:----|:-------------|:-----------|');
307
- }
308
- else {
309
- lines.push('| Rank | ID | Name | Code | Obligation |');
310
- lines.push('|:-----|:---|:-----|:-----|:-----------|');
311
- }
342
+ const slugCol = result.results.some((r) => r.agency_slug);
343
+ const header = [
344
+ 'Rank',
345
+ 'ID',
346
+ 'Name',
347
+ 'Code',
348
+ ...(recipientCols ? ['UEI', 'Recipient ID'] : []),
349
+ ...(slugCol ? ['Agency Slug'] : []),
350
+ 'Obligation',
351
+ ];
352
+ lines.push('', `| ${header.join(' | ')} |`);
353
+ lines.push(`|${header.map((h) => `:${'-'.repeat(h.length + 1)}`).join('|')}|`);
354
+ // Ranks continue across pages: page 2 at limit 3 starts at 4.
355
+ const firstRank = (result.page_metadata.page - 1) * result.page_metadata.limit + 1;
312
356
  result.results.forEach((r, i) => {
313
- const amt = r.amount !== undefined ? formatCurrency(r.amount) : 'N/A';
314
- const recipient = recipientCols
315
- ? ` ${escapeMarkdownInline(r.uei ?? '')} | ${escapeMarkdownInline(r.recipient_id ?? '')} |`
316
- : '';
317
- lines.push(`| ${i + 1} | ${escapeMarkdownInline(r.id ?? 'N/A')} | ${escapeMarkdownInline(r.name ?? 'N/A')} | ${escapeMarkdownInline(r.code ?? 'N/A')} |${recipient} ${amt} |`);
357
+ const cells = [
358
+ String(firstRank + i),
359
+ escapeMarkdownInline(r.id ?? 'N/A'),
360
+ escapeMarkdownInline(r.name ?? 'N/A'),
361
+ escapeMarkdownInline(r.code ?? 'N/A'),
362
+ ...(recipientCols
363
+ ? [escapeMarkdownInline(r.uei ?? ''), escapeMarkdownInline(r.recipient_id ?? '')]
364
+ : []),
365
+ ...(slugCol ? [escapeMarkdownInline(r.agency_slug ?? '')] : []),
366
+ r.amount !== undefined ? formatCurrency(r.amount) : 'N/A',
367
+ ];
368
+ lines.push(`| ${cells.join(' | ')} |`);
318
369
  });
319
370
  }
320
371
  return [{ type: 'text', text: lines.join('\n') }];