@cyanheads/congressgov-mcp-server 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +272 -0
- package/CLAUDE.md +2 -2
- package/README.md +2 -2
- package/dist/mcp-server/resources/definitions/bill.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/bill.resource.js +1 -1
- package/dist/mcp-server/resources/definitions/bill.resource.js.map +1 -1
- package/dist/mcp-server/resources/definitions/committee.resource.js +1 -1
- package/dist/mcp-server/resources/definitions/committee.resource.js.map +1 -1
- package/dist/mcp-server/resources/definitions/current-congress.resource.js +1 -1
- package/dist/mcp-server/resources/definitions/current-congress.resource.js.map +1 -1
- package/dist/mcp-server/resources/definitions/member.resource.js +1 -1
- package/dist/mcp-server/resources/definitions/member.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts +18 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js +50 -16
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts +7 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.js +20 -11
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.js +4 -8
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js +4 -11
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts +13 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.js +39 -8
- package/dist/mcp-server/tools/definitions/crs-reports.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.js +4 -6
- package/dist/mcp-server/tools/definitions/daily-record.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.js +3 -9
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.js +24 -13
- package/dist/mcp-server/tools/definitions/member-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/roll-votes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/roll-votes.tool.js +4 -8
- package/dist/mcp-server/tools/definitions/roll-votes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.js +5 -9
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.js.map +1 -1
- package/dist/mcp-server/tools/format-helpers.d.ts +1 -1
- package/dist/mcp-server/tools/format-helpers.d.ts.map +1 -1
- package/dist/mcp-server/tools/format-helpers.js +52 -23
- package/dist/mcp-server/tools/format-helpers.js.map +1 -1
- package/dist/mcp-server/tools/tool-helpers.d.ts +13 -0
- package/dist/mcp-server/tools/tool-helpers.d.ts.map +1 -0
- package/dist/mcp-server/tools/tool-helpers.js +23 -0
- package/dist/mcp-server/tools/tool-helpers.js.map +1 -0
- package/dist/services/congress-api/congress-api-service.d.ts +41 -47
- package/dist/services/congress-api/congress-api-service.d.ts.map +1 -1
- package/dist/services/congress-api/congress-api-service.js +233 -133
- package/dist/services/congress-api/congress-api-service.js.map +1 -1
- package/package.json +7 -11
- package/server.json +3 -3
package/AGENTS.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# Agent Protocol
|
|
2
|
+
|
|
3
|
+
**Server:** congressgov-mcp-server
|
|
4
|
+
**Version:** 0.3.8
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
6
|
+
|
|
7
|
+
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/AGENTS.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
MCP server wrapping the [Congress.gov API v3](https://api.congress.gov/) — the official machine-readable interface to U.S. legislative data maintained by the Library of Congress. All tools are **read-only** and **idempotent**. The API has **no keyword search** — discovery happens via browse/filter on congress number, bill type, date range, chamber, state, and district.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## What's Next?
|
|
18
|
+
|
|
19
|
+
When the user asks what to do next, what's left, or needs direction, suggest relevant options based on the current project state:
|
|
20
|
+
|
|
21
|
+
1. **Re-run the `setup` skill** — ensures AGENTS.md, skills, structure, and metadata are populated and up to date with the current codebase
|
|
22
|
+
2. **Run the `design-mcp-server` skill** — if the tool/resource surface hasn't been mapped yet, work through domain design
|
|
23
|
+
3. **Add tools/resources/prompts** — scaffold new definitions using the `add-tool`, `add-resource`, `add-prompt` skills
|
|
24
|
+
4. **Add services** — scaffold domain service integrations using the `add-service` skill
|
|
25
|
+
5. **Add tests** — scaffold tests for existing definitions using the `add-test` skill
|
|
26
|
+
6. **Field-test definitions** — exercise tools/resources/prompts with real inputs using the `field-test` skill, get a report of issues and pain points
|
|
27
|
+
7. **Run `devcheck`** — lint, format, typecheck, and security audit
|
|
28
|
+
8. **Run the `polish-docs-meta` skill** — finalize README, CHANGELOG, metadata, and agent protocol for shipping
|
|
29
|
+
9. **Run the `maintenance` skill** — sync skills and dependencies after framework updates
|
|
30
|
+
|
|
31
|
+
Tailor suggestions to what's actually missing or stale — don't recite the full list every time.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Config
|
|
36
|
+
|
|
37
|
+
| Env Var | Required | Description |
|
|
38
|
+
|:--------|:---------|:------------|
|
|
39
|
+
| `CONGRESS_API_KEY` | Yes | API key from [api.data.gov](https://api.data.gov/signup/) (free, 5,000 req/hr) |
|
|
40
|
+
| `CONGRESS_API_BASE_URL` | No | Defaults to `https://api.congress.gov/v3` |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Core Rules
|
|
45
|
+
|
|
46
|
+
- **Logic throws, framework catches.** Tool/resource handlers are pure — throw on failure, no `try/catch`. Plain `Error` is fine; the framework catches, classifies, and formats. Use error factories (`notFound()`, `validationError()`, etc.) when the error code matters.
|
|
47
|
+
- **Use `ctx.log`** for request-scoped logging. No `console` calls.
|
|
48
|
+
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
49
|
+
- **Check `ctx.elicit` / `ctx.sample`** for presence before calling.
|
|
50
|
+
- **Secrets in env vars only** — never hardcoded.
|
|
51
|
+
- **All tools are read-only.** Every tool gets `annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true }`.
|
|
52
|
+
- **API key stays out of logs.** The service appends `api_key` as a query param — never log full URLs.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## MCP Surface
|
|
57
|
+
|
|
58
|
+
### Tools (10)
|
|
59
|
+
|
|
60
|
+
| Name | Description |
|
|
61
|
+
|:-----|:------------|
|
|
62
|
+
| `congressgov_bill_lookup` | Browse, filter, and retrieve bill data (actions, sponsors, summaries, text, related bills) |
|
|
63
|
+
| `congressgov_enacted_laws` | Browse enacted public and private laws by congress |
|
|
64
|
+
| `congressgov_member_lookup` | Discover members by state/district/congress, retrieve legislative portfolios |
|
|
65
|
+
| `congressgov_committee_lookup` | Browse committees and retrieve legislation, reports, nominations |
|
|
66
|
+
| `congressgov_roll_votes` | Retrieve House roll call votes and member voting positions |
|
|
67
|
+
| `congressgov_senate_nominations` | Browse presidential nominations, track Senate confirmation pipeline |
|
|
68
|
+
| `congressgov_bill_summaries` | Browse recent CRS bill summaries — the "what's happening" feed |
|
|
69
|
+
| `congressgov_crs_reports` | Browse and retrieve nonpartisan CRS policy analysis reports |
|
|
70
|
+
| `congressgov_committee_reports` | Browse and retrieve committee reports accompanying legislation |
|
|
71
|
+
| `congressgov_daily_record` | Browse daily Congressional Record — floor speeches, debates, proceedings |
|
|
72
|
+
|
|
73
|
+
### Resources (5)
|
|
74
|
+
|
|
75
|
+
| URI Template | Description |
|
|
76
|
+
|:-------------|:------------|
|
|
77
|
+
| `congress://current` | Current congress number, session dates, chamber info |
|
|
78
|
+
| `congress://bill-types` | Reference table of valid bill type codes |
|
|
79
|
+
| `congress://member/{bioguideId}` | Member profile |
|
|
80
|
+
| `congress://bill/{congress}/{billType}/{billNumber}` | Bill detail |
|
|
81
|
+
| `congress://committee/{committeeCode}` | Committee detail |
|
|
82
|
+
|
|
83
|
+
### Prompts (2)
|
|
84
|
+
|
|
85
|
+
| Name | Description |
|
|
86
|
+
|:-----|:------------|
|
|
87
|
+
| `congressgov_bill_analysis` | Structured framework for analyzing a bill |
|
|
88
|
+
| `congressgov_legislative_research` | Research framework for a policy area across Congress |
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Structure
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
src/
|
|
96
|
+
index.ts # createApp() entry point
|
|
97
|
+
config/
|
|
98
|
+
server-config.ts # CONGRESS_API_KEY, base URL (Zod schema)
|
|
99
|
+
services/
|
|
100
|
+
congress-api/
|
|
101
|
+
congress-api-service.ts # API client — auth, pagination, rate limiting
|
|
102
|
+
types.ts # API response types
|
|
103
|
+
mcp-server/
|
|
104
|
+
tools/definitions/
|
|
105
|
+
bill-lookup.tool.ts # congressgov_bill_lookup
|
|
106
|
+
enacted-laws.tool.ts # congressgov_enacted_laws
|
|
107
|
+
member-lookup.tool.ts # congressgov_member_lookup
|
|
108
|
+
committee-lookup.tool.ts # congressgov_committee_lookup
|
|
109
|
+
roll-votes.tool.ts # congressgov_roll_votes
|
|
110
|
+
senate-nominations.tool.ts # congressgov_senate_nominations
|
|
111
|
+
bill-summaries.tool.ts # congressgov_bill_summaries
|
|
112
|
+
crs-reports.tool.ts # congressgov_crs_reports
|
|
113
|
+
committee-reports.tool.ts # congressgov_committee_reports
|
|
114
|
+
daily-record.tool.ts # congressgov_daily_record
|
|
115
|
+
resources/definitions/
|
|
116
|
+
current-congress.resource.ts # congress://current
|
|
117
|
+
bill-types.resource.ts # congress://bill-types
|
|
118
|
+
member.resource.ts # congress://member/{bioguideId}
|
|
119
|
+
bill.resource.ts # congress://bill/{congress}/{billType}/{billNumber}
|
|
120
|
+
committee.resource.ts # congress://committee/{committeeCode}
|
|
121
|
+
prompts/definitions/
|
|
122
|
+
bill-analysis.prompt.ts # congressgov_bill_analysis
|
|
123
|
+
legislative-research.prompt.ts # congressgov_legislative_research
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Service
|
|
129
|
+
|
|
130
|
+
Single service: `CongressApiService`. Wraps the Congress.gov REST API v3.
|
|
131
|
+
|
|
132
|
+
**Key concerns:**
|
|
133
|
+
- API key via `?api_key=` query param (never logged)
|
|
134
|
+
- Pagination: `offset` + `limit` query params, max 250 per request
|
|
135
|
+
- Rate limiting: 5,000 requests/hour per key
|
|
136
|
+
- Response normalization: request `format=json`, return typed data
|
|
137
|
+
- Native `fetch` — no SDK dependency
|
|
138
|
+
|
|
139
|
+
**Usage in tools:**
|
|
140
|
+
```ts
|
|
141
|
+
import { getCongressApi } from '@/services/congress-api/congress-api-service.js';
|
|
142
|
+
|
|
143
|
+
async handler(input, ctx) {
|
|
144
|
+
const api = getCongressApi();
|
|
145
|
+
const bills = await api.listBills({ congress: input.congress, limit: input.limit });
|
|
146
|
+
ctx.log.info('Bills fetched', { congress: input.congress, count: bills.bills.length });
|
|
147
|
+
return bills;
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Error Patterns
|
|
154
|
+
|
|
155
|
+
All tools share these patterns. The service layer handles them uniformly:
|
|
156
|
+
|
|
157
|
+
| Condition | Error |
|
|
158
|
+
|:----------|:------|
|
|
159
|
+
| Rate limit hit | `rateLimited('Congress.gov API rate limit reached (5,000 requests/hour).')` |
|
|
160
|
+
| API unavailable (5xx) | `serviceUnavailable('Congress.gov API returned HTTP {status}.')` |
|
|
161
|
+
| Entity not found (404) | `notFound('{entity} not found', { ...identifiers })` |
|
|
162
|
+
| Invalid params | `validationError('...', { field })` |
|
|
163
|
+
| Network error | `serviceUnavailable('Unable to reach the Congress.gov API.')` |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Naming
|
|
168
|
+
|
|
169
|
+
| What | Convention | Example |
|
|
170
|
+
|:-----|:-----------|:--------|
|
|
171
|
+
| Files | kebab-case with suffix | `bill-lookup.tool.ts` |
|
|
172
|
+
| Tool/resource/prompt names | snake_case with `congressgov_` prefix | `congressgov_bill_lookup` |
|
|
173
|
+
| Directories | kebab-case | `src/services/congress-api/` |
|
|
174
|
+
| Descriptions | Single string or template literal, no `+` concatenation | `'Browse and retrieve bill data.'` |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Imports
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
// Framework — z is re-exported, no separate zod import needed
|
|
182
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
183
|
+
import { notFound, serviceUnavailable, rateLimited } from '@cyanheads/mcp-ts-core/errors';
|
|
184
|
+
|
|
185
|
+
// Server's own code — via path alias
|
|
186
|
+
import { getCongressApi } from '@/services/congress-api/congress-api-service.js';
|
|
187
|
+
import { getServerConfig } from '@/config/server-config.js';
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Skills
|
|
193
|
+
|
|
194
|
+
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
195
|
+
|
|
196
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Codex: `.Codex/skills/`, others: equivalent). This makes skills available as context without needing to reference `skills/` paths manually. After framework updates, re-copy to pick up changes.
|
|
197
|
+
|
|
198
|
+
Available skills:
|
|
199
|
+
|
|
200
|
+
| Skill | Purpose |
|
|
201
|
+
|:------|:--------|
|
|
202
|
+
| `setup` | Post-init project orientation |
|
|
203
|
+
| `design-mcp-server` | Design tool surface, resources, and services for a new server |
|
|
204
|
+
| `add-tool` | Scaffold a new tool definition |
|
|
205
|
+
| `add-resource` | Scaffold a new resource definition |
|
|
206
|
+
| `add-prompt` | Scaffold a new prompt definition |
|
|
207
|
+
| `add-service` | Scaffold a new service integration |
|
|
208
|
+
| `add-test` | Scaffold test file for a tool, resource, or service |
|
|
209
|
+
| `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
|
|
210
|
+
| `devcheck` | Lint, format, typecheck, audit |
|
|
211
|
+
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
212
|
+
| `maintenance` | Sync skills and dependencies after updates |
|
|
213
|
+
| `report-issue-framework` | File bugs/features against `@cyanheads/mcp-ts-core` |
|
|
214
|
+
| `report-issue-local` | File bugs/features against this server's repo |
|
|
215
|
+
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
216
|
+
| `api-config` | AppConfig, parseConfig, env vars |
|
|
217
|
+
| `api-context` | Context interface, logger, state, progress |
|
|
218
|
+
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
219
|
+
| `api-services` | LLM, Speech, Graph services |
|
|
220
|
+
| `api-testing` | createMockContext, test patterns |
|
|
221
|
+
| `api-utils` | Formatting, parsing, security, pagination, scheduling |
|
|
222
|
+
| `api-workers` | Cloudflare Workers runtime |
|
|
223
|
+
|
|
224
|
+
When you complete a skill's checklist, check the boxes and add a completion timestamp at the end (e.g., `Completed: 2026-03-11`).
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Commands
|
|
229
|
+
|
|
230
|
+
| Command | Purpose |
|
|
231
|
+
|:--------|:--------|
|
|
232
|
+
| `bun run build` | Compile TypeScript |
|
|
233
|
+
| `bun run rebuild` | Clean + build |
|
|
234
|
+
| `bun run clean` | Remove build artifacts |
|
|
235
|
+
| `bun run devcheck` | Lint + format + typecheck + security |
|
|
236
|
+
| `bun run tree` | Generate directory structure doc |
|
|
237
|
+
| `bun run format` | Auto-fix formatting |
|
|
238
|
+
| `bun run lint:mcp` | Validate MCP tool/resource/prompt definitions |
|
|
239
|
+
| `bun run test` | Run tests |
|
|
240
|
+
| `bun run dev:stdio` | Dev mode (stdio) |
|
|
241
|
+
| `bun run dev:http` | Dev mode (HTTP) |
|
|
242
|
+
| `bun run start:stdio` | Production mode (stdio) |
|
|
243
|
+
| `bun run start:http` | Production mode (HTTP) |
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Publishing
|
|
248
|
+
|
|
249
|
+
After a version bump and final commit, publish to both npm and GHCR:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
bun publish --access public
|
|
253
|
+
|
|
254
|
+
docker buildx build --platform linux/amd64,linux/arm64 \
|
|
255
|
+
-t ghcr.io/cyanheads/congressgov-mcp-server:<version> \
|
|
256
|
+
-t ghcr.io/cyanheads/congressgov-mcp-server:latest \
|
|
257
|
+
--push .
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Remind the user to run these after completing a release flow.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Checklist
|
|
265
|
+
|
|
266
|
+
- [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, etc.)
|
|
267
|
+
- [ ] JSDoc `@fileoverview` + `@module` on every file
|
|
268
|
+
- [ ] `ctx.log` for logging, `ctx.state` for storage
|
|
269
|
+
- [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
|
|
270
|
+
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
271
|
+
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
272
|
+
- [ ] `bun run devcheck` passes
|
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** congressgov-mcp-server
|
|
4
|
-
**Version:** 0.3.
|
|
4
|
+
**Version:** 0.3.8
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
6
6
|
|
|
7
7
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
@@ -236,7 +236,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
236
236
|
| `bun run tree` | Generate directory structure doc |
|
|
237
237
|
| `bun run format` | Auto-fix formatting |
|
|
238
238
|
| `bun run lint:mcp` | Validate MCP tool/resource/prompt definitions |
|
|
239
|
-
| `bun test` | Run tests |
|
|
239
|
+
| `bun run test` | Run tests |
|
|
240
240
|
| `bun run dev:stdio` | Dev mode (stdio) |
|
|
241
241
|
| `bun run dev:http` | Dev mode (HTTP) |
|
|
242
242
|
| `bun run start:stdio` | Production mode (stdio) |
|
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](https://www.npmjs.com/package/@cyanheads/congressgov-mcp-server) [](https://www.npmjs.com/package/@cyanheads/congressgov-mcp-server) [](./CHANGELOG.md) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [](https://modelcontextprotocol.io/)
|
|
11
11
|
|
|
12
|
-
[](./LICENSE) [](./LICENSE) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
13
13
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bill.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/bill.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,YAAY;;;;
|
|
1
|
+
{"version":3,"file":"bill.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/bill.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,YAAY;;;;6BA2BvB,CAAC"}
|
|
@@ -19,7 +19,7 @@ export const billResource = resource('congress://bill/{congress}/{billType}/{bil
|
|
|
19
19
|
congress: Number(params.congress),
|
|
20
20
|
billType: params.billType,
|
|
21
21
|
billNumber: Number(params.billNumber),
|
|
22
|
-
});
|
|
22
|
+
}, ctx);
|
|
23
23
|
ctx.log.info('Bill resource fetched', {
|
|
24
24
|
congress: params.congress,
|
|
25
25
|
billType: params.billType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bill.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/bill.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAGjF,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,oDAAoD,EAAE;IACzF,I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EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,CAC9B;YACE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,QAAQ,EAAE,MAAM,CAAC,QAAoB;YACrC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;SACtC,EACD,GAAG,CACJ,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACpC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -18,7 +18,7 @@ export const committeeResource = resource('congress://committee/{committeeCode}'
|
|
|
18
18
|
: params.committeeCode.startsWith('j')
|
|
19
19
|
? 'joint'
|
|
20
20
|
: 'house';
|
|
21
|
-
const result = await api.getCommittee(chamber, params.committeeCode);
|
|
21
|
+
const result = await api.getCommittee(chamber, params.committeeCode, ctx);
|
|
22
22
|
ctx.log.info('Committee resource fetched', { committeeCode: params.committeeCode });
|
|
23
23
|
return result.committee;
|
|
24
24
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"committee.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/committee.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,sCAAsC,EAAE;IAChF,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,8EAA8E;IAC3F,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;KAC9E,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC;YAClD,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC;gBACpC,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,OAAO,CAAC;QACd,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"committee.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/committee.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,sCAAsC,EAAE;IAChF,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,8EAA8E;IAC3F,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;KAC9E,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC;YAClD,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC;gBACpC,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,OAAO,CAAC;QACd,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAC1E,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;QACpF,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -15,7 +15,7 @@ export const currentCongressResource = resource('congress://current', {
|
|
|
15
15
|
}),
|
|
16
16
|
async handler(_params, ctx) {
|
|
17
17
|
const api = getCongressApi();
|
|
18
|
-
const congress = await api.getCurrentCongress();
|
|
18
|
+
const congress = await api.getCurrentCongress(ctx);
|
|
19
19
|
ctx.log.info('Current congress fetched', { congress: congress.congress });
|
|
20
20
|
return congress;
|
|
21
21
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"current-congress.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/current-congress.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,oBAAoB,EAAE;IACpE,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,yFAAyF;IAC3F,QAAQ,EAAE,kBAAkB;IAE5B,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QACjB,SAAS,EAAE;YACT,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE;SACtF;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG;QACxB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"current-congress.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/current-congress.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,oBAAoB,EAAE;IACpE,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,yFAAyF;IAC3F,QAAQ,EAAE,kBAAkB;IAE5B,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QACjB,SAAS,EAAE;YACT,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAE;SACtF;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG;QACxB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACnD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC1E,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -13,7 +13,7 @@ export const memberResource = resource('congress://member/{bioguideId}', {
|
|
|
13
13
|
}),
|
|
14
14
|
async handler(params, ctx) {
|
|
15
15
|
const api = getCongressApi();
|
|
16
|
-
const result = await api.getMember(params.bioguideId);
|
|
16
|
+
const result = await api.getMember(params.bioguideId, ctx);
|
|
17
17
|
ctx.log.info('Member resource fetched', { bioguideId: params.bioguideId });
|
|
18
18
|
return result.member;
|
|
19
19
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/member.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,gCAAgC,EAAE;IACvE,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,oFAAoF;IACjG,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;KACvF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"member.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/member.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,gCAAgC,EAAE;IACvE,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,oFAAoF;IACjG,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;KACvF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -33,5 +33,22 @@ export declare const billLookupTool: import("@cyanheads/mcp-ts-core").ToolDefini
|
|
|
33
33
|
toDateTime: z.ZodOptional<z.ZodString>;
|
|
34
34
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
35
35
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
36
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
data: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
38
|
+
pagination: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
count: z.ZodNumber;
|
|
40
|
+
nextOffset: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
bill: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
congress: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
44
|
+
type: z.ZodOptional<z.ZodString>;
|
|
45
|
+
number: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
46
|
+
title: z.ZodOptional<z.ZodString>;
|
|
47
|
+
updateDate: z.ZodOptional<z.ZodString>;
|
|
48
|
+
latestAction: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
actionDate: z.ZodOptional<z.ZodString>;
|
|
50
|
+
text: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$loose>>;
|
|
52
|
+
}, z.core.$loose>>;
|
|
53
|
+
}, z.core.$loose>>;
|
|
37
54
|
//# sourceMappingURL=bill-lookup.tool.d.ts.map
|
|
@@ -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;
|
|
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;AA8DjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2GzB,CAAC"}
|
|
@@ -4,7 +4,35 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { formatBills } from '../../../mcp-server/tools/format-helpers.js';
|
|
7
|
+
import { createPaginationSchema, normalizeOptionalString, StringOrNumberSchema, } from '../../../mcp-server/tools/tool-helpers.js';
|
|
7
8
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
9
|
+
const PaginationSchema = createPaginationSchema('Total number of matching records.');
|
|
10
|
+
const BillDetailSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
congress: StringOrNumberSchema.optional().describe('Congress number when Congress.gov includes it.'),
|
|
13
|
+
type: z.string().optional().describe('Bill type code when provided by Congress.gov.'),
|
|
14
|
+
number: StringOrNumberSchema.optional().describe('Bill number when provided by Congress.gov.'),
|
|
15
|
+
title: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Bill title when provided by Congress.gov. Omitted when unknown.'),
|
|
19
|
+
updateDate: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Last update timestamp when provided by Congress.gov.'),
|
|
23
|
+
latestAction: z
|
|
24
|
+
.object({
|
|
25
|
+
actionDate: z
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Latest action date when provided by Congress.gov.'),
|
|
29
|
+
text: z.string().optional().describe('Latest action text when provided by Congress.gov.'),
|
|
30
|
+
})
|
|
31
|
+
.passthrough()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Latest action summary when provided by Congress.gov.'),
|
|
34
|
+
})
|
|
35
|
+
.passthrough();
|
|
8
36
|
const BillTypeEnum = z.enum(['hr', 's', 'hjres', 'sjres', 'hconres', 'sconres', 'hres', 'sres']);
|
|
9
37
|
const OperationEnum = z.enum([
|
|
10
38
|
'list',
|
|
@@ -23,16 +51,7 @@ const SUB_RESOURCE_MAP = {
|
|
|
23
51
|
related: 'relatedbills',
|
|
24
52
|
};
|
|
25
53
|
export const billLookupTool = tool('congressgov_bill_lookup', {
|
|
26
|
-
description: `Browse and retrieve U.S. legislative bill data from Congress.gov.
|
|
27
|
-
|
|
28
|
-
IMPORTANT: This API has no keyword search. To find bills, filter by congress number, bill type, and/or date range. Use 'congressgov_bill_summaries' to discover recently summarized legislation, or 'congressgov_member_lookup' to find bills via their sponsor.
|
|
29
|
-
|
|
30
|
-
Operations:
|
|
31
|
-
- list: Browse bills. Requires 'congress'. Add 'billType' to narrow by chamber/type.
|
|
32
|
-
- get: Full bill detail including sponsor, policy area, CBO estimates, and law info.
|
|
33
|
-
- actions/amendments/cosponsors/committees/subjects/summaries/text/titles/related: Sub-resources for a specific bill. Require congress + billType + billNumber.
|
|
34
|
-
|
|
35
|
-
For enacted laws, use 'congressgov_enacted_laws' instead.`,
|
|
54
|
+
description: `Browse and retrieve U.S. legislative bill data from Congress.gov. The API has no keyword search — discover bills by filtering on congress, bill type, and date range, or cross-reference via 'congressgov_bill_summaries' (recent CRS summaries) and 'congressgov_member_lookup' (bills by sponsor). Use 'list' to browse (requires congress), '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). For enacted laws, use 'congressgov_enacted_laws'.`,
|
|
36
55
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
37
56
|
input: z.object({
|
|
38
57
|
operation: OperationEnum.describe('Which data to retrieve.'),
|
|
@@ -52,19 +71,34 @@ For enacted laws, use 'congressgov_enacted_laws' instead.`,
|
|
|
52
71
|
limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
|
|
53
72
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
54
73
|
}),
|
|
55
|
-
output: z
|
|
74
|
+
output: z
|
|
75
|
+
.object({
|
|
76
|
+
data: z
|
|
77
|
+
.array(z.unknown())
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('List or sub-resource records for list and drill-down operations. Preserves upstream item shapes instead of narrowing them.'),
|
|
80
|
+
pagination: PaginationSchema.optional().describe('Pagination metadata for list and sub-resource operations.'),
|
|
81
|
+
bill: BillDetailSchema.optional().describe('Bill detail for operation="get".'),
|
|
82
|
+
})
|
|
83
|
+
.passthrough()
|
|
84
|
+
.refine((result) => (Array.isArray(result.data) && !!result.pagination) || !!result.bill, {
|
|
85
|
+
message: 'Expected either paginated list data or a bill detail object.',
|
|
86
|
+
})
|
|
87
|
+
.describe('Bill data from Congress.gov API.'),
|
|
56
88
|
format: formatBills,
|
|
57
89
|
async handler(input, ctx) {
|
|
58
90
|
const api = getCongressApi();
|
|
91
|
+
const fromDateTime = normalizeOptionalString(input.fromDateTime);
|
|
92
|
+
const toDateTime = normalizeOptionalString(input.toDateTime);
|
|
59
93
|
if (input.operation === 'list') {
|
|
60
94
|
const result = await api.listBills({
|
|
61
95
|
congress: input.congress,
|
|
62
96
|
billType: input.billType,
|
|
63
|
-
fromDateTime
|
|
64
|
-
toDateTime
|
|
97
|
+
fromDateTime,
|
|
98
|
+
toDateTime,
|
|
65
99
|
limit: input.limit,
|
|
66
100
|
offset: input.offset,
|
|
67
|
-
});
|
|
101
|
+
}, ctx);
|
|
68
102
|
ctx.log.info('Bills listed', { congress: input.congress, count: result.data.length });
|
|
69
103
|
return result;
|
|
70
104
|
}
|
|
@@ -76,7 +110,7 @@ For enacted laws, use 'congressgov_enacted_laws' instead.`,
|
|
|
76
110
|
congress: input.congress,
|
|
77
111
|
billType: input.billType,
|
|
78
112
|
billNumber: input.billNumber,
|
|
79
|
-
});
|
|
113
|
+
}, ctx);
|
|
80
114
|
ctx.log.info('Bill retrieved', {
|
|
81
115
|
congress: input.congress,
|
|
82
116
|
billType: input.billType,
|
|
@@ -92,7 +126,7 @@ For enacted laws, use 'congressgov_enacted_laws' instead.`,
|
|
|
92
126
|
subResource: subResource,
|
|
93
127
|
limit: input.limit,
|
|
94
128
|
offset: input.offset,
|
|
95
|
-
});
|
|
129
|
+
}, ctx);
|
|
96
130
|
ctx.log.info('Bill sub-resource retrieved', {
|
|
97
131
|
congress: input.congress,
|
|
98
132
|
billType: input.billType,
|
|
@@ -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;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAGjF,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjG,MAAM,a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KAAK,CAAC,UAAU;aAC7B,EACD,GAAG,CACJ,CAAC;YACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC;QACzE,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,kBAAkB,CACzC;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW,EAAE,WAA8B;YAC3C,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,EACD,GAAG,CACJ,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,6BAA6B,EAAE;YAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW;SACZ,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -19,5 +19,11 @@ export declare const billSummariesTool: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
19
19
|
toDateTime: z.ZodOptional<z.ZodString>;
|
|
20
20
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
21
21
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
22
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
data: z.ZodArray<z.ZodUnknown>;
|
|
24
|
+
pagination: z.ZodObject<{
|
|
25
|
+
count: z.ZodNumber;
|
|
26
|
+
nextOffset: z.ZodNullable<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
}, z.core.$loose>>;
|
|
23
29
|
//# sourceMappingURL=bill-summaries.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bill-summaries.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/bill-summaries.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"bill-summaries.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/bill-summaries.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAajD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;kBAoE5B,CAAC"}
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { formatSummaries } from '../../../mcp-server/tools/format-helpers.js';
|
|
7
|
+
import { createPaginationSchema, normalizeOptionalString, } from '../../../mcp-server/tools/tool-helpers.js';
|
|
7
8
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
9
|
+
const DEFAULT_LOOKBACK_MS = 7 * 24 * 60 * 60 * 1000;
|
|
10
|
+
const PaginationSchema = createPaginationSchema('Total number of matching summaries.');
|
|
8
11
|
export const billSummariesTool = tool('congressgov_bill_summaries', {
|
|
9
|
-
description: `Browse recent CRS (Congressional Research Service) bill summaries.
|
|
10
|
-
|
|
11
|
-
This is the best tool for answering "what's happening in Congress?" — CRS analysts write plain-language summaries of bills at each legislative stage.
|
|
12
|
-
|
|
13
|
-
By default, returns summaries from the last 7 days. Specify fromDateTime/toDateTime for custom ranges. Each summary includes the associated bill reference (congress, type, number) for follow-up with congressgov_bill_lookup.`,
|
|
12
|
+
description: `Browse recent CRS (Congressional Research Service) bill summaries — plain-language summaries of bills at each legislative stage, and the best tool for answering "what's happening in Congress?". Defaults to the last 7 days; specify fromDateTime/toDateTime for custom ranges. Each summary includes the associated bill reference (congress, type, number) for follow-up with 'congressgov_bill_lookup'.`,
|
|
14
13
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
15
14
|
input: z.object({
|
|
16
15
|
congress: z
|
|
@@ -31,25 +30,35 @@ By default, returns summaries from the last 7 days. Specify fromDateTime/toDateT
|
|
|
31
30
|
limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
|
|
32
31
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
33
32
|
}),
|
|
34
|
-
output: z
|
|
33
|
+
output: z
|
|
34
|
+
.object({
|
|
35
|
+
data: z
|
|
36
|
+
.array(z.unknown())
|
|
37
|
+
.describe('Bill summaries returned by Congress.gov. Preserves upstream item shapes instead of narrowing them.'),
|
|
38
|
+
pagination: PaginationSchema.describe('Pagination metadata for the returned summaries.'),
|
|
39
|
+
})
|
|
40
|
+
.passthrough()
|
|
41
|
+
.describe('Bill summary data from Congress.gov API.'),
|
|
35
42
|
format: formatSummaries,
|
|
36
43
|
async handler(input, ctx) {
|
|
44
|
+
const fromDateTimeInput = normalizeOptionalString(input.fromDateTime);
|
|
45
|
+
const toDateTimeInput = normalizeOptionalString(input.toDateTime);
|
|
37
46
|
if (input.billType && !input.congress) {
|
|
38
47
|
throw new Error("The 'billType' filter requires 'congress'. Provide both or omit billType to browse across all types.");
|
|
39
48
|
}
|
|
40
|
-
const fromDateTime =
|
|
41
|
-
(!
|
|
42
|
-
? new Date(Date.now() -
|
|
49
|
+
const fromDateTime = fromDateTimeInput ??
|
|
50
|
+
(!toDateTimeInput
|
|
51
|
+
? new Date(Date.now() - DEFAULT_LOOKBACK_MS).toISOString().replace(/\.\d{3}Z$/, 'Z')
|
|
43
52
|
: undefined);
|
|
44
53
|
const api = getCongressApi();
|
|
45
54
|
const result = await api.listSummaries({
|
|
46
55
|
congress: input.congress,
|
|
47
56
|
billType: input.billType,
|
|
48
57
|
fromDateTime,
|
|
49
|
-
toDateTime:
|
|
58
|
+
toDateTime: toDateTimeInput,
|
|
50
59
|
limit: input.limit,
|
|
51
60
|
offset: input.offset,
|
|
52
|
-
});
|
|
61
|
+
}, ctx);
|
|
53
62
|
ctx.log.info('Summaries listed', { count: result.data.length });
|
|
54
63
|
return result;
|
|
55
64
|
},
|