@cyanheads/congressgov-mcp-server 0.3.22 → 0.3.24
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 +2 -2
- package/CLAUDE.md +2 -2
- package/README.md +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js +20 -14
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.js +13 -10
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.js +21 -13
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js +15 -8
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.js +10 -2
- package/dist/mcp-server/tools/definitions/crs-reports.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.js +18 -10
- package/dist/mcp-server/tools/definitions/daily-record.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.js +10 -8
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.js +20 -14
- package/dist/mcp-server/tools/definitions/member-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/roll-votes.tool.d.ts +29 -2
- package/dist/mcp-server/tools/definitions/roll-votes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/roll-votes.tool.js +28 -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 +29 -2
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.js +22 -15
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.js.map +1 -1
- package/dist/mcp-server/tools/format-helpers.d.ts +0 -1
- package/dist/mcp-server/tools/format-helpers.d.ts.map +1 -1
- package/dist/mcp-server/tools/format-helpers.js +16 -27
- package/dist/mcp-server/tools/format-helpers.js.map +1 -1
- package/dist/mcp-server/tools/tool-helpers.d.ts +58 -6
- package/dist/mcp-server/tools/tool-helpers.d.ts.map +1 -1
- package/dist/mcp-server/tools/tool-helpers.js +90 -15
- package/dist/mcp-server/tools/tool-helpers.js.map +1 -1
- package/dist/services/congress-api/congress-api-service.d.ts.map +1 -1
- package/dist/services/congress-api/congress-api-service.js +81 -11
- package/dist/services/congress-api/congress-api-service.js.map +1 -1
- package/package.json +4 -3
- package/server.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crs-reports.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/crs-reports.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"crs-reports.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/crs-reports.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAWjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CzB,CAAC"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { formatCrsReports } from '../../../mcp-server/tools/format-helpers.js';
|
|
8
|
-
import {
|
|
8
|
+
import { congressErrorContracts, listEnrichment, listOrDetail, } from '../../../mcp-server/tools/tool-helpers.js';
|
|
9
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
10
10
|
export const crsReportsTool = tool('congressgov_crs_reports', {
|
|
11
11
|
description: `Browse and retrieve CRS (Congressional Research Service) reports — nonpartisan policy analyses by subject-matter experts at the Library of Congress, covering policy areas, legislative proposals, and legal questions. Report IDs use letter-number codes (e.g., R40097, RL33612, IF12345). Use 'list' to browse available reports or 'get' for full detail (authors, topics, summary, download formats).`,
|
|
12
12
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
13
|
+
errors: congressErrorContracts,
|
|
13
14
|
input: z.object({
|
|
14
15
|
operation: z.enum(['list', 'get']).describe('Which data to retrieve.'),
|
|
15
16
|
reportNumber: z
|
|
@@ -20,19 +21,26 @@ export const crsReportsTool = tool('congressgov_crs_reports', {
|
|
|
20
21
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
21
22
|
}),
|
|
22
23
|
output: listOrDetail('report', 'CRS report record for `get` (authors, topics, summary, formats, related materials); absent for `list`.'),
|
|
24
|
+
enrichment: listEnrichment,
|
|
23
25
|
format: formatCrsReports,
|
|
24
26
|
async handler(input, ctx) {
|
|
25
27
|
const api = getCongressApi();
|
|
26
28
|
if (input.operation === 'list') {
|
|
27
29
|
const result = await api.listCrsReports({ limit: input.limit, offset: input.offset }, ctx);
|
|
28
30
|
ctx.log.info('CRS reports listed', { count: result.data.length });
|
|
29
|
-
|
|
31
|
+
ctx.enrich.echo('CRS reports');
|
|
32
|
+
ctx.enrich.total(result.pagination.count);
|
|
33
|
+
if (result.data.length === 0)
|
|
34
|
+
ctx.enrich.notice('No CRS reports found. The endpoint may be temporarily unavailable.');
|
|
35
|
+
return result;
|
|
30
36
|
}
|
|
31
37
|
if (!input.reportNumber) {
|
|
32
38
|
throw validationError("The 'get' operation requires reportNumber. Report IDs use letter-number codes (e.g., R40097). Use 'list' to browse available reports.", { field: 'reportNumber' });
|
|
33
39
|
}
|
|
34
40
|
const result = await api.getCrsReport({ reportNumber: input.reportNumber }, ctx);
|
|
35
41
|
ctx.log.info('CRS report retrieved', { reportNumber: input.reportNumber });
|
|
42
|
+
ctx.enrich.echo(`CRS report ${input.reportNumber}`);
|
|
43
|
+
ctx.enrich.total(1);
|
|
36
44
|
return result;
|
|
37
45
|
},
|
|
38
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crs-reports.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/crs-reports.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,
|
|
1
|
+
{"version":3,"file":"crs-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AC,YAAY,EAAE,CAAC,CAAC;QACpD,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -19,6 +19,33 @@ export declare const dailyRecordTool: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
19
19
|
count: z.ZodNumber;
|
|
20
20
|
nextOffset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
21
21
|
}, z.core.$strip>;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
}, z.core.$loose>, readonly [{
|
|
23
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
24
|
+
readonly reason: "not_found";
|
|
25
|
+
readonly retryable: false;
|
|
26
|
+
readonly when: "A requested bill, member, committee, report, vote, or nomination does not exist in Congress.gov.";
|
|
27
|
+
readonly recovery: "Use the tool's list or browse operation to discover valid identifiers, then retry with one that exists.";
|
|
28
|
+
}, {
|
|
29
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.RateLimited;
|
|
30
|
+
readonly reason: "rate_limited";
|
|
31
|
+
readonly retryable: true;
|
|
32
|
+
readonly when: "The Congress.gov API rate limit (5,000 requests/hour per key) was exceeded.";
|
|
33
|
+
readonly recovery: "Wait for the hourly rate-limit window to reset before retrying, or reduce the request frequency.";
|
|
34
|
+
}, {
|
|
35
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
|
|
36
|
+
readonly reason: "invalid_request";
|
|
37
|
+
readonly retryable: false;
|
|
38
|
+
readonly when: "Congress.gov rejected the request as malformed — a bad date range or an identifier with an unexpected shape.";
|
|
39
|
+
readonly recovery: "Check parameter formats: dates must be ISO 8601 like 2026-05-01T00:00:00Z and identifiers must match their documented shape.";
|
|
40
|
+
}, {
|
|
41
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
|
|
42
|
+
readonly reason: "upstream_error";
|
|
43
|
+
readonly retryable: true;
|
|
44
|
+
readonly when: "Congress.gov returned an unexpected error (5xx or another non-2xx status).";
|
|
45
|
+
readonly recovery: "Retry after a short delay; if the failure persists the Congress.gov service may be temporarily degraded.";
|
|
46
|
+
}], {
|
|
47
|
+
effectiveQuery: z.ZodString;
|
|
48
|
+
totalCount: z.ZodNumber;
|
|
49
|
+
notice: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}>;
|
|
24
51
|
//# sourceMappingURL=daily-record.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daily-record.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/daily-record.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"daily-record.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/daily-record.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAWjD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyF1B,CAAC"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { formatDailyRecord } from '../../../mcp-server/tools/format-helpers.js';
|
|
8
|
-
import {
|
|
8
|
+
import { congressErrorContracts, listEnrichment, listOutput, } from '../../../mcp-server/tools/tool-helpers.js';
|
|
9
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
10
10
|
export const dailyRecordTool = tool('congressgov_daily_record', {
|
|
11
11
|
description: `Browse the daily Congressional Record — floor speeches, debates, and legislative text published each day Congress is in session. Navigation is hierarchical: volumes (via 'list') → issues (via 'issues') → articles (via 'articles'). Use 'list' to find recent volumes, 'issues' to see what's in a volume, and 'articles' to access individual speeches and debate sections.`,
|
|
12
12
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
13
|
+
errors: congressErrorContracts,
|
|
13
14
|
input: z.object({
|
|
14
15
|
operation: z.enum(['list', 'issues', 'articles']).describe('Which data to retrieve.'),
|
|
15
16
|
volumeNumber: z
|
|
@@ -28,13 +29,18 @@ export const dailyRecordTool = tool('congressgov_daily_record', {
|
|
|
28
29
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
29
30
|
}),
|
|
30
31
|
output: listOutput,
|
|
32
|
+
enrichment: listEnrichment,
|
|
31
33
|
format: formatDailyRecord,
|
|
32
34
|
async handler(input, ctx) {
|
|
33
35
|
const api = getCongressApi();
|
|
34
36
|
if (input.operation === 'list') {
|
|
35
37
|
const result = await api.listDailyRecord({ limit: input.limit, offset: input.offset }, ctx);
|
|
36
38
|
ctx.log.info('Daily record listed');
|
|
37
|
-
|
|
39
|
+
ctx.enrich.echo('Congressional Record volumes');
|
|
40
|
+
ctx.enrich.total(result.pagination.count);
|
|
41
|
+
if (result.data.length === 0)
|
|
42
|
+
ctx.enrich.notice('No Congressional Record volumes found.');
|
|
43
|
+
return result;
|
|
38
44
|
}
|
|
39
45
|
if (!input.volumeNumber) {
|
|
40
46
|
throw validationError(`The '${input.operation}' operation requires volumeNumber. Use 'list' to browse available Congressional Record volumes.`, { field: 'volumeNumber', operation: input.operation });
|
|
@@ -46,10 +52,11 @@ export const dailyRecordTool = tool('congressgov_daily_record', {
|
|
|
46
52
|
offset: input.offset,
|
|
47
53
|
}, ctx);
|
|
48
54
|
ctx.log.info('Daily record issues retrieved', { volumeNumber: input.volumeNumber });
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
ctx.enrich.echo(`issues for volume ${input.volumeNumber}`);
|
|
56
|
+
ctx.enrich.total(result.pagination.count);
|
|
57
|
+
if (result.data.length === 0)
|
|
58
|
+
ctx.enrich.notice(`No issues found for volume ${input.volumeNumber}.`);
|
|
59
|
+
return result;
|
|
53
60
|
}
|
|
54
61
|
if (!input.issueNumber) {
|
|
55
62
|
throw validationError("The 'articles' operation requires both volumeNumber and issueNumber. Use 'issues' to see available issues within a volume.", { field: 'issueNumber' });
|
|
@@ -64,10 +71,11 @@ export const dailyRecordTool = tool('congressgov_daily_record', {
|
|
|
64
71
|
volumeNumber: input.volumeNumber,
|
|
65
72
|
issueNumber: input.issueNumber,
|
|
66
73
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
ctx.enrich.echo(`articles for volume ${input.volumeNumber}, issue ${input.issueNumber}`);
|
|
75
|
+
ctx.enrich.total(result.pagination.count);
|
|
76
|
+
if (result.data.length === 0)
|
|
77
|
+
ctx.enrich.notice(`No articles found for volume ${input.volumeNumber}, issue ${input.issueNumber}.`);
|
|
78
|
+
return result;
|
|
71
79
|
},
|
|
72
80
|
});
|
|
73
81
|
//# sourceMappingURL=daily-record.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daily-record.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/daily-record.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"daily-record.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/daily-record.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE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AC,WAAW,GAAG,CAClF,CAAC;QACJ,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -22,6 +22,33 @@ export declare const enactedLawsTool: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
22
22
|
count: z.ZodNumber;
|
|
23
23
|
nextOffset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
24
|
}, z.core.$strip>>;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
}, z.core.$loose>, readonly [{
|
|
26
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
27
|
+
readonly reason: "not_found";
|
|
28
|
+
readonly retryable: false;
|
|
29
|
+
readonly when: "A requested bill, member, committee, report, vote, or nomination does not exist in Congress.gov.";
|
|
30
|
+
readonly recovery: "Use the tool's list or browse operation to discover valid identifiers, then retry with one that exists.";
|
|
31
|
+
}, {
|
|
32
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.RateLimited;
|
|
33
|
+
readonly reason: "rate_limited";
|
|
34
|
+
readonly retryable: true;
|
|
35
|
+
readonly when: "The Congress.gov API rate limit (5,000 requests/hour per key) was exceeded.";
|
|
36
|
+
readonly recovery: "Wait for the hourly rate-limit window to reset before retrying, or reduce the request frequency.";
|
|
37
|
+
}, {
|
|
38
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
|
|
39
|
+
readonly reason: "invalid_request";
|
|
40
|
+
readonly retryable: false;
|
|
41
|
+
readonly when: "Congress.gov rejected the request as malformed — a bad date range or an identifier with an unexpected shape.";
|
|
42
|
+
readonly recovery: "Check parameter formats: dates must be ISO 8601 like 2026-05-01T00:00:00Z and identifiers must match their documented shape.";
|
|
43
|
+
}, {
|
|
44
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
|
|
45
|
+
readonly reason: "upstream_error";
|
|
46
|
+
readonly retryable: true;
|
|
47
|
+
readonly when: "Congress.gov returned an unexpected error (5xx or another non-2xx status).";
|
|
48
|
+
readonly recovery: "Retry after a short delay; if the failure persists the Congress.gov service may be temporarily degraded.";
|
|
49
|
+
}], {
|
|
50
|
+
effectiveQuery: z.ZodString;
|
|
51
|
+
totalCount: z.ZodNumber;
|
|
52
|
+
notice: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}>;
|
|
27
54
|
//# sourceMappingURL=enacted-laws.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enacted-laws.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/enacted-laws.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"enacted-laws.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/enacted-laws.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAYjD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2E1B,CAAC"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { formatLaws } from '../../../mcp-server/tools/format-helpers.js';
|
|
8
|
-
import {
|
|
8
|
+
import { buildEffectiveQuery, congressErrorContracts, listEnrichment, listOrDetail, } from '../../../mcp-server/tools/tool-helpers.js';
|
|
9
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
10
10
|
export const enactedLawsTool = tool('congressgov_enacted_laws', {
|
|
11
11
|
description: `Browse enacted public and private laws from Congress.gov by congress and law type ('pub' for public laws, 'priv' for private). 'list' filters by enactment status and law type — the discovery path 'bill_lookup' does not offer. 'get' returns the origin bill record (sponsor, actions, summaries, text), with the public/private law citation on the bill's 'laws' array (e.g. {"number":"118-2","type":"Public Law"}).`,
|
|
12
12
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
13
|
+
errors: congressErrorContracts,
|
|
13
14
|
input: z.object({
|
|
14
15
|
operation: z.enum(['list', 'get']).describe('Which data to retrieve.'),
|
|
15
16
|
congress: z.number().int().positive().describe('Congress number.'),
|
|
@@ -22,6 +23,7 @@ export const enactedLawsTool = tool('congressgov_enacted_laws', {
|
|
|
22
23
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
23
24
|
}),
|
|
24
25
|
output: listOrDetail('law', "Origin bill record for `get`; absent for `list`. The bill's `laws` array carries the law citation."),
|
|
26
|
+
enrichment: listEnrichment,
|
|
25
27
|
format: formatLaws,
|
|
26
28
|
async handler(input, ctx) {
|
|
27
29
|
const api = getCongressApi();
|
|
@@ -33,13 +35,11 @@ export const enactedLawsTool = tool('congressgov_enacted_laws', {
|
|
|
33
35
|
offset: input.offset,
|
|
34
36
|
}, ctx);
|
|
35
37
|
ctx.log.info('Laws listed', { congress: input.congress, count: result.data.length });
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
};
|
|
38
|
+
ctx.enrich.echo(buildEffectiveQuery('enacted laws', { congress: input.congress, lawType: input.lawType }));
|
|
39
|
+
ctx.enrich.total(result.pagination.count);
|
|
40
|
+
if (result.data.length === 0)
|
|
41
|
+
ctx.enrich.notice('No laws matched the filters. Verify the congress number or try a different lawType.');
|
|
42
|
+
return result;
|
|
43
43
|
}
|
|
44
44
|
if (!input.lawType || !input.lawNumber) {
|
|
45
45
|
throw validationError("The 'get' operation requires lawType ('pub' or 'priv') and lawNumber. Use 'list' to browse laws by congress.", { lawType: input.lawType, lawNumber: input.lawNumber });
|
|
@@ -54,6 +54,8 @@ export const enactedLawsTool = tool('congressgov_enacted_laws', {
|
|
|
54
54
|
lawType: input.lawType,
|
|
55
55
|
lawNumber: input.lawNumber,
|
|
56
56
|
});
|
|
57
|
+
ctx.enrich.echo(`${input.lawType === 'pub' ? 'Public' : 'Private'} Law ${input.congress}-${input.lawNumber}`);
|
|
58
|
+
ctx.enrich.total(1);
|
|
57
59
|
return result;
|
|
58
60
|
},
|
|
59
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enacted-laws.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/enacted-laws.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"enacted-laws.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/enacted-laws.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,YAAY,GACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,0BAA0B,EAAE;IAC9D,WAAW,EAAE,4ZAA4Z;IACza,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,MAAM,EAAE,sBAAsB;IAC9B,KAAK,EAAE,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EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,GAAG,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,QAAQ,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAC7F,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -23,6 +23,33 @@ export declare const memberLookupTool: import("@cyanheads/mcp-ts-core").ToolDefi
|
|
|
23
23
|
count: z.ZodNumber;
|
|
24
24
|
nextOffset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
25
|
}, z.core.$strip>>;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
}, z.core.$loose>, readonly [{
|
|
27
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
28
|
+
readonly reason: "not_found";
|
|
29
|
+
readonly retryable: false;
|
|
30
|
+
readonly when: "A requested bill, member, committee, report, vote, or nomination does not exist in Congress.gov.";
|
|
31
|
+
readonly recovery: "Use the tool's list or browse operation to discover valid identifiers, then retry with one that exists.";
|
|
32
|
+
}, {
|
|
33
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.RateLimited;
|
|
34
|
+
readonly reason: "rate_limited";
|
|
35
|
+
readonly retryable: true;
|
|
36
|
+
readonly when: "The Congress.gov API rate limit (5,000 requests/hour per key) was exceeded.";
|
|
37
|
+
readonly recovery: "Wait for the hourly rate-limit window to reset before retrying, or reduce the request frequency.";
|
|
38
|
+
}, {
|
|
39
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
|
|
40
|
+
readonly reason: "invalid_request";
|
|
41
|
+
readonly retryable: false;
|
|
42
|
+
readonly when: "Congress.gov rejected the request as malformed — a bad date range or an identifier with an unexpected shape.";
|
|
43
|
+
readonly recovery: "Check parameter formats: dates must be ISO 8601 like 2026-05-01T00:00:00Z and identifiers must match their documented shape.";
|
|
44
|
+
}, {
|
|
45
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
|
|
46
|
+
readonly reason: "upstream_error";
|
|
47
|
+
readonly retryable: true;
|
|
48
|
+
readonly when: "Congress.gov returned an unexpected error (5xx or another non-2xx status).";
|
|
49
|
+
readonly recovery: "Retry after a short delay; if the failure persists the Congress.gov service may be temporarily degraded.";
|
|
50
|
+
}], {
|
|
51
|
+
effectiveQuery: z.ZodString;
|
|
52
|
+
totalCount: z.ZodNumber;
|
|
53
|
+
notice: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}>;
|
|
28
55
|
//# sourceMappingURL=member-lookup.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-lookup.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/member-lookup.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"member-lookup.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/member-lookup.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAYjD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoH3B,CAAC"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { formatMembers } from '../../../mcp-server/tools/format-helpers.js';
|
|
8
|
-
import {
|
|
8
|
+
import { buildEffectiveQuery, congressErrorContracts, listEnrichment, listOrDetail, } from '../../../mcp-server/tools/tool-helpers.js';
|
|
9
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
10
10
|
export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
11
11
|
description: `Discover congressional members and their legislative activity. No name search. For 'list', filter by stateCode (optionally with district), by congress, or by both together (e.g., 118th Congress + CA, or CA district 12 in the 118th). Add currentMember=true to restrict to currently serving members. Once you have a bioguideId, use 'get' for full profile or 'sponsored'/'cosponsored' for their legislative portfolio.`,
|
|
12
12
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
13
|
+
errors: congressErrorContracts,
|
|
13
14
|
input: z.object({
|
|
14
15
|
operation: z
|
|
15
16
|
.enum(['list', 'get', 'sponsored', 'cosponsored'])
|
|
@@ -38,6 +39,7 @@ export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
|
38
39
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
39
40
|
}),
|
|
40
41
|
output: listOrDetail('member', 'Member profile for `get` (name, state, terms, party history, leadership, legislation counts); absent for `list`, `sponsored`, `cosponsored`.'),
|
|
42
|
+
enrichment: listEnrichment,
|
|
41
43
|
format: formatMembers,
|
|
42
44
|
async handler(input, ctx) {
|
|
43
45
|
const api = getCongressApi();
|
|
@@ -54,15 +56,16 @@ export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
|
54
56
|
offset: input.offset,
|
|
55
57
|
}, ctx);
|
|
56
58
|
ctx.log.info('Members listed', { count: result.data.length });
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
ctx.enrich.echo(buildEffectiveQuery('members', {
|
|
60
|
+
congress: input.congress,
|
|
61
|
+
stateCode: input.stateCode,
|
|
62
|
+
district: input.district,
|
|
63
|
+
currentMember: input.currentMember,
|
|
64
|
+
}));
|
|
65
|
+
ctx.enrich.total(result.pagination.count);
|
|
66
|
+
if (result.data.length === 0)
|
|
67
|
+
ctx.enrich.notice('No members matched the filters. Try removing stateCode or district, or check the congress number.');
|
|
68
|
+
return result;
|
|
66
69
|
}
|
|
67
70
|
if (!input.bioguideId) {
|
|
68
71
|
throw validationError(`The '${input.operation}' operation requires bioguideId. Use 'list' with stateCode or congress to discover members.`, { field: 'bioguideId', operation: input.operation });
|
|
@@ -70,6 +73,8 @@ export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
|
70
73
|
if (input.operation === 'get') {
|
|
71
74
|
const result = await api.getMember(input.bioguideId, ctx);
|
|
72
75
|
ctx.log.info('Member retrieved', { bioguideId: input.bioguideId });
|
|
76
|
+
ctx.enrich.echo(`member ${input.bioguideId}`);
|
|
77
|
+
ctx.enrich.total(1);
|
|
73
78
|
return result;
|
|
74
79
|
}
|
|
75
80
|
const type = input.operation === 'sponsored' ? 'sponsored-legislation' : 'cosponsored-legislation';
|
|
@@ -83,10 +88,11 @@ export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
|
83
88
|
bioguideId: input.bioguideId,
|
|
84
89
|
type: input.operation,
|
|
85
90
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
ctx.enrich.echo(`${input.operation} legislation for ${input.bioguideId}`);
|
|
92
|
+
ctx.enrich.total(result.pagination.count);
|
|
93
|
+
if (result.data.length === 0)
|
|
94
|
+
ctx.enrich.notice(`No ${input.operation} legislation found for member ${input.bioguideId}.`);
|
|
95
|
+
return result;
|
|
90
96
|
},
|
|
91
97
|
});
|
|
92
98
|
//# sourceMappingURL=member-lookup.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-lookup.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/member-lookup.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"member-lookup.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/member-lookup.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,YAAY,GACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,2BAA2B,EAAE;IAChE,WAAW,EAAE,gaAAga;IAC7a,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,MAAM,EAAE,sBAAsB;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC;aACT,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;aACjD,QAAQ,CAAC,yBAAyB,CAAC;QACtC,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,qFAAqF,CACtF;QACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAC1F,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,M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<z.ZodNullable<z.ZodNumber>>;
|
|
26
26
|
}, z.core.$strip>>;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
}, z.core.$loose>, readonly [{
|
|
28
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
|
|
29
|
+
readonly reason: "not_found";
|
|
30
|
+
readonly retryable: false;
|
|
31
|
+
readonly when: "A requested bill, member, committee, report, vote, or nomination does not exist in Congress.gov.";
|
|
32
|
+
readonly recovery: "Use the tool's list or browse operation to discover valid identifiers, then retry with one that exists.";
|
|
33
|
+
}, {
|
|
34
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.RateLimited;
|
|
35
|
+
readonly reason: "rate_limited";
|
|
36
|
+
readonly retryable: true;
|
|
37
|
+
readonly when: "The Congress.gov API rate limit (5,000 requests/hour per key) was exceeded.";
|
|
38
|
+
readonly recovery: "Wait for the hourly rate-limit window to reset before retrying, or reduce the request frequency.";
|
|
39
|
+
}, {
|
|
40
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
|
|
41
|
+
readonly reason: "invalid_request";
|
|
42
|
+
readonly retryable: false;
|
|
43
|
+
readonly when: "Congress.gov rejected the request as malformed — a bad date range or an identifier with an unexpected shape.";
|
|
44
|
+
readonly recovery: "Check parameter formats: dates must be ISO 8601 like 2026-05-01T00:00:00Z and identifiers must match their documented shape.";
|
|
45
|
+
}, {
|
|
46
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
|
|
47
|
+
readonly reason: "upstream_error";
|
|
48
|
+
readonly retryable: true;
|
|
49
|
+
readonly when: "Congress.gov returned an unexpected error (5xx or another non-2xx status).";
|
|
50
|
+
readonly recovery: "Retry after a short delay; if the failure persists the Congress.gov service may be temporarily degraded.";
|
|
51
|
+
}], {
|
|
52
|
+
effectiveQuery: z.ZodString;
|
|
53
|
+
totalCount: z.ZodNumber;
|
|
54
|
+
notice: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}>;
|
|
29
56
|
//# sourceMappingURL=roll-votes.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roll-votes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/roll-votes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"roll-votes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/roll-votes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAYjD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0HxB,CAAC"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { formatVotes } from '../../../mcp-server/tools/format-helpers.js';
|
|
8
|
-
import {
|
|
8
|
+
import { buildEffectiveQuery, congressErrorContracts, listEnrichment, listOrDetail, } from '../../../mcp-server/tools/tool-helpers.js';
|
|
9
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
10
10
|
export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
11
11
|
description: `Retrieve House roll call vote data and individual member voting positions — House-only, as Senate vote data is not yet in the Congress.gov API. Use 'list' to find votes by congress and session (defaults to most-recently-updated first), 'get' for vote details (question, result, associated bill), or 'members' for how each representative voted.`,
|
|
12
12
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
13
|
+
errors: congressErrorContracts,
|
|
13
14
|
input: z.object({
|
|
14
15
|
operation: z.enum(['list', 'get', 'members']).describe('Which data to retrieve.'),
|
|
15
16
|
congress: z.number().int().positive().describe('Congress number.'),
|
|
@@ -33,11 +34,12 @@ export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
|
33
34
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
34
35
|
}),
|
|
35
36
|
output: listOrDetail('vote', 'Vote record for `get` and `members` (question, result, party totals, member positions); absent for `list`.'),
|
|
37
|
+
enrichment: listEnrichment,
|
|
36
38
|
format: formatVotes,
|
|
37
39
|
async handler(input, ctx) {
|
|
38
40
|
const api = getCongressApi();
|
|
39
41
|
if (input.operation === 'list') {
|
|
40
|
-
const
|
|
42
|
+
const effectiveQuery = buildEffectiveQuery('roll call votes', {
|
|
41
43
|
congress: input.congress,
|
|
42
44
|
session: input.session,
|
|
43
45
|
});
|
|
@@ -48,7 +50,11 @@ export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
|
48
50
|
limit: input.limit,
|
|
49
51
|
offset: input.offset,
|
|
50
52
|
}, ctx);
|
|
51
|
-
|
|
53
|
+
ctx.enrich.echo(effectiveQuery);
|
|
54
|
+
ctx.enrich.total(recent.pagination.count);
|
|
55
|
+
if (recent.data.length === 0)
|
|
56
|
+
ctx.enrich.notice('No votes found. Verify the congress and session numbers.');
|
|
57
|
+
return recent;
|
|
52
58
|
}
|
|
53
59
|
const result = await api.listVotes({
|
|
54
60
|
congress: input.congress,
|
|
@@ -57,7 +63,11 @@ export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
|
57
63
|
offset: input.offset,
|
|
58
64
|
}, ctx);
|
|
59
65
|
ctx.log.info('Votes listed', { congress: input.congress, session: input.session });
|
|
60
|
-
|
|
66
|
+
ctx.enrich.echo(effectiveQuery);
|
|
67
|
+
ctx.enrich.total(result.pagination.count);
|
|
68
|
+
if (result.data.length === 0)
|
|
69
|
+
ctx.enrich.notice('No votes found. Verify the congress and session numbers.');
|
|
70
|
+
return result;
|
|
61
71
|
}
|
|
62
72
|
if (!input.voteNumber) {
|
|
63
73
|
throw validationError(`The '${input.operation}' operation requires voteNumber. Use 'list' to browse available votes.`, { field: 'voteNumber', operation: input.operation });
|
|
@@ -74,11 +84,21 @@ export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
|
74
84
|
...voteParams,
|
|
75
85
|
operation: input.operation,
|
|
76
86
|
});
|
|
87
|
+
if (input.operation === 'get') {
|
|
88
|
+
ctx.enrich.echo(`roll call ${input.voteNumber} in the ${input.congress}th Congress, session ${input.session}`);
|
|
89
|
+
ctx.enrich.total(1);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
77
92
|
if (input.operation === 'members') {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
const membersResult = result;
|
|
94
|
+
ctx.enrich.echo(`member votes for roll ${input.voteNumber} in the ${input.congress}th Congress, session ${input.session}`);
|
|
95
|
+
ctx.enrich.total(membersResult.pagination?.count ?? 0);
|
|
96
|
+
const voteResults = Array.isArray(membersResult.vote?.results)
|
|
97
|
+
? membersResult.vote.results
|
|
98
|
+
: [];
|
|
99
|
+
if (voteResults.length === 0)
|
|
100
|
+
ctx.enrich.notice(`No member vote records found for roll ${input.voteNumber}.`);
|
|
101
|
+
return result;
|
|
82
102
|
}
|
|
83
103
|
return result;
|
|
84
104
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roll-votes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/roll-votes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"roll-votes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/roll-votes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE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