@cyanheads/openstates-mcp-server 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CLAUDE.md +397 -0
  2. package/Dockerfile +99 -0
  3. package/LICENSE +201 -0
  4. package/README.md +324 -0
  5. package/changelog/0.1.x/0.1.0.md +23 -0
  6. package/changelog/0.1.x/0.1.1.md +29 -0
  7. package/changelog/template.md +119 -0
  8. package/dist/config/server-config.d.ts +13 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +19 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +50 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/prompts/definitions/bill-research.prompt.d.ts +11 -0
  17. package/dist/mcp-server/prompts/definitions/bill-research.prompt.d.ts.map +1 -0
  18. package/dist/mcp-server/prompts/definitions/bill-research.prompt.js +65 -0
  19. package/dist/mcp-server/prompts/definitions/bill-research.prompt.js.map +1 -0
  20. package/dist/mcp-server/prompts/definitions/legislator-profile.prompt.d.ts +10 -0
  21. package/dist/mcp-server/prompts/definitions/legislator-profile.prompt.d.ts.map +1 -0
  22. package/dist/mcp-server/prompts/definitions/legislator-profile.prompt.js +55 -0
  23. package/dist/mcp-server/prompts/definitions/legislator-profile.prompt.js.map +1 -0
  24. package/dist/mcp-server/resources/definitions/jurisdiction.resource.d.ts +9 -0
  25. package/dist/mcp-server/resources/definitions/jurisdiction.resource.d.ts.map +1 -0
  26. package/dist/mcp-server/resources/definitions/jurisdiction.resource.js +60 -0
  27. package/dist/mcp-server/resources/definitions/jurisdiction.resource.js.map +1 -0
  28. package/dist/mcp-server/tools/definitions/get-bill.tool.d.ts +121 -0
  29. package/dist/mcp-server/tools/definitions/get-bill.tool.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/get-bill.tool.js +319 -0
  31. package/dist/mcp-server/tools/definitions/get-bill.tool.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/get-committee.tool.d.ts +30 -0
  33. package/dist/mcp-server/tools/definitions/get-committee.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/get-committee.tool.js +89 -0
  35. package/dist/mcp-server/tools/definitions/get-committee.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/get-event.tool.d.ts +65 -0
  37. package/dist/mcp-server/tools/definitions/get-event.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/get-event.tool.js +231 -0
  39. package/dist/mcp-server/tools/definitions/get-event.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/get-jurisdiction.tool.d.ts +34 -0
  41. package/dist/mcp-server/tools/definitions/get-jurisdiction.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/get-jurisdiction.tool.js +99 -0
  43. package/dist/mcp-server/tools/definitions/get-jurisdiction.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/get-legislators-by-location.tool.d.ts +53 -0
  45. package/dist/mcp-server/tools/definitions/get-legislators-by-location.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/get-legislators-by-location.tool.js +156 -0
  47. package/dist/mcp-server/tools/definitions/get-legislators-by-location.tool.js.map +1 -0
  48. package/dist/mcp-server/tools/definitions/list-jurisdictions.tool.d.ts +42 -0
  49. package/dist/mcp-server/tools/definitions/list-jurisdictions.tool.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/definitions/list-jurisdictions.tool.js +110 -0
  51. package/dist/mcp-server/tools/definitions/list-jurisdictions.tool.js.map +1 -0
  52. package/dist/mcp-server/tools/definitions/search-bills.tool.d.ts +102 -0
  53. package/dist/mcp-server/tools/definitions/search-bills.tool.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/definitions/search-bills.tool.js +285 -0
  55. package/dist/mcp-server/tools/definitions/search-bills.tool.js.map +1 -0
  56. package/dist/mcp-server/tools/definitions/search-committees.tool.d.ts +44 -0
  57. package/dist/mcp-server/tools/definitions/search-committees.tool.d.ts.map +1 -0
  58. package/dist/mcp-server/tools/definitions/search-committees.tool.js +127 -0
  59. package/dist/mcp-server/tools/definitions/search-committees.tool.js.map +1 -0
  60. package/dist/mcp-server/tools/definitions/search-events.tool.d.ts +62 -0
  61. package/dist/mcp-server/tools/definitions/search-events.tool.d.ts.map +1 -0
  62. package/dist/mcp-server/tools/definitions/search-events.tool.js +198 -0
  63. package/dist/mcp-server/tools/definitions/search-events.tool.js.map +1 -0
  64. package/dist/mcp-server/tools/definitions/search-people.tool.d.ts +64 -0
  65. package/dist/mcp-server/tools/definitions/search-people.tool.d.ts.map +1 -0
  66. package/dist/mcp-server/tools/definitions/search-people.tool.js +193 -0
  67. package/dist/mcp-server/tools/definitions/search-people.tool.js.map +1 -0
  68. package/dist/services/openstates/openstates-service.d.ts +30 -0
  69. package/dist/services/openstates/openstates-service.d.ts.map +1 -0
  70. package/dist/services/openstates/openstates-service.js +246 -0
  71. package/dist/services/openstates/openstates-service.js.map +1 -0
  72. package/dist/services/openstates/types.d.ts +324 -0
  73. package/dist/services/openstates/types.d.ts.map +1 -0
  74. package/dist/services/openstates/types.js +6 -0
  75. package/dist/services/openstates/types.js.map +1 -0
  76. package/package.json +91 -0
  77. package/server.json +99 -0
@@ -0,0 +1,319 @@
1
+ /**
2
+ * @fileoverview Fetch full detail for a specific state bill.
3
+ * @module mcp-server/tools/definitions/get-bill
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getOpenStatesApiService } from '../../../services/openstates/openstates-service.js';
8
+ const BillIncludeEnum = z.enum([
9
+ 'sponsorships',
10
+ 'abstracts',
11
+ 'other_titles',
12
+ 'other_identifiers',
13
+ 'actions',
14
+ 'sources',
15
+ 'documents',
16
+ 'versions',
17
+ 'votes',
18
+ 'related_bills',
19
+ ]);
20
+ export const getBill = tool('openstates_get_bill', {
21
+ title: 'Get Bill',
22
+ description: 'Fetch full detail for a specific state bill. Accepts either the three-part path (jurisdiction + session + bill_id) or a direct OCD bill ID (openstates_id from search results). Use include to request votes, actions, sponsorships, documents, and versions in one call rather than searching again. include=votes returns the full vote tally and per-legislator positions. include=actions returns the complete action history. Prefer openstates_id when available to avoid session identifier lookup.',
23
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
24
+ input: z.object({
25
+ openstates_id: z
26
+ .string()
27
+ .optional()
28
+ .describe('OCD bill ID from openstates_search_bills results (e.g., "ocd-bill/..."). Preferred over the three-part path when available.'),
29
+ jurisdiction: z
30
+ .string()
31
+ .optional()
32
+ .describe('State name, abbreviation, or OCD-ID. Required when using path-based lookup with session + bill_id.'),
33
+ session: z
34
+ .string()
35
+ .optional()
36
+ .describe('Session identifier. Required with jurisdiction + bill_id.'),
37
+ bill_id: z
38
+ .string()
39
+ .optional()
40
+ .describe('Bill identifier as used by the legislature (e.g., "HB 1000", "SB 42"). Required with jurisdiction + session.'),
41
+ include: z
42
+ .array(BillIncludeEnum)
43
+ .optional()
44
+ .describe('Related data to inline. "sponsorships", "actions", "votes" are most commonly needed. "versions" and "documents" provide links to bill text and fiscal notes.'),
45
+ }),
46
+ output: z.object({
47
+ id: z.string().describe('OCD bill ID.'),
48
+ identifier: z.string().describe('Bill identifier as used by the legislature.'),
49
+ title: z.string().describe('Bill title.'),
50
+ session: z.string().describe('Legislative session identifier.'),
51
+ jurisdiction: z
52
+ .object({
53
+ id: z.string().describe('OCD jurisdiction ID.'),
54
+ name: z.string().describe('Jurisdiction name.'),
55
+ })
56
+ .describe('Originating jurisdiction.'),
57
+ from_organization: z
58
+ .object({
59
+ name: z.string().describe('Chamber name.'),
60
+ classification: z.string().describe('Chamber classification.'),
61
+ })
62
+ .describe('Originating chamber.'),
63
+ classification: z.array(z.string()).describe('Bill classifications.'),
64
+ subject: z.array(z.string()).describe('Subject tags.'),
65
+ first_action_date: z.string().nullable().describe('Date of first recorded action.'),
66
+ latest_action_date: z.string().nullable().describe('Date of most recent action.'),
67
+ latest_action_description: z.string().nullable().describe('Most recent action description.'),
68
+ latest_passage_date: z.string().nullable().describe('Date bill passed (when applicable).'),
69
+ openstates_url: z.string().optional().describe('Open States URL for this bill.'),
70
+ sponsorships: z
71
+ .array(z
72
+ .object({
73
+ name: z.string().describe('Sponsor name.'),
74
+ entity_type: z.string().describe('Entity type.'),
75
+ primary: z.boolean().describe('Whether this is the primary sponsor.'),
76
+ classification: z.string().describe('Sponsorship classification.'),
77
+ person: z
78
+ .object({
79
+ id: z.string().describe('OCD person ID.'),
80
+ name: z.string().describe('Person name.'),
81
+ })
82
+ .optional()
83
+ .describe('Linked person record when available.'),
84
+ })
85
+ .describe('Sponsorship record.'))
86
+ .optional()
87
+ .describe('Sponsorships when include=sponsorships is requested.'),
88
+ actions: z
89
+ .array(z
90
+ .object({
91
+ description: z.string().describe('Action description.'),
92
+ date: z.string().describe('Action date.'),
93
+ classification: z.array(z.string()).describe('Action classifications.'),
94
+ order: z.number().describe('Sequence order.'),
95
+ organization: z
96
+ .object({
97
+ name: z.string().describe('Organization name.'),
98
+ classification: z.string().describe('Organization classification.'),
99
+ })
100
+ .describe('Chamber or committee.'),
101
+ })
102
+ .describe('Action record.'))
103
+ .optional()
104
+ .describe('Full action history when include=actions is requested.'),
105
+ votes: z
106
+ .array(z
107
+ .object({
108
+ id: z.string().describe('Vote event ID.'),
109
+ motion_text: z.string().describe('Motion text.'),
110
+ start_date: z.string().describe('Vote date.'),
111
+ result: z.string().describe('Vote result: "pass" or "fail".'),
112
+ identifier: z.string().describe('Vote identifier.'),
113
+ counts: z
114
+ .array(z
115
+ .object({
116
+ option: z.string().describe('Vote option (e.g., "yes", "no", "absent").'),
117
+ value: z.number().describe('Count of votes for this option.'),
118
+ })
119
+ .describe('Vote tally entry.'))
120
+ .describe('Vote tallies by option.'),
121
+ votes: z
122
+ .array(z
123
+ .object({
124
+ option: z.string().describe('How this legislator voted.'),
125
+ voter_name: z.string().describe('Voter name.'),
126
+ voter: z
127
+ .object({
128
+ id: z.string().describe('OCD person ID.'),
129
+ name: z.string().describe('Person name.'),
130
+ })
131
+ .optional()
132
+ .describe('Linked person record when available.'),
133
+ })
134
+ .describe('Individual legislator vote.'))
135
+ .describe('Per-legislator vote positions.'),
136
+ })
137
+ .describe('Vote event record.'))
138
+ .optional()
139
+ .describe('Vote events when include=votes is requested.'),
140
+ abstracts: z
141
+ .array(z
142
+ .object({
143
+ abstract: z.string().describe('Plain-language summary.'),
144
+ note: z.string().describe('Source note.'),
145
+ })
146
+ .describe('Abstract record.'))
147
+ .optional()
148
+ .describe('Bill abstracts when include=abstracts is requested.'),
149
+ versions: z
150
+ .array(z
151
+ .object({
152
+ id: z.string().describe('Version ID.'),
153
+ note: z.string().describe('Version note.'),
154
+ date: z.string().describe('Version date.'),
155
+ links: z
156
+ .array(z
157
+ .object({
158
+ url: z.string().describe('Document URL.'),
159
+ media_type: z.string().describe('MIME type.'),
160
+ })
161
+ .describe('Document link.'))
162
+ .describe('Document links.'),
163
+ })
164
+ .describe('Bill text version record.'))
165
+ .optional()
166
+ .describe('Bill text versions when include=versions is requested.'),
167
+ documents: z
168
+ .array(z
169
+ .object({
170
+ id: z.string().describe('Document ID.'),
171
+ note: z.string().describe('Document note.'),
172
+ date: z.string().describe('Document date.'),
173
+ links: z
174
+ .array(z
175
+ .object({
176
+ url: z.string().describe('Document URL.'),
177
+ media_type: z.string().describe('MIME type.'),
178
+ })
179
+ .describe('Document link.'))
180
+ .describe('Document links.'),
181
+ })
182
+ .describe('Bill document record.'))
183
+ .optional()
184
+ .describe('Bill documents (fiscal notes, etc.) when include=documents is requested.'),
185
+ related_bills: z
186
+ .array(z
187
+ .object({
188
+ identifier: z.string().describe('Related bill identifier.'),
189
+ legislative_session: z.string().describe('Session of the related bill.'),
190
+ relation_type: z
191
+ .string()
192
+ .describe('Relationship type (e.g., "companion", "identical").'),
193
+ })
194
+ .describe('Related bill record.'))
195
+ .optional()
196
+ .describe('Related bills when include=related_bills is requested.'),
197
+ }),
198
+ errors: [
199
+ {
200
+ reason: 'missing_lookup_params',
201
+ code: JsonRpcErrorCode.InvalidParams,
202
+ when: 'Neither openstates_id nor the complete jurisdiction+session+bill_id triple was provided.',
203
+ recovery: 'Provide either openstates_id (from openstates_search_bills results) or all three of: jurisdiction, session, and bill_id.',
204
+ },
205
+ {
206
+ reason: 'not_found',
207
+ code: JsonRpcErrorCode.NotFound,
208
+ when: 'Bill does not exist at the given path or OCD ID.',
209
+ recovery: 'Verify the session identifier with openstates_get_jurisdiction and confirm the bill_id format matches the legislature convention (e.g., "HB 1000" not "HB1000").',
210
+ },
211
+ ],
212
+ async handler(input, ctx) {
213
+ const hasOcdId = !!input.openstates_id;
214
+ const hasPathLookup = !!input.jurisdiction && !!input.session && !!input.bill_id;
215
+ if (!hasOcdId && !hasPathLookup) {
216
+ throw ctx.fail('missing_lookup_params', 'Provide openstates_id OR jurisdiction + session + bill_id.', {
217
+ ...ctx.recoveryFor('missing_lookup_params'),
218
+ });
219
+ }
220
+ const svc = getOpenStatesApiService();
221
+ const include = input.include && input.include.length > 0 ? input.include : undefined;
222
+ const bill = await (hasOcdId
223
+ ? svc.getBillById(input.openstates_id, include, ctx)
224
+ : svc.getBillByPath(input.jurisdiction, input.session, input.bill_id, include, ctx)).catch((err) => {
225
+ if (err instanceof McpError && err.code === JsonRpcErrorCode.NotFound) {
226
+ const id = input.openstates_id ?? `${input.jurisdiction}/${input.session}/${input.bill_id}`;
227
+ throw ctx.fail('not_found', `Bill not found: ${id}`, { ...ctx.recoveryFor('not_found') });
228
+ }
229
+ throw err;
230
+ });
231
+ ctx.log.info('Fetched bill', { id: bill.id, identifier: bill.identifier });
232
+ return bill;
233
+ },
234
+ format: (result) => {
235
+ const lines = [
236
+ `# ${result.identifier} — ${result.title}`,
237
+ `**ID:** ${result.id}`,
238
+ `**Session:** ${result.session} | **Jurisdiction:** ${result.jurisdiction.name} (${result.jurisdiction.id})`,
239
+ `**Chamber:** ${result.from_organization.name} (${result.from_organization.classification})`,
240
+ ];
241
+ if (result.classification.length > 0)
242
+ lines.push(`**Classification:** ${result.classification.join(', ')}`);
243
+ if (result.subject.length > 0)
244
+ lines.push(`**Subjects:** ${result.subject.join(', ')}`);
245
+ if (result.first_action_date)
246
+ lines.push(`**First action:** ${result.first_action_date}`);
247
+ if (result.latest_action_date) {
248
+ lines.push(`**Latest action:** ${result.latest_action_date} — ${result.latest_action_description ?? 'N/A'}`);
249
+ }
250
+ if (result.latest_passage_date)
251
+ lines.push(`**Passed:** ${result.latest_passage_date}`);
252
+ if (result.openstates_url)
253
+ lines.push(`**URL:** ${result.openstates_url}`);
254
+ if (result.abstracts?.length) {
255
+ lines.push('');
256
+ lines.push('## Summary');
257
+ for (const abs of result.abstracts) {
258
+ lines.push(`${abs.abstract} _(${abs.note})_`);
259
+ }
260
+ }
261
+ if (result.sponsorships?.length) {
262
+ lines.push('');
263
+ lines.push('## Sponsors');
264
+ for (const s of result.sponsorships) {
265
+ const marker = s.primary ? '**Primary**' : 'Cosponsor';
266
+ const person = s.person ? ` [person: ${s.person.name} (${s.person.id})]` : '';
267
+ lines.push(`- ${marker}: ${s.name} (${s.classification}, ${s.entity_type})${person}`);
268
+ }
269
+ }
270
+ if (result.actions?.length) {
271
+ lines.push('');
272
+ lines.push('## Action History');
273
+ for (const a of result.actions) {
274
+ const cls = a.classification.length > 0 ? ` [${a.classification.join(', ')}]` : '';
275
+ lines.push(`- #${a.order} ${a.date}: ${a.description}${cls} — ${a.organization.name} (${a.organization.classification})`);
276
+ }
277
+ }
278
+ if (result.votes?.length) {
279
+ lines.push('');
280
+ lines.push('## Votes');
281
+ for (const v of result.votes) {
282
+ lines.push(`### ${v.motion_text} (${v.start_date})`);
283
+ lines.push(`**Result:** ${v.result} | **ID:** ${v.id} | **Identifier:** ${v.identifier}`);
284
+ const counts = v.counts.map((c) => `${c.option}: ${c.value}`).join(', ');
285
+ lines.push(`**Tally:** ${counts}`);
286
+ if (v.votes.length > 0) {
287
+ lines.push('**Individual votes:**');
288
+ for (const pv of v.votes) {
289
+ const voterLink = pv.voter ? ` (ID: ${pv.voter.id}, name: ${pv.voter.name})` : '';
290
+ lines.push(`- ${pv.voter_name}${voterLink}: ${pv.option}`);
291
+ }
292
+ }
293
+ }
294
+ }
295
+ if (result.versions?.length) {
296
+ lines.push('');
297
+ lines.push('## Bill Text Versions');
298
+ for (const v of result.versions) {
299
+ lines.push(`- [${v.id}] ${v.note} (${v.date}): ${v.links.map((l) => `${l.url} [${l.media_type}]`).join(', ')}`);
300
+ }
301
+ }
302
+ if (result.documents?.length) {
303
+ lines.push('');
304
+ lines.push('## Documents');
305
+ for (const d of result.documents) {
306
+ lines.push(`- [${d.id}] ${d.note} (${d.date}): ${d.links.map((l) => `${l.url} [${l.media_type}]`).join(', ')}`);
307
+ }
308
+ }
309
+ if (result.related_bills?.length) {
310
+ lines.push('');
311
+ lines.push('## Related Bills');
312
+ for (const r of result.related_bills) {
313
+ lines.push(`- ${r.identifier} (${r.legislative_session}) — ${r.relation_type}`);
314
+ }
315
+ }
316
+ return [{ type: 'text', text: lines.join('\n') }];
317
+ },
318
+ });
319
+ //# sourceMappingURL=get-bill.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bill.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-bill.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IAC7B,cAAc;IACd,WAAW;IACX,cAAc;IACd,mBAAmB;IACnB,SAAS;IACT,SAAS;IACT,WAAW;IACX,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AAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpG,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC3B,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;gBACjC,KAAK,CAAC,IAAI,CACR,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpG,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC/B,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;gBACrC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,mBAAmB,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @fileoverview Fetch full committee detail by OCD organization ID (experimental).
3
+ * @module mcp-server/tools/definitions/get-committee
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const getCommittee: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ committee_id: z.ZodString;
9
+ include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
10
+ memberships: "memberships";
11
+ sources: "sources";
12
+ links: "links";
13
+ }>>>;
14
+ }, z.core.$strip>, z.ZodObject<{
15
+ id: z.ZodString;
16
+ name: z.ZodString;
17
+ classification: z.ZodString;
18
+ parent_id: z.ZodNullable<z.ZodString>;
19
+ memberships: z.ZodOptional<z.ZodArray<z.ZodObject<{
20
+ person_id: z.ZodString;
21
+ person_name: z.ZodString;
22
+ role: z.ZodString;
23
+ }, z.core.$strip>>>;
24
+ }, z.core.$strip>, readonly [{
25
+ readonly reason: "not_found";
26
+ readonly code: JsonRpcErrorCode.NotFound;
27
+ readonly when: "Committee ID does not exist in Open States.";
28
+ readonly recovery: "Use openstates_search_committees to discover valid committee IDs for a jurisdiction. Note that committee data is experimental and not all states have coverage.";
29
+ }]>;
30
+ //# sourceMappingURL=get-committee.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-committee.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-committee.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAK3E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;GA0FvB,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @fileoverview Fetch full committee detail by OCD organization ID (experimental).
3
+ * @module mcp-server/tools/definitions/get-committee
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getOpenStatesApiService } from '../../../services/openstates/openstates-service.js';
8
+ const CommitteeIncludeEnum = z.enum(['memberships', 'links', 'sources']);
9
+ export const getCommittee = tool('openstates_get_committee', {
10
+ title: 'Get Committee',
11
+ description: 'Fetch committee detail by OCD organization ID. Returns name, classification, and membership roster when include=memberships is requested. Experimental — not all states have committee data in Open States. Obtain the committee_id from openstates_search_committees.',
12
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
13
+ input: z.object({
14
+ committee_id: z
15
+ .string()
16
+ .min(1)
17
+ .describe('OCD organization ID (from openstates_search_committees results).'),
18
+ include: z
19
+ .array(CommitteeIncludeEnum)
20
+ .optional()
21
+ .describe('Related data to inline. "memberships" includes the full roster with member roles.'),
22
+ }),
23
+ output: z.object({
24
+ id: z.string().describe('OCD organization ID.'),
25
+ name: z.string().describe('Committee name.'),
26
+ classification: z.string().describe('Committee classification: "committee" or "subcommittee".'),
27
+ parent_id: z
28
+ .string()
29
+ .nullable()
30
+ .describe('OCD ID of parent committee, or null for top-level committees.'),
31
+ memberships: z
32
+ .array(z
33
+ .object({
34
+ person_id: z.string().describe('OCD person ID of the member.'),
35
+ person_name: z.string().describe('Member name.'),
36
+ role: z.string().describe('Member role (e.g., "chair", "member").'),
37
+ })
38
+ .describe('Committee membership record.'))
39
+ .optional()
40
+ .describe('Membership roster when include=memberships is requested.'),
41
+ }),
42
+ errors: [
43
+ {
44
+ reason: 'not_found',
45
+ code: JsonRpcErrorCode.NotFound,
46
+ when: 'Committee ID does not exist in Open States.',
47
+ recovery: 'Use openstates_search_committees to discover valid committee IDs for a jurisdiction. Note that committee data is experimental and not all states have coverage.',
48
+ },
49
+ ],
50
+ async handler(input, ctx) {
51
+ const svc = getOpenStatesApiService();
52
+ const committee = await svc
53
+ .getCommittee(input.committee_id, input.include && input.include.length > 0 ? input.include : undefined, ctx)
54
+ .catch((err) => {
55
+ if (err instanceof McpError && err.code === JsonRpcErrorCode.NotFound) {
56
+ throw ctx.fail('not_found', `Committee not found: ${input.committee_id}`, {
57
+ ...ctx.recoveryFor('not_found'),
58
+ });
59
+ }
60
+ throw err;
61
+ });
62
+ ctx.log.info('Fetched committee', { id: committee.id, name: committee.name });
63
+ return {
64
+ id: committee.id,
65
+ name: committee.name,
66
+ classification: committee.classification,
67
+ parent_id: committee.parent_id,
68
+ ...(committee.memberships ? { memberships: committee.memberships } : {}),
69
+ };
70
+ },
71
+ format: (result) => {
72
+ const lines = [
73
+ `# ${result.name}`,
74
+ `**ID:** ${result.id}`,
75
+ `**Classification:** ${result.classification}`,
76
+ ];
77
+ if (result.parent_id)
78
+ lines.push(`**Parent ID:** ${result.parent_id}`);
79
+ if (result.memberships?.length) {
80
+ lines.push('');
81
+ lines.push('## Members');
82
+ for (const m of result.memberships) {
83
+ lines.push(`- ${m.person_name} (${m.role}) — ID: ${m.person_id}`);
84
+ }
85
+ }
86
+ return [{ type: 'text', text: lines.join('\n') }];
87
+ },
88
+ });
89
+ //# sourceMappingURL=get-committee.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-committee.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-committee.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,0BAA0B,EAAE;IAC3D,KAAK,EAAE,eAAe;IACtB,WAAW,EACT,wQAAwQ;IAC1Q,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CA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;QACF,IAAI,MAAM,CAAC,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACvE,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACzB,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBACnC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @fileoverview Fetch full event detail by OCD event ID (experimental).
3
+ * @module mcp-server/tools/definitions/get-event
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const getEvent: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ event_id: z.ZodString;
9
+ include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
10
+ sources: "sources";
11
+ documents: "documents";
12
+ links: "links";
13
+ media: "media";
14
+ participants: "participants";
15
+ agenda: "agenda";
16
+ }>>>;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ id: z.ZodString;
19
+ name: z.ZodString;
20
+ description: z.ZodString;
21
+ classification: z.ZodString;
22
+ start_date: z.ZodString;
23
+ end_date: z.ZodOptional<z.ZodString>;
24
+ status: z.ZodString;
25
+ jurisdiction: z.ZodObject<{
26
+ id: z.ZodString;
27
+ name: z.ZodString;
28
+ }, z.core.$strip>;
29
+ location: z.ZodOptional<z.ZodObject<{
30
+ name: z.ZodString;
31
+ url: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>>;
33
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
34
+ url: z.ZodString;
35
+ note: z.ZodString;
36
+ }, z.core.$strip>>>;
37
+ media: z.ZodOptional<z.ZodArray<z.ZodObject<{
38
+ url: z.ZodString;
39
+ note: z.ZodString;
40
+ }, z.core.$strip>>>;
41
+ documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ url: z.ZodString;
43
+ note: z.ZodString;
44
+ }, z.core.$strip>>>;
45
+ participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ name: z.ZodString;
47
+ entity_type: z.ZodString;
48
+ role: z.ZodString;
49
+ }, z.core.$strip>>>;
50
+ agenda: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
+ description: z.ZodString;
52
+ classification: z.ZodArray<z.ZodString>;
53
+ subjects: z.ZodArray<z.ZodString>;
54
+ related_entities: z.ZodArray<z.ZodObject<{
55
+ name: z.ZodString;
56
+ entity_type: z.ZodString;
57
+ }, z.core.$strip>>;
58
+ }, z.core.$strip>>>;
59
+ }, z.core.$strip>, readonly [{
60
+ readonly reason: "not_found";
61
+ readonly code: JsonRpcErrorCode.NotFound;
62
+ readonly when: "Event ID does not exist in Open States.";
63
+ readonly recovery: "Use openstates_search_events with a jurisdiction and date range to discover valid event IDs. Note that event data is experimental and coverage varies widely by state.";
64
+ }]>;
65
+ //# sourceMappingURL=get-event.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-event.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-event.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAY3E,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuOnB,CAAC"}