@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,231 @@
1
+ /**
2
+ * @fileoverview Fetch full event detail by OCD event ID (experimental).
3
+ * @module mcp-server/tools/definitions/get-event
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 EventIncludeEnum = z.enum([
9
+ 'links',
10
+ 'sources',
11
+ 'media',
12
+ 'documents',
13
+ 'participants',
14
+ 'agenda',
15
+ ]);
16
+ export const getEvent = tool('openstates_get_event', {
17
+ title: 'Get Event',
18
+ description: 'Fetch full event detail by OCD event ID. Returns agenda, participants, media links, and associated documents when requested via include. Experimental — event coverage is limited in Open States. Obtain the event_id from openstates_search_events.',
19
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
20
+ input: z.object({
21
+ event_id: z.string().min(1).describe('OCD event ID (from openstates_search_events results).'),
22
+ include: z
23
+ .array(EventIncludeEnum)
24
+ .optional()
25
+ .describe('Related data to inline. "agenda" and "participants" are most useful.'),
26
+ }),
27
+ output: z.object({
28
+ id: z.string().describe('OCD event ID.'),
29
+ name: z.string().describe('Event name.'),
30
+ description: z.string().describe('Event description.'),
31
+ classification: z.string().describe('Event classification.'),
32
+ start_date: z.string().describe('Event start datetime.'),
33
+ end_date: z.string().optional().describe('Event end datetime. Absent when not recorded.'),
34
+ status: z.string().describe('Event status.'),
35
+ jurisdiction: z
36
+ .object({
37
+ id: z.string().describe('OCD jurisdiction ID.'),
38
+ name: z.string().describe('Jurisdiction name.'),
39
+ })
40
+ .describe('Hosting jurisdiction.'),
41
+ location: z
42
+ .object({
43
+ name: z.string().describe('Location name.'),
44
+ url: z.string().optional().describe('Location URL when available.'),
45
+ })
46
+ .optional()
47
+ .describe('Event location when available.'),
48
+ links: z
49
+ .array(z
50
+ .object({
51
+ url: z.string().describe('Link URL.'),
52
+ note: z.string().describe('Link description.'),
53
+ })
54
+ .describe('External link record.'))
55
+ .optional()
56
+ .describe('Event links when include=links is requested.'),
57
+ media: z
58
+ .array(z
59
+ .object({
60
+ url: z.string().describe('Media URL.'),
61
+ note: z.string().describe('Media description.'),
62
+ })
63
+ .describe('Media link record.'))
64
+ .optional()
65
+ .describe('Media links when include=media is requested.'),
66
+ documents: z
67
+ .array(z
68
+ .object({
69
+ url: z.string().describe('Document URL.'),
70
+ note: z.string().describe('Document description.'),
71
+ })
72
+ .describe('Document link record.'))
73
+ .optional()
74
+ .describe('Document links when include=documents is requested.'),
75
+ participants: z
76
+ .array(z
77
+ .object({
78
+ name: z.string().describe('Participant name.'),
79
+ entity_type: z.string().describe('Entity type.'),
80
+ role: z.string().describe('Participant role.'),
81
+ })
82
+ .describe('Participant record.'))
83
+ .optional()
84
+ .describe('Participants when include=participants is requested.'),
85
+ agenda: z
86
+ .array(z
87
+ .object({
88
+ description: z.string().describe('Agenda item description.'),
89
+ classification: z.array(z.string()).describe('Agenda item classifications.'),
90
+ subjects: z.array(z.string()).describe('Subject tags.'),
91
+ related_entities: z
92
+ .array(z
93
+ .object({
94
+ name: z.string().describe('Related entity name.'),
95
+ entity_type: z
96
+ .string()
97
+ .describe('Entity type (e.g., "bill", "person", "organization").'),
98
+ })
99
+ .describe('Related entity record.'))
100
+ .describe('Bills, people, or organizations referenced.'),
101
+ })
102
+ .describe('Agenda item record.'))
103
+ .optional()
104
+ .describe('Agenda items when include=agenda is requested.'),
105
+ }),
106
+ errors: [
107
+ {
108
+ reason: 'not_found',
109
+ code: JsonRpcErrorCode.NotFound,
110
+ when: 'Event ID does not exist in Open States.',
111
+ 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.',
112
+ },
113
+ ],
114
+ async handler(input, ctx) {
115
+ const svc = getOpenStatesApiService();
116
+ const event = await svc
117
+ .getEvent(input.event_id, input.include && input.include.length > 0 ? input.include : undefined, ctx)
118
+ .catch((err) => {
119
+ if (err instanceof McpError && err.code === JsonRpcErrorCode.NotFound) {
120
+ throw ctx.fail('not_found', `Event not found: ${input.event_id}`, {
121
+ ...ctx.recoveryFor('not_found'),
122
+ });
123
+ }
124
+ throw err;
125
+ });
126
+ ctx.log.info('Fetched event', { id: event.id, name: event.name });
127
+ return {
128
+ id: event.id,
129
+ name: event.name,
130
+ description: event.description,
131
+ classification: event.classification,
132
+ start_date: event.start_date,
133
+ end_date: event.end_date,
134
+ status: event.status,
135
+ jurisdiction: event.jurisdiction,
136
+ ...(event.location
137
+ ? {
138
+ location: {
139
+ name: event.location.name,
140
+ ...(event.location.url ? { url: event.location.url } : {}),
141
+ },
142
+ }
143
+ : {}),
144
+ ...(event.links ? { links: event.links } : {}),
145
+ ...(event.media ? { media: event.media } : {}),
146
+ ...(event.documents ? { documents: event.documents } : {}),
147
+ ...(event.participants
148
+ ? {
149
+ participants: event.participants.map((p) => ({
150
+ name: p.name,
151
+ entity_type: p.entity_type,
152
+ role: p.role,
153
+ })),
154
+ }
155
+ : {}),
156
+ ...(event.agenda
157
+ ? {
158
+ agenda: event.agenda.map((item) => ({
159
+ description: item.description,
160
+ classification: item.classification,
161
+ subjects: item.subjects,
162
+ related_entities: item.related_entities.map((e) => ({
163
+ name: e.name,
164
+ entity_type: e.entity_type,
165
+ })),
166
+ })),
167
+ }
168
+ : {}),
169
+ };
170
+ },
171
+ format: (result) => {
172
+ const lines = [
173
+ `# ${result.name}`,
174
+ `**ID:** ${result.id}`,
175
+ `**Classification:** ${result.classification} | **Status:** ${result.status}`,
176
+ result.end_date
177
+ ? `**Start:** ${result.start_date} | **End:** ${result.end_date}`
178
+ : `**Start:** ${result.start_date}`,
179
+ `**Jurisdiction:** ${result.jurisdiction.name} (${result.jurisdiction.id})`,
180
+ ];
181
+ if (result.description)
182
+ lines.push(result.description);
183
+ if (result.location) {
184
+ const locStr = result.location.url
185
+ ? `${result.location.name} — ${result.location.url}`
186
+ : result.location.name;
187
+ lines.push(`**Location:** ${locStr}`);
188
+ }
189
+ if (result.participants?.length) {
190
+ lines.push('');
191
+ lines.push('## Participants');
192
+ for (const p of result.participants) {
193
+ lines.push(`- ${p.name} (${p.role}) — ${p.entity_type}`);
194
+ }
195
+ }
196
+ if (result.agenda?.length) {
197
+ lines.push('');
198
+ lines.push('## Agenda');
199
+ for (const item of result.agenda) {
200
+ lines.push(`- ${item.description}`);
201
+ if (item.classification.length > 0)
202
+ lines.push(` Classification: ${item.classification.join(', ')}`);
203
+ if (item.subjects.length > 0)
204
+ lines.push(` Subjects: ${item.subjects.join(', ')}`);
205
+ if (item.related_entities.length > 0) {
206
+ lines.push(` Related: ${item.related_entities.map((e) => `${e.name} (${e.entity_type})`).join(', ')}`);
207
+ }
208
+ }
209
+ }
210
+ if (result.links?.length) {
211
+ lines.push('');
212
+ lines.push('## Links');
213
+ for (const l of result.links)
214
+ lines.push(`- ${l.note}: ${l.url}`);
215
+ }
216
+ if (result.media?.length) {
217
+ lines.push('');
218
+ lines.push('## Media');
219
+ for (const m of result.media)
220
+ lines.push(`- ${m.note}: ${m.url}`);
221
+ }
222
+ if (result.documents?.length) {
223
+ lines.push('');
224
+ lines.push('## Documents');
225
+ for (const d of result.documents)
226
+ lines.push(`- ${d.note}: ${d.url}`);
227
+ }
228
+ return [{ type: 'text', text: lines.join('\n') }];
229
+ },
230
+ });
231
+ //# sourceMappingURL=get-event.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-event.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-event.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,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9B,OAAO;IACP,SAAS;IACT,OAAO;IACP,WAAW;IACX,cAAc;IACd,QAAQ;CACT,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,EAAE;IACnD,KAAK,EAAE,WAAW;IAClB,WAAW,EACT,sPAAsP;IACxP,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uDAAuD,CA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AC,KAAK,EAAE,MAAM,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,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;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACxE,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,34 @@
1
+ /**
2
+ * @fileoverview Fetch full metadata for a specific Open States jurisdiction.
3
+ * @module mcp-server/tools/definitions/get-jurisdiction
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const getJurisdiction: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ jurisdiction_id: z.ZodString;
9
+ include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
10
+ legislative_sessions: "legislative_sessions";
11
+ organizations: "organizations";
12
+ latest_runs: "latest_runs";
13
+ }>>>;
14
+ }, z.core.$strip>, z.ZodObject<{
15
+ id: z.ZodString;
16
+ name: z.ZodString;
17
+ classification: z.ZodString;
18
+ url: z.ZodString;
19
+ latest_bill_update: z.ZodString;
20
+ latest_people_update: z.ZodString;
21
+ legislative_sessions: z.ZodOptional<z.ZodArray<z.ZodObject<{
22
+ identifier: z.ZodString;
23
+ name: z.ZodString;
24
+ classification: z.ZodString;
25
+ start_date: z.ZodString;
26
+ end_date: z.ZodString;
27
+ }, z.core.$strip>>>;
28
+ }, z.core.$strip>, readonly [{
29
+ readonly reason: "not_found";
30
+ readonly code: JsonRpcErrorCode.NotFound;
31
+ readonly when: "Jurisdiction ID does not exist in Open States.";
32
+ readonly recovery: "Use openstates_list_jurisdictions to discover valid jurisdiction IDs. States use the pattern: ocd-jurisdiction/country:us/state:{2-letter-abbr}/government.";
33
+ }]>;
34
+ //# sourceMappingURL=get-jurisdiction.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-jurisdiction.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-jurisdiction.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,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;GAyG1B,CAAC"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @fileoverview Fetch full metadata for a specific Open States jurisdiction.
3
+ * @module mcp-server/tools/definitions/get-jurisdiction
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 JurisdictionIncludeEnum = z.enum(['organizations', 'legislative_sessions', 'latest_runs']);
9
+ export const getJurisdiction = tool('openstates_get_jurisdiction', {
10
+ title: 'Get Jurisdiction',
11
+ description: 'Fetch full metadata for a specific jurisdiction including all legislative sessions, their identifiers, and coverage dates. Use when you need to know the exact session identifier for a state before filtering bill searches — session formats vary widely (e.g., "2025", "2025rs", "2025s1"). Jurisdiction IDs follow OCD format: ocd-jurisdiction/country:us/state:{abbr}/government (e.g., ocd-jurisdiction/country:us/state:wa/government). State names (e.g., "Washington") and two-letter abbreviations (e.g., "wa") are also accepted.',
12
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
13
+ input: z.object({
14
+ jurisdiction_id: z
15
+ .string()
16
+ .min(1)
17
+ .describe('OCD jurisdiction ID, state name (e.g., "Washington"), or two-letter abbreviation (e.g., "wa").'),
18
+ include: z
19
+ .array(JurisdictionIncludeEnum)
20
+ .optional()
21
+ .describe('Related data to inline. "legislative_sessions" returns all historical and current sessions with identifiers and date ranges. "latest_runs" shows last scraper run metadata.'),
22
+ }),
23
+ output: z.object({
24
+ id: z.string().describe('OCD jurisdiction ID.'),
25
+ name: z.string().describe('Jurisdiction name.'),
26
+ classification: z.string().describe('Jurisdiction type.'),
27
+ url: z.string().describe('Official legislature URL.'),
28
+ latest_bill_update: z.string().describe('ISO 8601 timestamp of most recent bill data update.'),
29
+ latest_people_update: z
30
+ .string()
31
+ .describe('ISO 8601 timestamp of most recent people data update.'),
32
+ legislative_sessions: z
33
+ .array(z
34
+ .object({
35
+ identifier: z
36
+ .string()
37
+ .describe('Session identifier — use as session= in bill searches.'),
38
+ name: z.string().describe('Human-readable session name.'),
39
+ classification: z
40
+ .string()
41
+ .describe('Session classification: "primary", "special", etc.'),
42
+ start_date: z.string().describe('Session start date.'),
43
+ end_date: z.string().describe('Session end date.'),
44
+ })
45
+ .describe('Legislative session record.'))
46
+ .optional()
47
+ .describe('All legislative sessions when include=legislative_sessions is requested.'),
48
+ }),
49
+ errors: [
50
+ {
51
+ reason: 'not_found',
52
+ code: JsonRpcErrorCode.NotFound,
53
+ when: 'Jurisdiction ID does not exist in Open States.',
54
+ recovery: 'Use openstates_list_jurisdictions to discover valid jurisdiction IDs. States use the pattern: ocd-jurisdiction/country:us/state:{2-letter-abbr}/government.',
55
+ },
56
+ ],
57
+ async handler(input, ctx) {
58
+ const svc = getOpenStatesApiService();
59
+ const result = await svc
60
+ .getJurisdiction(input.jurisdiction_id, input.include && input.include.length > 0 ? input.include : undefined, ctx)
61
+ .catch((err) => {
62
+ if (err instanceof McpError && err.code === JsonRpcErrorCode.NotFound) {
63
+ throw ctx.fail('not_found', `Jurisdiction not found: ${input.jurisdiction_id}`, {
64
+ ...ctx.recoveryFor('not_found'),
65
+ });
66
+ }
67
+ throw err;
68
+ });
69
+ ctx.log.info('Fetched jurisdiction', { id: result.id, name: result.name });
70
+ return {
71
+ id: result.id,
72
+ name: result.name,
73
+ classification: result.classification,
74
+ url: result.url,
75
+ latest_bill_update: result.latest_bill_update,
76
+ latest_people_update: result.latest_people_update,
77
+ ...(result.legislative_sessions ? { legislative_sessions: result.legislative_sessions } : {}),
78
+ };
79
+ },
80
+ format: (result) => {
81
+ const lines = [
82
+ `# ${result.name}`,
83
+ `**ID:** ${result.id}`,
84
+ `**Classification:** ${result.classification}`,
85
+ `**URL:** ${result.url}`,
86
+ `**Latest bill update:** ${result.latest_bill_update}`,
87
+ `**Latest people update:** ${result.latest_people_update}`,
88
+ ];
89
+ if (result.legislative_sessions?.length) {
90
+ lines.push('');
91
+ lines.push('## Legislative Sessions');
92
+ for (const s of result.legislative_sessions) {
93
+ lines.push(`- \`${s.identifier}\` — ${s.name} (${s.classification}) ${s.start_date}–${s.end_date}`);
94
+ }
95
+ }
96
+ return [{ type: 'text', text: lines.join('\n') }];
97
+ },
98
+ });
99
+ //# sourceMappingURL=get-jurisdiction.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-jurisdiction.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-jurisdiction.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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AAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,QAAQ,EAAE,CACxF,CAAC;YACJ,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,53 @@
1
+ /**
2
+ * @fileoverview Find legislators representing a geographic coordinate.
3
+ * @module mcp-server/tools/definitions/get-legislators-by-location
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const getLegislatorsByLocation: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ latitude: z.ZodNumber;
9
+ longitude: z.ZodNumber;
10
+ include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
11
+ other_identifiers: "other_identifiers";
12
+ sources: "sources";
13
+ links: "links";
14
+ other_names: "other_names";
15
+ offices: "offices";
16
+ }>>>;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ legislators: z.ZodArray<z.ZodObject<{
19
+ id: z.ZodString;
20
+ name: z.ZodString;
21
+ party: z.ZodString;
22
+ current_role: z.ZodNullable<z.ZodObject<{
23
+ title: z.ZodString;
24
+ org_classification: z.ZodString;
25
+ district: z.ZodNullable<z.ZodString>;
26
+ }, z.core.$strip>>;
27
+ jurisdiction: z.ZodObject<{
28
+ id: z.ZodString;
29
+ name: z.ZodString;
30
+ }, z.core.$strip>;
31
+ email: z.ZodString;
32
+ openstates_url: z.ZodString;
33
+ offices: z.ZodOptional<z.ZodArray<z.ZodObject<{
34
+ name: z.ZodString;
35
+ classification: z.ZodString;
36
+ voice: z.ZodOptional<z.ZodString>;
37
+ fax: z.ZodOptional<z.ZodString>;
38
+ address: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>>>;
40
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
41
+ url: z.ZodString;
42
+ note: z.ZodString;
43
+ }, z.core.$strip>>>;
44
+ }, z.core.$strip>>;
45
+ count: z.ZodNumber;
46
+ coverage_note: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>, readonly [{
48
+ readonly reason: "invalid_coordinate";
49
+ readonly code: JsonRpcErrorCode.InvalidParams;
50
+ readonly when: "Latitude or longitude is outside valid range.";
51
+ readonly recovery: "Latitude must be between -90 and 90, longitude between -180 and 180. For continental US: lat 24-50, lng -125 to -66. For Alaska: lat 51-72, lng -180 to -130.";
52
+ }]>;
53
+ //# sourceMappingURL=get-legislators-by-location.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-legislators-by-location.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-legislators-by-location.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAWjE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoKnC,CAAC"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * @fileoverview Find legislators representing a geographic coordinate.
3
+ * @module mcp-server/tools/definitions/get-legislators-by-location
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getOpenStatesApiService } from '../../../services/openstates/openstates-service.js';
8
+ const PersonIncludeEnum = z.enum([
9
+ 'other_names',
10
+ 'other_identifiers',
11
+ 'links',
12
+ 'sources',
13
+ 'offices',
14
+ ]);
15
+ export const getLegislatorsByLocation = tool('openstates_get_legislators_by_location', {
16
+ title: 'Get Legislators by Location',
17
+ description: 'Find all state legislators representing a geographic coordinate. Pass latitude and longitude to get state senators and representatives (and potentially governor/executive officials) for that location. Useful for constituent-to-representative matching, address-based policy research, and electoral boundary analysis. This server does not geocode addresses — the caller must provide decimal-degree coordinates. Use include=offices to get contact information alongside the legislator list.',
18
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
19
+ input: z.object({
20
+ latitude: z.number().describe('Latitude in decimal degrees (e.g., 47.6062 for Seattle, WA).'),
21
+ longitude: z
22
+ .number()
23
+ .describe('Longitude in decimal degrees (e.g., -122.3321 for Seattle, WA).'),
24
+ include: z
25
+ .array(PersonIncludeEnum)
26
+ .optional()
27
+ .describe('Related data to inline. "offices" includes phone, fax, and address.'),
28
+ }),
29
+ output: z.object({
30
+ legislators: z
31
+ .array(z
32
+ .object({
33
+ id: z.string().describe('OCD person ID.'),
34
+ name: z.string().describe('Full name.'),
35
+ party: z.string().describe('Primary party label. Empty string when unknown.'),
36
+ current_role: z
37
+ .object({
38
+ title: z.string().describe('Role title.'),
39
+ org_classification: z.string().describe('Chamber classification.'),
40
+ district: z.string().nullable().describe('District label or null.'),
41
+ })
42
+ .nullable()
43
+ .describe('Current role or null.'),
44
+ jurisdiction: z
45
+ .object({
46
+ id: z.string().describe('OCD jurisdiction ID.'),
47
+ name: z.string().describe('Jurisdiction name.'),
48
+ })
49
+ .describe('Home jurisdiction.'),
50
+ email: z.string().describe('Email address. Empty string when not available.'),
51
+ openstates_url: z.string().describe('Open States profile URL.'),
52
+ offices: z
53
+ .array(z
54
+ .object({
55
+ name: z.string().describe('Office name.'),
56
+ classification: z.string().describe('Office type.'),
57
+ voice: z.string().optional().describe('Phone number when available.'),
58
+ fax: z.string().optional().describe('Fax number when available.'),
59
+ address: z.string().optional().describe('Mailing address when available.'),
60
+ })
61
+ .describe('Contact office record.'))
62
+ .optional()
63
+ .describe('Contact offices when include=offices is requested.'),
64
+ links: z
65
+ .array(z
66
+ .object({
67
+ url: z.string().describe('Link URL.'),
68
+ note: z.string().describe('Link description.'),
69
+ })
70
+ .describe('External link record.'))
71
+ .optional()
72
+ .describe('Website and social links when include=links is requested.'),
73
+ })
74
+ .describe('Legislator record.'))
75
+ .describe('Legislators representing the given coordinate.'),
76
+ count: z.number().describe('Number of legislators returned.'),
77
+ coverage_note: z
78
+ .string()
79
+ .optional()
80
+ .describe('Present when no legislators were found — explains why (e.g., location outside US boundaries or unsupported territory).'),
81
+ }),
82
+ errors: [
83
+ {
84
+ reason: 'invalid_coordinate',
85
+ code: JsonRpcErrorCode.InvalidParams,
86
+ when: 'Latitude or longitude is outside valid range.',
87
+ recovery: 'Latitude must be between -90 and 90, longitude between -180 and 180. For continental US: lat 24-50, lng -125 to -66. For Alaska: lat 51-72, lng -180 to -130.',
88
+ },
89
+ ],
90
+ async handler(input, ctx) {
91
+ if (input.latitude < -90 ||
92
+ input.latitude > 90 ||
93
+ input.longitude < -180 ||
94
+ input.longitude > 180) {
95
+ throw ctx.fail('invalid_coordinate', `Invalid coordinates: latitude=${input.latitude}, longitude=${input.longitude}`, {
96
+ ...ctx.recoveryFor('invalid_coordinate'),
97
+ });
98
+ }
99
+ const svc = getOpenStatesApiService();
100
+ const result = await svc.getPeopleByGeo(input.latitude, input.longitude, input.include && input.include.length > 0 ? input.include : undefined, ctx);
101
+ ctx.log.info('Fetched legislators by geo', {
102
+ latitude: input.latitude,
103
+ longitude: input.longitude,
104
+ count: result.results.length,
105
+ });
106
+ if (result.results.length === 0) {
107
+ return {
108
+ legislators: [],
109
+ count: 0,
110
+ coverage_note: `No legislators found for coordinates (${input.latitude}, ${input.longitude}). Verify the location is within a US state, DC, or Puerto Rico.`,
111
+ };
112
+ }
113
+ return { legislators: result.results, count: result.results.length };
114
+ },
115
+ format: (result) => {
116
+ const lines = [`**${result.count} legislators found**`];
117
+ if (result.coverage_note) {
118
+ lines.push('');
119
+ lines.push(`> ${result.coverage_note}`);
120
+ }
121
+ for (const person of result.legislators) {
122
+ lines.push('');
123
+ lines.push(`## ${person.name}`);
124
+ lines.push(`**ID:** ${person.id}`);
125
+ lines.push(`**Party:** ${person.party || 'Not available'}`);
126
+ lines.push(`**Jurisdiction:** ${person.jurisdiction.name} (${person.jurisdiction.id})`);
127
+ if (person.current_role) {
128
+ const district = person.current_role.district
129
+ ? ` — District ${person.current_role.district}`
130
+ : '';
131
+ lines.push(`**Role:** ${person.current_role.title} (${person.current_role.org_classification})${district}`);
132
+ }
133
+ if (person.email)
134
+ lines.push(`**Email:** ${person.email}`);
135
+ if (person.openstates_url)
136
+ lines.push(`**URL:** ${person.openstates_url}`);
137
+ if (person.offices?.length) {
138
+ for (const office of person.offices) {
139
+ const parts = [`${office.name} [${office.classification}]`];
140
+ if (office.voice)
141
+ parts.push(`Phone: ${office.voice}`);
142
+ if (office.fax)
143
+ parts.push(`Fax: ${office.fax}`);
144
+ if (office.address)
145
+ parts.push(`Address: ${office.address}`);
146
+ lines.push(`**Office:** ${parts.join(' | ')}`);
147
+ }
148
+ }
149
+ if (person.links?.length) {
150
+ lines.push(`**Links:** ${person.links.map((l) => `${l.note}: ${l.url}`).join(', ')}`);
151
+ }
152
+ }
153
+ return [{ type: 'text', text: lines.join('\n') }];
154
+ },
155
+ });
156
+ //# sourceMappingURL=get-legislators-by-location.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-legislators-by-location.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-legislators-by-location.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEtF,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/B,aAAa;IACb,mBAAmB;IACnB,OAAO;IACP,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,wCAAwC,EAAE;IACrF,KAAK,EAAE,6BAA6B;IACpC,W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