@cyanheads/congressgov-mcp-server 0.4.3 → 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 (47) hide show
  1. package/AGENTS.md +19 -5
  2. package/CLAUDE.md +19 -5
  3. package/README.md +3 -1
  4. package/dist/index.js +2 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.d.ts +9 -0
  7. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.d.ts.map +1 -1
  8. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.js +46 -15
  9. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.js.map +1 -1
  10. package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts +38 -0
  11. package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts.map +1 -1
  12. package/dist/mcp-server/tools/definitions/bill-lookup.tool.js +72 -4
  13. package/dist/mcp-server/tools/definitions/bill-lookup.tool.js.map +1 -1
  14. package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts +37 -0
  15. package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts.map +1 -1
  16. package/dist/mcp-server/tools/definitions/committee-reports.tool.js +66 -7
  17. package/dist/mcp-server/tools/definitions/committee-reports.tool.js.map +1 -1
  18. package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts +41 -3
  19. package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/daily-record.tool.js +61 -8
  21. package/dist/mcp-server/tools/definitions/daily-record.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/format-helpers.d.ts +9 -5
  23. package/dist/mcp-server/tools/format-helpers.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/format-helpers.js +397 -89
  25. package/dist/mcp-server/tools/format-helpers.js.map +1 -1
  26. package/dist/mcp-server/tools/tool-helpers.d.ts +67 -0
  27. package/dist/mcp-server/tools/tool-helpers.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/tool-helpers.js +85 -0
  29. package/dist/mcp-server/tools/tool-helpers.js.map +1 -1
  30. package/dist/services/congress-documents/congress-documents-service.d.ts +71 -0
  31. package/dist/services/congress-documents/congress-documents-service.d.ts.map +1 -0
  32. package/dist/services/congress-documents/congress-documents-service.js +271 -0
  33. package/dist/services/congress-documents/congress-documents-service.js.map +1 -0
  34. package/dist/services/congress-documents/document-formats.d.ts +29 -0
  35. package/dist/services/congress-documents/document-formats.d.ts.map +1 -0
  36. package/dist/services/congress-documents/document-formats.js +51 -0
  37. package/dist/services/congress-documents/document-formats.js.map +1 -0
  38. package/dist/services/congress-documents/extract-text.d.ts +21 -0
  39. package/dist/services/congress-documents/extract-text.d.ts.map +1 -0
  40. package/dist/services/congress-documents/extract-text.js +81 -0
  41. package/dist/services/congress-documents/extract-text.js.map +1 -0
  42. package/dist/services/congress-documents/types.d.ts +45 -0
  43. package/dist/services/congress-documents/types.d.ts.map +1 -0
  44. package/dist/services/congress-documents/types.js +6 -0
  45. package/dist/services/congress-documents/types.js.map +1 -0
  46. package/package.json +1 -1
  47. package/server.json +3 -3
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** congressgov-mcp-server
4
- **Version:** 0.4.3
4
+ **Version:** 0.5.0
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.5`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
@@ -68,7 +68,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
68
68
 
69
69
  | Name | Description |
70
70
  |:-----|:------------|
71
- | `congressgov_bill_lookup` | Browse, filter, and retrieve bill data (actions, sponsors, summaries, text, related bills) |
71
+ | `congressgov_bill_lookup` | Browse, filter, and retrieve bill data (actions, sponsors, summaries, text, related bills) + bounded document text via `content` |
72
72
  | `congressgov_enacted_laws` | Browse enacted public and private laws by congress |
73
73
  | `congressgov_member_lookup` | Discover members by state/district/congress, retrieve legislative portfolios |
74
74
  | `congressgov_committee_lookup` | Browse committees and retrieve legislation, reports, nominations |
@@ -76,8 +76,8 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
76
76
  | `congressgov_senate_nominations` | Browse presidential nominations, track Senate confirmation pipeline |
77
77
  | `congressgov_bill_summaries` | Browse recent CRS bill summaries — the "what's happening" feed |
78
78
  | `congressgov_crs_reports` | Browse and retrieve nonpartisan CRS policy analysis reports |
79
- | `congressgov_committee_reports` | Browse and retrieve committee reports accompanying legislation |
80
- | `congressgov_daily_record` | Browse daily Congressional Record — floor speeches, debates, proceedings |
79
+ | `congressgov_committee_reports` | Browse and retrieve committee reports accompanying legislation + bounded report text via `content` |
80
+ | `congressgov_daily_record` | Browse daily Congressional Record — floor speeches, debates, proceedings + bounded article text via `content` |
81
81
  | `congressgov_search_bills` | Keyword-search bill titles/summaries via the opt-in local FTS mirror — off by default |
82
82
 
83
83
  ### Resources (5)
@@ -110,6 +110,11 @@ src/
110
110
  congress-api/
111
111
  congress-api-service.ts # API client — auth, pagination, rate limiting
112
112
  types.ts # API response types
113
+ congress-documents/
114
+ congress-documents-service.ts # www.congress.gov document fetch — host allowlist, byte ceiling, character window
115
+ document-formats.ts # Format label → URL resolution over upstream format lists
116
+ extract-text.ts # GPO `<pre>` / XML body → deterministic plain text
117
+ types.ts # Document format + content window types
113
118
  congress-mirror/
114
119
  congress-mirror-service.ts # Mirror read path — FTS5 search, ready(), sync accessor
115
120
  ingest.ts # Bill list + CRS summaries sync generator
@@ -153,7 +158,7 @@ scripts/
153
158
 
154
159
  ## Services
155
160
 
156
- Three services. `CongressApiService` backs nine tools and the House branch of `congressgov_roll_votes`; `SenateVoteService` backs only the Senate branch of `congressgov_roll_votes` (the Congress.gov API exposes no Senate vote namespace); `CongressMirrorService` backs `congressgov_search_bills` only.
161
+ Four services. `CongressApiService` backs nine tools and the House branch of `congressgov_roll_votes`; `SenateVoteService` backs only the Senate branch of `congressgov_roll_votes` (the Congress.gov API exposes no Senate vote namespace); `CongressMirrorService` backs `congressgov_search_bills` only; `CongressDocumentsService` backs the `content` operation on `congressgov_bill_lookup`, `congressgov_committee_reports`, and `congressgov_daily_record`.
157
162
 
158
163
  **`CongressApiService`** — wraps the Congress.gov REST API v3:
159
164
  - API key via `X-Api-Key` header (never logged; kept out of the URL so it can't leak in upstream error messages)
@@ -168,6 +173,13 @@ Three services. `CongressApiService` backs nine tools and the House branch of `c
168
173
  - The host returns HTTP 200 with an HTML page for unknown congress/session/vote, so "not found" is detected from the body, not the status code
169
174
  - Party totals are derived from the roster (the feed publishes none)
170
175
 
176
+ **`CongressDocumentsService`** — reads the document bodies behind Congress.gov's format URLs (`www.congress.gov`):
177
+ - A second host, so a sibling service rather than a method on `CongressApiService` — no API key, no JSON, documents past a megabyte
178
+ - URLs are resolved from upstream format metadata and checked against a `www.congress.gov` allowlist; a caller never supplies one
179
+ - The fetch is bounded: a 5 MB ceiling (refused on `Content-Length`, else mid-stream), a 30s deadline, and a content-type allowlist
180
+ - The response is bounded by an exact character window — offsets index the extracted plain text and are never snapped to section breaks, so feeding `nextOffset` back walks a document with no overlap and no gap
181
+ - `extract-text.ts` unwraps GPO's `<pre>` print output verbatim (whitespace is the document's structure) and decodes entities in one pass
182
+
171
183
  **`CongressMirrorService`** — local SQLite FTS5 mirror of bill title + CRS summary text, backing `congressgov_search_bills` only:
172
184
  - Opt-in via `CONGRESS_MIRROR_ENABLED` (off by default); built out-of-band via the `mirror:init`/`mirror:refresh` scripts, never on server startup
173
185
  - No live-API fallback — ingests through the existing `CongressApiService`, and a mirror that hasn't finished its initial build returns an empty result with a notice, not an error
@@ -198,6 +210,8 @@ All tools share these patterns. The service layer handles them uniformly:
198
210
  | Invalid params | `validationError('...', { field })` |
199
211
  | Network error | `serviceUnavailable('Unable to reach the Congress.gov API.')` |
200
212
 
213
+ The `content` operation adds `documentErrorContracts` (tool-helpers) on top: `document_unavailable`, `format_unavailable`, `document_fetch_failed`, `document_too_large`, and `offset_past_end`. `CongressDocumentsService` raises each with a matching `data.reason` and resolves the hint via `ctx.recoveryFor` — note that `ctx.fail` does **not** auto-populate `recovery`, so handler-side `ctx.fail` calls must spread `ctx.recoveryFor(reason)` into their data or the hint never reaches the wire.
214
+
201
215
  ---
202
216
 
203
217
  ## Naming
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** congressgov-mcp-server
4
- **Version:** 0.4.3
4
+ **Version:** 0.5.0
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.5`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
@@ -68,7 +68,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
68
68
 
69
69
  | Name | Description |
70
70
  |:-----|:------------|
71
- | `congressgov_bill_lookup` | Browse, filter, and retrieve bill data (actions, sponsors, summaries, text, related bills) |
71
+ | `congressgov_bill_lookup` | Browse, filter, and retrieve bill data (actions, sponsors, summaries, text, related bills) + bounded document text via `content` |
72
72
  | `congressgov_enacted_laws` | Browse enacted public and private laws by congress |
73
73
  | `congressgov_member_lookup` | Discover members by state/district/congress, retrieve legislative portfolios |
74
74
  | `congressgov_committee_lookup` | Browse committees and retrieve legislation, reports, nominations |
@@ -76,8 +76,8 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
76
76
  | `congressgov_senate_nominations` | Browse presidential nominations, track Senate confirmation pipeline |
77
77
  | `congressgov_bill_summaries` | Browse recent CRS bill summaries — the "what's happening" feed |
78
78
  | `congressgov_crs_reports` | Browse and retrieve nonpartisan CRS policy analysis reports |
79
- | `congressgov_committee_reports` | Browse and retrieve committee reports accompanying legislation |
80
- | `congressgov_daily_record` | Browse daily Congressional Record — floor speeches, debates, proceedings |
79
+ | `congressgov_committee_reports` | Browse and retrieve committee reports accompanying legislation + bounded report text via `content` |
80
+ | `congressgov_daily_record` | Browse daily Congressional Record — floor speeches, debates, proceedings + bounded article text via `content` |
81
81
  | `congressgov_search_bills` | Keyword-search bill titles/summaries via the opt-in local FTS mirror — off by default |
82
82
 
83
83
  ### Resources (5)
@@ -110,6 +110,11 @@ src/
110
110
  congress-api/
111
111
  congress-api-service.ts # API client — auth, pagination, rate limiting
112
112
  types.ts # API response types
113
+ congress-documents/
114
+ congress-documents-service.ts # www.congress.gov document fetch — host allowlist, byte ceiling, character window
115
+ document-formats.ts # Format label → URL resolution over upstream format lists
116
+ extract-text.ts # GPO `<pre>` / XML body → deterministic plain text
117
+ types.ts # Document format + content window types
113
118
  congress-mirror/
114
119
  congress-mirror-service.ts # Mirror read path — FTS5 search, ready(), sync accessor
115
120
  ingest.ts # Bill list + CRS summaries sync generator
@@ -153,7 +158,7 @@ scripts/
153
158
 
154
159
  ## Services
155
160
 
156
- Three services. `CongressApiService` backs nine tools and the House branch of `congressgov_roll_votes`; `SenateVoteService` backs only the Senate branch of `congressgov_roll_votes` (the Congress.gov API exposes no Senate vote namespace); `CongressMirrorService` backs `congressgov_search_bills` only.
161
+ Four services. `CongressApiService` backs nine tools and the House branch of `congressgov_roll_votes`; `SenateVoteService` backs only the Senate branch of `congressgov_roll_votes` (the Congress.gov API exposes no Senate vote namespace); `CongressMirrorService` backs `congressgov_search_bills` only; `CongressDocumentsService` backs the `content` operation on `congressgov_bill_lookup`, `congressgov_committee_reports`, and `congressgov_daily_record`.
157
162
 
158
163
  **`CongressApiService`** — wraps the Congress.gov REST API v3:
159
164
  - API key via `X-Api-Key` header (never logged; kept out of the URL so it can't leak in upstream error messages)
@@ -168,6 +173,13 @@ Three services. `CongressApiService` backs nine tools and the House branch of `c
168
173
  - The host returns HTTP 200 with an HTML page for unknown congress/session/vote, so "not found" is detected from the body, not the status code
169
174
  - Party totals are derived from the roster (the feed publishes none)
170
175
 
176
+ **`CongressDocumentsService`** — reads the document bodies behind Congress.gov's format URLs (`www.congress.gov`):
177
+ - A second host, so a sibling service rather than a method on `CongressApiService` — no API key, no JSON, documents past a megabyte
178
+ - URLs are resolved from upstream format metadata and checked against a `www.congress.gov` allowlist; a caller never supplies one
179
+ - The fetch is bounded: a 5 MB ceiling (refused on `Content-Length`, else mid-stream), a 30s deadline, and a content-type allowlist
180
+ - The response is bounded by an exact character window — offsets index the extracted plain text and are never snapped to section breaks, so feeding `nextOffset` back walks a document with no overlap and no gap
181
+ - `extract-text.ts` unwraps GPO's `<pre>` print output verbatim (whitespace is the document's structure) and decodes entities in one pass
182
+
171
183
  **`CongressMirrorService`** — local SQLite FTS5 mirror of bill title + CRS summary text, backing `congressgov_search_bills` only:
172
184
  - Opt-in via `CONGRESS_MIRROR_ENABLED` (off by default); built out-of-band via the `mirror:init`/`mirror:refresh` scripts, never on server startup
173
185
  - No live-API fallback — ingests through the existing `CongressApiService`, and a mirror that hasn't finished its initial build returns an empty result with a notice, not an error
@@ -198,6 +210,8 @@ All tools share these patterns. The service layer handles them uniformly:
198
210
  | Invalid params | `validationError('...', { field })` |
199
211
  | Network error | `serviceUnavailable('Unable to reach the Congress.gov API.')` |
200
212
 
213
+ The `content` operation adds `documentErrorContracts` (tool-helpers) on top: `document_unavailable`, `format_unavailable`, `document_fetch_failed`, `document_too_large`, and `offset_past_end`. `CongressDocumentsService` raises each with a matching `data.reason` and resolves the hint via `ctx.recoveryFor` — note that `ctx.fail` does **not** auto-populate `recovery`, so handler-side `ctx.fail` calls must spread `ctx.recoveryFor(reason)` into their data or the hint never reaches the wire.
214
+
201
215
  ---
202
216
 
203
217
  ## Naming
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div align="center">
9
9
 
10
- [![Version](https://img.shields.io/badge/Version-0.4.3-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/congressgov-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.30.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/congressgov-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/congressgov-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.5.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/congressgov-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.30.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/congressgov-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/congressgov-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -51,6 +51,7 @@ Browse and retrieve U.S. legislative bill data from Congress.gov.
51
51
 
52
52
  - Filter by congress number, bill type, and update-date range
53
53
  - Retrieve detailed sub-resources: actions, amendments, committees, cosponsors, related bills, subjects, summaries, text versions, and titles
54
+ - `content` reads a text version's actual document text, a bounded character window at a time — pick the version with `textVersionIndex`, the window with `characterOffset`/`characterLimit`, and follow `nextOffset` to walk a full bill
54
55
  - `list` defaults to `order='recent'` (newest update-date first); pass `order='oldest'` for ascending
55
56
  - Pagination support for browsing large result sets
56
57
 
@@ -112,6 +113,7 @@ Browse the daily Congressional Record — floor speeches, debates, and legislati
112
113
 
113
114
  - Browse volumes by congress number
114
115
  - Retrieve specific issue articles
116
+ - `content` reads one article's actual text, selected by `articleIndex` and bounded by `characterOffset`/`characterLimit`
115
117
 
116
118
  ---
117
119
 
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ import { rollVotesTool } from './mcp-server/tools/definitions/roll-votes.tool.js
25
25
  import { searchBillsTool } from './mcp-server/tools/definitions/search-bills.tool.js';
26
26
  import { senateNominationsTool } from './mcp-server/tools/definitions/senate-nominations.tool.js';
27
27
  import { initCongressApi } from './services/congress-api/congress-api-service.js';
28
+ import { initCongressDocuments } from './services/congress-documents/congress-documents-service.js';
28
29
  import { getCongressMirror, initCongressMirror, } from './services/congress-mirror/congress-mirror-service.js';
29
30
  import { initSenateVoteService } from './services/senate-lis/senate-vote-service.js';
30
31
  const REPO_ROOT = 'https://github.com/cyanheads/congressgov-mcp-server';
@@ -72,6 +73,7 @@ await createApp({
72
73
  setup(core) {
73
74
  initCongressApi();
74
75
  initSenateVoteService();
76
+ initCongressDocuments();
75
77
  /**
76
78
  * The bill FTS mirror is opt-in (off by default). When enabled, wire the
77
79
  * service; a full init runs out-of-band via `mirror:init` (never on startup).
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAOH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAC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BAAqB,CAAC,IAAY;IAC/C,MAAM,gBAAgB,CAAC,QAAQ,CAC7B,wBAAwB,EACxB,IAAI,EACJ,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,MAAM,CAAC,IAAI,CAAC,iDAAiD,EAAE,MAAM,CAAC,CAAC;QACvE,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QACrF,MAAM,CAAC,IAAI,CACT,oDAAoD,MAAM,CAAC,cAAc,2BAA2B,MAAM,CAAC,KAAK,GAAG,EACnH,MAAM,CACP,CAAC;IACJ,CAAC,EACD,8EAA8E,CAC/E,CAAC;IACF,gBAAgB,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AACnD,CAAC"}
@@ -1,5 +1,14 @@
1
1
  /**
2
2
  * @fileoverview Prompt providing a research framework for investigating a policy area across Congress.
3
+ *
4
+ * The discovery plan branches on the mirror configuration, because the two
5
+ * deployments expose different capabilities: with `CONGRESS_MIRROR_ENABLED` the
6
+ * server registers `congressgov_search_bills` and topical discovery is real;
7
+ * without it no registered tool accepts a topic string, and the honest plan is
8
+ * to say so and ask for a seed identifier. Every step names a tool that is
9
+ * registered in that configuration and an operation that accepts the input the
10
+ * step supplies.
11
+ *
3
12
  * @module mcp-server/prompts/definitions/legislative-research
4
13
  */
5
14
  import { z } from '@cyanheads/mcp-ts-core';
@@ -1 +1 @@
1
- {"version":3,"file":"legislative-research.prompt.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/legislative-research.prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,eAAO,MAAM,yBAAyB;;;kBA2CpC,CAAC"}
1
+ {"version":3,"file":"legislative-research.prompt.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/legislative-research.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAU,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAsCnD,eAAO,MAAM,yBAAyB;;;kBAiCpC,CAAC"}
@@ -1,10 +1,52 @@
1
1
  /**
2
2
  * @fileoverview Prompt providing a research framework for investigating a policy area across Congress.
3
+ *
4
+ * The discovery plan branches on the mirror configuration, because the two
5
+ * deployments expose different capabilities: with `CONGRESS_MIRROR_ENABLED` the
6
+ * server registers `congressgov_search_bills` and topical discovery is real;
7
+ * without it no registered tool accepts a topic string, and the honest plan is
8
+ * to say so and ask for a seed identifier. Every step names a tool that is
9
+ * registered in that configuration and an operation that accepts the input the
10
+ * step supplies.
11
+ *
3
12
  * @module mcp-server/prompts/definitions/legislative-research
4
13
  */
5
14
  import { prompt, z } from '@cyanheads/mcp-ts-core';
15
+ import { getServerConfig } from '../../../config/server-config.js';
16
+ /** Shared closing framework — the synthesis half is configuration-independent. */
17
+ const SYNTHESIS = `Synthesize findings into:
18
+ - **Landscape** — What legislation is active on this topic? What stage are key bills at?
19
+ - **Key Players** — Which members and committees are driving activity?
20
+ - **Substance** — What do the bill summaries and subject terms actually say?
21
+ - **Recent Activity** — What has each bill's latest action been in the last 30 days?
22
+ - **Outlook** — What is the likely trajectory for this policy area?`;
23
+ /** Discovery plan when the local bill-search mirror is on and search_bills is registered. */
24
+ function mirrorPlan(topic) {
25
+ return `Keyword search over the local bill mirror is the one topical entry point — the Congress.gov API has no keyword search, so every other tool browses by congress, date, chamber, or identifier.
26
+
27
+ 1. **Find candidate bills** — Call congressgov_search_bills with "${topic}" as the query. It matches bill titles and CRS summary text over a bounded congress window; it does not match policy area, full bill text, CRS reports, or the Congressional Record. Narrow with congress, billType, or originChamber when the result set is broad; use fewer or broader keywords when it is empty.
28
+ 2. **Read each candidate** — Each hit carries congress, billType, and billNumber. Pass them to congressgov_bill_lookup with operation='get', then 'summaries', 'subjects', 'actions', 'cosponsors', and 'related' for substance, status, and companion bills.
29
+ 3. **Follow the sponsors** — Take a bioguideId from the bill's sponsors or its 'cosponsors' rows and call congressgov_member_lookup with operation='get' for the profile or 'sponsored' for the rest of that member's portfolio.
30
+ 4. **Follow the committees** — Call congressgov_bill_lookup with operation='committees' for the committees a bill was referred to, or congressgov_committee_lookup with operation='list' and a filter matching a committee *name* ("armed services", "energy") — not the topic string — then its 'bills' and 'reports' operations on the resulting system code.
31
+
32
+ Report the boundary along with the findings: the search covers bill titles and summaries only, so silence from it is not evidence that no CRS analysis or floor debate exists.`;
33
+ }
34
+ /** Discovery plan when the mirror is off — no registered tool accepts a topic. */
35
+ const NO_MIRROR_PLAN = `This deployment cannot search by topic. The Congress.gov API has no keyword search, and this server's optional local bill-search index is turned off (an operator enables it with CONGRESS_MIRROR_ENABLED=true), so no registered tool accepts a topic string. congressgov_crs_reports, congressgov_bill_summaries, and congressgov_daily_record browse by congress, date, or identifier only — scanning them for a topic means reading thousands of unrelated rows.
36
+
37
+ Ask for one of these seeds before going further, and say why it is needed:
38
+ - a bill — congress + bill type + number (e.g. 119, hr, 4765)
39
+ - a member — bioguideId (e.g. P000197)
40
+ - a committee — name or system code (e.g. "armed services", hsas00)
41
+ - a CRS report — report id (e.g. R46991)
42
+
43
+ From a seed, these steps are executable:
44
+ 1. **Bill** — congressgov_bill_lookup with operation='get', then 'summaries', 'subjects', 'actions', 'cosponsors', 'committees', and 'related'. Sponsors and related bills are how the search widens without a keyword index.
45
+ 2. **Member** — congressgov_member_lookup with operation='get', 'sponsored', or 'cosponsored'. There is no member name search; a bioguideId comes from a bill's sponsors or from operation='list' filtered by state and district.
46
+ 3. **Committee** — congressgov_committee_lookup with operation='list' and a filter matching a committee *name* to resolve a system code, then 'bills' and 'reports' on that code.
47
+ 4. **CRS report** — congressgov_crs_reports with operation='get' and a known report id.`;
6
48
  export const legislativeResearchPrompt = prompt('congressgov_legislative_research', {
7
- description: 'Research framework for investigating a policy area across Congress: relevant bills, key members, committee activity, CRS reports, and floor activity.',
49
+ description: 'Research framework for investigating a policy area across Congress: relevant bills, key members, committee activity, and legislative status. The discovery plan reflects whether this deployment can search by keyword.',
8
50
  args: z.object({
9
51
  topic: z
10
52
  .string()
@@ -18,6 +60,7 @@ export const legislativeResearchPrompt = prompt('congressgov_legislative_researc
18
60
  const congressNote = args.congress
19
61
  ? `Focus on the ${args.congress}th Congress.`
20
62
  : 'Start with the current congress (use the congress://current resource to find the number).';
63
+ const plan = getServerConfig().mirrorEnabled ? mirrorPlan(args.topic) : NO_MIRROR_PLAN;
21
64
  return [
22
65
  {
23
66
  role: 'user',
@@ -25,21 +68,9 @@ export const legislativeResearchPrompt = prompt('congressgov_legislative_researc
25
68
  type: 'text',
26
69
  text: `Research the topic "${args.topic}" across congressional activity. ${congressNote}
27
70
 
28
- Since the Congress.gov API has no keyword search, use these discovery strategies:
29
-
30
- 1. **CRS Reports** — Use congressgov_crs_reports to find nonpartisan policy analyses on this topic.
31
- 2. **Recent Summaries** — Use congressgov_bill_summaries with a broad date range to find recently summarized bills that may relate to this topic.
32
- 3. **Bill Detail** — Once candidate bills surface, use congressgov_bill_lookup with operation='get' (and sub-resources like 'actions', 'cosponsors', 'related') for full sponsor, status, and policy area data.
33
- 4. **Committee Activity** — Identify relevant committees using congressgov_committee_lookup, then check their recent bills and reports.
34
- 5. **Key Members** — Identify members known for this policy area, then check their sponsored legislation via congressgov_member_lookup.
35
- 6. **Floor Activity** — Check congressgov_daily_record for recent floor debate on the topic.
71
+ ${plan}
36
72
 
37
- Synthesize findings into:
38
- - **Landscape** — What legislation is active on this topic? What stage are key bills at?
39
- - **Key Players** — Which members and committees are driving activity?
40
- - **Policy Analysis** — What do CRS reports say about the issues?
41
- - **Recent Activity** — What happened in the last 30 days?
42
- - **Outlook** — What is the likely trajectory for this policy area?`,
73
+ ${SYNTHESIS}`,
43
74
  },
44
75
  },
45
76
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"legislative-research.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/legislative-research.prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,kCAAkC,EAAE;IAClF,WAAW,EACT,uJAAuJ;IACzJ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,CAAC,iFAAiF,CAAC;QAC9F,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,4DAA4D,CAAC;KAC1E,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ;YAChC,CAAC,CAAC,gBAAgB,IAAI,CAAC,QAAQ,cAAc;YAC7C,CAAC,CAAC,2FAA2F,CAAC;QAEhG,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,uBAAuB,IAAI,CAAC,KAAK,oCAAoC,YAAY;;;;;;;;;;;;;;;;oEAgB7B;iBAC3D;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"legislative-research.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/legislative-research.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,kFAAkF;AAClF,MAAM,SAAS,GAAG;;;;;oEAKkD,CAAC;AAErE,6FAA6F;AAC7F,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO;;oEAE2D,KAAK;;;;;+KAKsG,CAAC;AAChL,CAAC;AAED,kFAAkF;AAClF,MAAM,cAAc,GAAG;;;;;;;;;;;;wFAYiE,CAAC;AAEzF,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,kCAAkC,EAAE;IAClF,WAAW,EACT,yNAAyN;IAC3N,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,CAAC,iFAAiF,CAAC;QAC9F,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,4DAA4D,CAAC;KAC1E,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ;YAChC,CAAC,CAAC,gBAAgB,IAAI,CAAC,QAAQ,cAAc;YAC7C,CAAC,CAAC,2FAA2F,CAAC;QAEhG,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;QAEvF,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,uBAAuB,IAAI,CAAC,KAAK,oCAAoC,YAAY;;EAE/F,IAAI;;EAEJ,SAAS,EAAE;iBACJ;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -4,10 +4,17 @@
4
4
  */
5
5
  import { z } from '@cyanheads/mcp-ts-core';
6
6
  export declare const billLookupTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
7
+ format: z.ZodDefault<z.ZodEnum<{
8
+ text: "text";
9
+ xml: "xml";
10
+ }>>;
11
+ characterOffset: z.ZodDefault<z.ZodNumber>;
12
+ characterLimit: z.ZodDefault<z.ZodNumber>;
7
13
  operation: z.ZodEnum<{
8
14
  actions: "actions";
9
15
  amendments: "amendments";
10
16
  committees: "committees";
17
+ content: "content";
11
18
  cosponsors: "cosponsors";
12
19
  get: "get";
13
20
  list: "list";
@@ -37,6 +44,7 @@ export declare const billLookupTool: import("@cyanheads/mcp-ts-core").ToolDefini
37
44
  }>>;
38
45
  limit: z.ZodDefault<z.ZodNumber>;
39
46
  offset: z.ZodDefault<z.ZodNumber>;
47
+ textVersionIndex: z.ZodDefault<z.ZodNumber>;
40
48
  }, z.core.$strip>, z.ZodObject<{
41
49
  data: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
42
50
  pagination: z.ZodOptional<z.ZodObject<{
@@ -67,6 +75,36 @@ export declare const billLookupTool: import("@cyanheads/mcp-ts-core").ToolDefini
67
75
  readonly retryable: true;
68
76
  readonly when: 'Congress.gov returned an unexpected error (5xx or another non-2xx status).';
69
77
  readonly recovery: 'Retry after a short delay; if the failure persists the Congress.gov service may be temporarily degraded.';
78
+ }, {
79
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
80
+ readonly reason: 'document_unavailable';
81
+ readonly retryable: false;
82
+ readonly when: "The 'content' selection resolves to no retrievable document — the text version or article index is past the end of the list, the record publishes no formats at all, or Congress.gov does not hold the file its own metadata names.";
83
+ readonly recovery: "Run the tool's 'text' or 'articles' operation first to see which documents Congress.gov publishes for this record, then retry with a selection it lists.";
84
+ }, {
85
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
86
+ readonly reason: 'format_unavailable';
87
+ readonly retryable: false;
88
+ readonly when: "The document exists but publishes nothing in the requested 'format' — some text versions and committee reports ship PDF only, and no Congressional Record article publishes XML.";
89
+ readonly recovery: "Retry with format 'text', which every document checked publishes; if that fails too the document is PDF-only, so read it at the format URL the text operation returns.";
90
+ }, {
91
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
92
+ readonly reason: 'document_fetch_failed';
93
+ readonly retryable: true;
94
+ readonly when: 'www.congress.gov did not return a readable document — a non-2xx status, a network failure, an empty body, or a content type that is not text or XML.';
95
+ readonly recovery: 'Retry after a short delay; if the failure persists, request a different format or read the document at the sourceUrl the text operation returns.';
96
+ }, {
97
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
98
+ readonly reason: 'document_too_large';
99
+ readonly retryable: false;
100
+ readonly when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.';
101
+ readonly recovery: "Request the other 'format' for this document, which is usually far smaller, or read it directly at the sourceUrl the text operation returns.";
102
+ }, {
103
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
104
+ readonly reason: 'offset_past_end';
105
+ readonly retryable: false;
106
+ readonly when: 'characterOffset is at or beyond the last character of the document, so the window would be empty.';
107
+ readonly recovery: 'Restart the walk at characterOffset 0 and follow nextOffset, which goes null once the document has been read to the end.';
70
108
  }], {
71
109
  effectiveQuery: z.ZodString;
72
110
  totalCount: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"bill-lookup.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/bill-lookup.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAuCjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2IzB,CAAC"}
1
+ {"version":3,"file":"bill-lookup.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/bill-lookup.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AA+CjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkOzB,CAAC"}
@@ -5,9 +5,11 @@
5
5
  import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { validationError } from '@cyanheads/mcp-ts-core/errors';
7
7
  import { formatBills } from '../../../mcp-server/tools/format-helpers.js';
8
- import { buildEffectiveQuery, congressErrorContracts, listEnrichment, listOrDetail, normalizeOptionalString, notifyIfNoMatches, numericIdentifier, toIdentifierNumber, validateDateTimeRange, validateIsoDateTime, } from '../../../mcp-server/tools/tool-helpers.js';
8
+ import { buildEffectiveQuery, congressErrorContracts, documentErrorContracts, documentWindowInput, listEnrichment, listOrDetail, normalizeOptionalString, notifyIfNoMatches, numericIdentifier, toIdentifierNumber, validateDateTimeRange, validateIsoDateTime, } from '../../../mcp-server/tools/tool-helpers.js';
9
9
  import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
10
10
  import { BILL_TYPE_CODES } from '../../../services/congress-api/types.js';
11
+ import { getCongressDocuments } from '../../../services/congress-documents/congress-documents-service.js';
12
+ import { describeFormat, selectDocumentUrl, } from '../../../services/congress-documents/document-formats.js';
11
13
  const BillTypeEnum = z.enum(BILL_TYPE_CODES);
12
14
  const OperationEnum = z.enum([
13
15
  'list',
@@ -21,14 +23,15 @@ const OperationEnum = z.enum([
21
23
  'text',
22
24
  'titles',
23
25
  'related',
26
+ 'content',
24
27
  ]);
25
28
  const SUB_RESOURCE_MAP = {
26
29
  related: 'relatedbills',
27
30
  };
28
31
  export const billLookupTool = tool('congressgov_bill_lookup', {
29
- description: `Browse and retrieve U.S. legislative bill data from Congress.gov. Discover bills by filtering on congress, bill type, and date range — there is no keyword search. Use 'list' to browse (requires congress, defaults to most-recently-updated first), 'get' for full bill detail (sponsor, policy area, CBO estimates, law info), or drill into a specific bill with 'actions', 'amendments', 'cosponsors', 'committees', 'subjects', 'summaries', 'text', 'titles', or 'related' (each requires congress + billType + billNumber).`,
32
+ description: `Browse and retrieve U.S. legislative bill data from Congress.gov. Discover bills by filtering on congress, bill type, and date range — there is no keyword search. Use 'list' to browse (requires congress, defaults to most-recently-updated first), 'get' for full bill detail (sponsor, policy area, CBO estimates, law info), or drill into a specific bill with 'actions', 'amendments', 'cosponsors', 'committees', 'subjects', 'summaries', 'text', 'titles', or 'related' (each requires congress + billType + billNumber). 'text' lists the published versions and their format URLs; 'content' then reads one version's actual text, a bounded character window at a time.`,
30
33
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
31
- errors: congressErrorContracts,
34
+ errors: [...congressErrorContracts, ...documentErrorContracts],
32
35
  input: z.object({
33
36
  operation: OperationEnum.describe('Which data to retrieve.'),
34
37
  congress: z.number().int().positive().describe('Congress number (e.g., 118, 119).'),
@@ -48,8 +51,15 @@ export const billLookupTool = tool('congressgov_bill_lookup', {
48
51
  .describe("Sort order for 'list' (sorts by update date). 'recent' (default) is newest first; 'oldest' is ascending. Ignored by other operations."),
49
52
  limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
50
53
  offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
54
+ textVersionIndex: z
55
+ .number()
56
+ .int()
57
+ .min(0)
58
+ .default(0)
59
+ .describe("Which text version 'content' reads, 0-based against the same order 'text' returns — 0 is the most recent version. Ignored by other operations."),
60
+ ...documentWindowInput,
51
61
  }),
52
- output: listOrDetail('bill', 'Bill record (sponsor, policy area, latest action, CBO estimates, law citation) for `get`; absent for `list` and sub-resources.'),
62
+ output: listOrDetail('bill', "Bill record (sponsor, policy area, latest action, CBO estimates, law citation) for `get`; absent for `list` and sub-resources. For `content`, an alternative key 'content' carries {text, format, sourceUrl, documentTitle, totalCharacters, offset, truncated, nextOffset} — one exact character window of the document."),
53
63
  enrichment: listEnrichment,
54
64
  format: formatBills,
55
65
  async handler(input, ctx) {
@@ -98,6 +108,64 @@ export const billLookupTool = tool('congressgov_bill_lookup', {
98
108
  ctx.enrich.total(1);
99
109
  return result;
100
110
  }
111
+ if (input.operation === 'content') {
112
+ /** One upstream page of exactly the selected version — not the whole list. */
113
+ const versions = await api.getBillSubResource({
114
+ congress: input.congress,
115
+ billType: input.billType,
116
+ billNumber,
117
+ subResource: 'text',
118
+ limit: 1,
119
+ offset: input.textVersionIndex,
120
+ }, ctx);
121
+ /**
122
+ * `pagination.count` decides the range, not the presence of a row: for an
123
+ * enacted bill the endpoint appends the "Public Law" version to every page,
124
+ * so an out-of-range offset comes back holding that row instead of empty.
125
+ * Selecting `data[0]` alone would serve the Public Law text for any index
126
+ * past the end — a different document than the caller asked for.
127
+ */
128
+ const version = input.textVersionIndex < versions.pagination.count ? versions.data[0] : undefined;
129
+ if (!version) {
130
+ throw ctx.fail('document_unavailable', `No text version at index ${input.textVersionIndex} for ${input.billType.toUpperCase()} ${billNumber} — Congress.gov publishes ${versions.pagination.count} version(s) for this bill.`, {
131
+ ...ctx.recoveryFor('document_unavailable'),
132
+ textVersionIndex: input.textVersionIndex,
133
+ available: versions.pagination.count,
134
+ });
135
+ }
136
+ const url = selectDocumentUrl(version.formats, input.format);
137
+ if (!url) {
138
+ throw ctx.fail('format_unavailable', `This text version publishes no '${input.format}' document (looked for ${describeFormat(input.format)}).`, {
139
+ ...ctx.recoveryFor('format_unavailable'),
140
+ format: input.format,
141
+ textVersionIndex: input.textVersionIndex,
142
+ });
143
+ }
144
+ const document = await getCongressDocuments().fetchDocument({
145
+ url,
146
+ characterOffset: input.characterOffset,
147
+ characterLimit: input.characterLimit,
148
+ }, ctx);
149
+ const versionType = typeof version.type === 'string' ? version.type : 'Bill Text';
150
+ ctx.log.info('Bill text content retrieved', {
151
+ congress: input.congress,
152
+ billType: input.billType,
153
+ billNumber,
154
+ textVersionIndex: input.textVersionIndex,
155
+ format: input.format,
156
+ totalCharacters: document.totalCharacters,
157
+ });
158
+ ctx.enrich.echo(`${versionType} of ${input.billType.toUpperCase()} ${billNumber} (${input.congress}th Congress), ${input.format} characters ${document.offset}–${document.offset + document.text.length}`);
159
+ ctx.enrich.total(document.totalCharacters);
160
+ return {
161
+ content: {
162
+ ...document,
163
+ format: input.format,
164
+ sourceUrl: url,
165
+ documentTitle: `${input.billType.toUpperCase()} ${billNumber} — ${versionType}`,
166
+ },
167
+ };
168
+ }
101
169
  const subResource = SUB_RESOURCE_MAP[input.operation] ?? input.operation;
102
170
  const result = await api.getBillSubResource({
103
171
  congress: input.congress,
@@ -1 +1 @@
1
- {"version":3,"file":"bill-lookup.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/bill-lookup.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,OAAO,EAAE,eAAe,EAAwB,MAAM,kCAAkC,CAAC;AAEzF,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAE7C,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3B,MAAM;IACN,KAAK;IACL,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,UAAU;IACV,WAAW;IACX,MAAM;IACN,QAAQ;IACR,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAA2B;IAC/C,OAAO,EAAE,cAAc;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,yBAAyB,EAAE;IAC5D,WAAW,EAAE,qgBAAqgB;IAClhB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cA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AAC,IAAI,CAAC,6BAA6B,EAAE;YAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU;YACV,WAAW;SACZ,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,GAAG,KAAK,CAAC,SAAS,QAAQ,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,UAAU,WAAW,KAAK,CAAC,QAAQ,aAAa,CAC3G,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1C,iBAAiB,CACf,GAAG,EACH,MAAM,EACN,MAAM,KAAK,CAAC,SAAS,cAAc,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,UAAU,GAAG,CACjF,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
@@ -4,7 +4,14 @@
4
4
  */
5
5
  import { z } from '@cyanheads/mcp-ts-core';
6
6
  export declare const committeeReportsTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
7
+ format: z.ZodDefault<z.ZodEnum<{
8
+ text: "text";
9
+ xml: "xml";
10
+ }>>;
11
+ characterOffset: z.ZodDefault<z.ZodNumber>;
12
+ characterLimit: z.ZodDefault<z.ZodNumber>;
7
13
  operation: z.ZodEnum<{
14
+ content: "content";
8
15
  get: "get";
9
16
  list: "list";
10
17
  text: "text";
@@ -48,6 +55,36 @@ export declare const committeeReportsTool: import("@cyanheads/mcp-ts-core").Tool
48
55
  readonly retryable: true;
49
56
  readonly when: 'Congress.gov returned an unexpected error (5xx or another non-2xx status).';
50
57
  readonly recovery: 'Retry after a short delay; if the failure persists the Congress.gov service may be temporarily degraded.';
58
+ }, {
59
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
60
+ readonly reason: 'document_unavailable';
61
+ readonly retryable: false;
62
+ readonly when: "The 'content' selection resolves to no retrievable document — the text version or article index is past the end of the list, the record publishes no formats at all, or Congress.gov does not hold the file its own metadata names.";
63
+ readonly recovery: "Run the tool's 'text' or 'articles' operation first to see which documents Congress.gov publishes for this record, then retry with a selection it lists.";
64
+ }, {
65
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
66
+ readonly reason: 'format_unavailable';
67
+ readonly retryable: false;
68
+ readonly when: "The document exists but publishes nothing in the requested 'format' — some text versions and committee reports ship PDF only, and no Congressional Record article publishes XML.";
69
+ readonly recovery: "Retry with format 'text', which every document checked publishes; if that fails too the document is PDF-only, so read it at the format URL the text operation returns.";
70
+ }, {
71
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
72
+ readonly reason: 'document_fetch_failed';
73
+ readonly retryable: true;
74
+ readonly when: 'www.congress.gov did not return a readable document — a non-2xx status, a network failure, an empty body, or a content type that is not text or XML.';
75
+ readonly recovery: 'Retry after a short delay; if the failure persists, request a different format or read the document at the sourceUrl the text operation returns.';
76
+ }, {
77
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
78
+ readonly reason: 'document_too_large';
79
+ readonly retryable: false;
80
+ readonly when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.';
81
+ readonly recovery: "Request the other 'format' for this document, which is usually far smaller, or read it directly at the sourceUrl the text operation returns.";
82
+ }, {
83
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
84
+ readonly reason: 'offset_past_end';
85
+ readonly retryable: false;
86
+ readonly when: 'characterOffset is at or beyond the last character of the document, so the window would be empty.';
87
+ readonly recovery: 'Restart the walk at characterOffset 0 and follow nextOffset, which goes null once the document has been read to the end.';
51
88
  }], {
52
89
  effectiveQuery: z.ZodString;
53
90
  totalCount: z.ZodNumber;
@@ -1 +1 @@
1
- {"version":3,"file":"committee-reports.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/committee-reports.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAajD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8G/B,CAAC"}
1
+ {"version":3,"file":"committee-reports.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/committee-reports.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAiCjD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8K/B,CAAC"}