@cyanheads/congressgov-mcp-server 0.3.19 → 0.3.20
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 +1 -1
- package/CLAUDE.md +1 -1
- package/README.md +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js +17 -6
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.js +13 -5
- package/dist/mcp-server/tools/definitions/bill-summaries.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.js +14 -4
- package/dist/mcp-server/tools/definitions/committee-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js +9 -2
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/crs-reports.tool.js +3 -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 +8 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.js +11 -4
- package/dist/mcp-server/tools/definitions/daily-record.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.d.ts +8 -1
- 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 -3
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/member-lookup.tool.js +15 -3
- package/dist/mcp-server/tools/definitions/member-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/roll-votes.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/roll-votes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/roll-votes.tool.js +43 -22
- package/dist/mcp-server/tools/definitions/roll-votes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.d.ts +8 -1
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.js +7 -3
- package/dist/mcp-server/tools/definitions/senate-nominations.tool.js.map +1 -1
- package/dist/mcp-server/tools/format-helpers.d.ts +1 -1
- package/dist/mcp-server/tools/format-helpers.d.ts.map +1 -1
- package/dist/mcp-server/tools/format-helpers.js +228 -23
- package/dist/mcp-server/tools/format-helpers.js.map +1 -1
- package/dist/mcp-server/tools/tool-helpers.d.ts +34 -0
- package/dist/mcp-server/tools/tool-helpers.d.ts.map +1 -1
- package/dist/mcp-server/tools/tool-helpers.js +96 -0
- package/dist/mcp-server/tools/tool-helpers.js.map +1 -1
- package/dist/services/congress-api/congress-api-service.d.ts +1 -1
- package/dist/services/congress-api/congress-api-service.d.ts.map +1 -1
- package/dist/services/congress-api/congress-api-service.js +8 -16
- package/dist/services/congress-api/congress-api-service.js.map +1 -1
- package/package.json +1 -1
- package/server.json +3 -3
|
@@ -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,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,0BAA0B,EAAE;IAC9D,WAAW,EAAE,
|
|
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,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClF,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,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QACtE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,C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,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACrF,OAAO;gBACL,GAAG,MAAM;gBACT,KAAK,EAAE,cAAc,CAAC,cAAc,EAAE;oBACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB,CAAC;aACH,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,eAAe,CACnB,8GAA8G,EAC9G,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CACvD,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAC7B;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,EACD,GAAG,CACJ,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE;YAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -17,5 +17,12 @@ export declare const memberLookupTool: import("@cyanheads/mcp-ts-core").ToolDefi
|
|
|
17
17
|
currentMember: z.ZodOptional<z.ZodBoolean>;
|
|
18
18
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
19
19
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
20
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
22
|
+
pagination: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
count: z.ZodNumber;
|
|
24
|
+
nextOffset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
query: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$loose>, undefined>;
|
|
21
28
|
//# 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;AAOjD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;6BA0G3B,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
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 { buildQueryEcho, listOrDetail } from '../../../mcp-server/tools/tool-helpers.js';
|
|
8
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
9
10
|
export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
10
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.`,
|
|
@@ -36,7 +37,7 @@ export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
|
36
37
|
limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
|
|
37
38
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
38
39
|
}),
|
|
39
|
-
output:
|
|
40
|
+
output: listOrDetail('member', 'Member profile for `get` (name, state, terms, party history, leadership, legislation counts); absent for `list`, `sponsored`, `cosponsored`.'),
|
|
40
41
|
format: formatMembers,
|
|
41
42
|
async handler(input, ctx) {
|
|
42
43
|
const api = getCongressApi();
|
|
@@ -53,7 +54,15 @@ export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
|
53
54
|
offset: input.offset,
|
|
54
55
|
}, ctx);
|
|
55
56
|
ctx.log.info('Members listed', { count: result.data.length });
|
|
56
|
-
return
|
|
57
|
+
return {
|
|
58
|
+
...result,
|
|
59
|
+
query: buildQueryEcho('members', {
|
|
60
|
+
congress: input.congress,
|
|
61
|
+
stateCode: input.stateCode,
|
|
62
|
+
district: input.district,
|
|
63
|
+
currentMember: input.currentMember,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
57
66
|
}
|
|
58
67
|
if (!input.bioguideId) {
|
|
59
68
|
throw validationError(`The '${input.operation}' operation requires bioguideId. Use 'list' with stateCode or congress to discover members.`, { field: 'bioguideId', operation: input.operation });
|
|
@@ -74,7 +83,10 @@ export const memberLookupTool = tool('congressgov_member_lookup', {
|
|
|
74
83
|
bioguideId: input.bioguideId,
|
|
75
84
|
type: input.operation,
|
|
76
85
|
});
|
|
77
|
-
return
|
|
86
|
+
return {
|
|
87
|
+
...result,
|
|
88
|
+
query: buildQueryEcho(`${input.operation} legislation for ${input.bioguideId}`),
|
|
89
|
+
};
|
|
78
90
|
},
|
|
79
91
|
});
|
|
80
92
|
//# sourceMappingURL=member-lookup.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-lookup.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/member-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,KAAK,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,yBAAyB,CAAC;QACxF,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,oBAAoB,CAC3C;YACE,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,IAAI;YACJ,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,EACD,GAAG,CACJ,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,8BAA8B,EAAE;YAC3C,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,IAAI,EAAE,KAAK,CAAC,SAAS;SACtB,CAAC,CAAC;QACH,OAAO;YACL,GAAG,MAAM;YACT,KAAK,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,SAAS,oBAAoB,KAAK,CAAC,UAAU,EAAE,CAAC;SAChF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -18,5 +18,12 @@ export declare const rollVotesTool: import("@cyanheads/mcp-ts-core").ToolDefinit
|
|
|
18
18
|
}>>;
|
|
19
19
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
20
20
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
21
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
22
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
23
|
+
pagination: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
count: z.ZodNumber;
|
|
25
|
+
nextOffset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
query: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$loose>, undefined>;
|
|
22
29
|
//# 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;AAOjD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;6BAiGxB,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
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 { buildQueryEcho, listOrDetail } from '../../../mcp-server/tools/tool-helpers.js';
|
|
8
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
9
10
|
export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
10
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.`,
|
|
@@ -27,22 +28,27 @@ export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
|
27
28
|
order: z
|
|
28
29
|
.enum(['recent', 'oldest'])
|
|
29
30
|
.default('recent')
|
|
30
|
-
.describe("Sort order for 'list'
|
|
31
|
+
.describe("Sort order for 'list', by vote update date. 'recent' (default) returns newest first; 'oldest' returns ascending. With 'recent', offset=0 always returns the strictly newest page. Ignored by 'get' and 'members'."),
|
|
31
32
|
limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
|
|
32
33
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
33
34
|
}),
|
|
34
|
-
output:
|
|
35
|
+
output: listOrDetail('vote', 'Vote record for `get` and `members` (question, result, party totals, member positions); absent for `list`.'),
|
|
35
36
|
format: formatVotes,
|
|
36
37
|
async handler(input, ctx) {
|
|
37
38
|
const api = getCongressApi();
|
|
38
39
|
if (input.operation === 'list') {
|
|
40
|
+
const hint = buildQueryEcho('roll call votes', {
|
|
41
|
+
congress: input.congress,
|
|
42
|
+
session: input.session,
|
|
43
|
+
});
|
|
39
44
|
if (input.order === 'recent') {
|
|
40
|
-
|
|
45
|
+
const recent = await fetchVotesRecent({
|
|
41
46
|
congress: input.congress,
|
|
42
47
|
session: input.session,
|
|
43
48
|
limit: input.limit,
|
|
44
49
|
offset: input.offset,
|
|
45
50
|
}, ctx);
|
|
51
|
+
return { ...recent, query: hint };
|
|
46
52
|
}
|
|
47
53
|
const result = await api.listVotes({
|
|
48
54
|
congress: input.congress,
|
|
@@ -51,7 +57,7 @@ export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
|
51
57
|
offset: input.offset,
|
|
52
58
|
}, ctx);
|
|
53
59
|
ctx.log.info('Votes listed', { congress: input.congress, session: input.session });
|
|
54
|
-
return result;
|
|
60
|
+
return { ...result, query: hint };
|
|
55
61
|
}
|
|
56
62
|
if (!input.voteNumber) {
|
|
57
63
|
throw validationError(`The '${input.operation}' operation requires voteNumber. Use 'list' to browse available votes.`, { field: 'voteNumber', operation: input.operation });
|
|
@@ -68,39 +74,54 @@ export const rollVotesTool = tool('congressgov_roll_votes', {
|
|
|
68
74
|
...voteParams,
|
|
69
75
|
operation: input.operation,
|
|
70
76
|
});
|
|
77
|
+
if (input.operation === 'members') {
|
|
78
|
+
return {
|
|
79
|
+
...result,
|
|
80
|
+
query: buildQueryEcho(`member votes for roll ${input.voteNumber} in the ${input.congress}th Congress, session ${input.session}`),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
71
83
|
return result;
|
|
72
84
|
},
|
|
73
85
|
});
|
|
74
86
|
/**
|
|
75
|
-
* Fetch roll call votes in newest-first order. The /house-vote/{c}/{s}
|
|
76
|
-
* returns rows in
|
|
77
|
-
*
|
|
78
|
-
*
|
|
87
|
+
* Fetch roll call votes in strict newest-first order. The /house-vote/{c}/{s}
|
|
88
|
+
* endpoint returns rows in opaque insertion order (loosely correlated with roll
|
|
89
|
+
* number but not with updateDate — late-edited votes break the sequence), and
|
|
90
|
+
* ignores sort params. Fetch the full session, sort by updateDate desc, then
|
|
91
|
+
* slice the requested page. Typical sessions are 200-750 votes; at PAGE_SIZE=250
|
|
92
|
+
* that's 1-3 upstream requests per call, dispatched in parallel after the first.
|
|
79
93
|
*/
|
|
80
94
|
async function fetchVotesRecent(params, ctx) {
|
|
81
95
|
const api = getCongressApi();
|
|
82
|
-
const
|
|
83
|
-
const
|
|
96
|
+
const PAGE_SIZE = 250;
|
|
97
|
+
const first = await api.listVotes({ congress: params.congress, session: params.session, limit: PAGE_SIZE, offset: 0 }, ctx);
|
|
98
|
+
const total = first.pagination.count;
|
|
84
99
|
if (total === 0 || params.offset >= total) {
|
|
85
100
|
return { data: [], pagination: { count: total, nextOffset: null } };
|
|
86
101
|
}
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const result = await api.listVotes({
|
|
102
|
+
const remainingPages = Math.ceil(total / PAGE_SIZE) - 1;
|
|
103
|
+
const pages = await Promise.all(Array.from({ length: remainingPages }, (_, i) => api.listVotes({
|
|
90
104
|
congress: params.congress,
|
|
91
105
|
session: params.session,
|
|
92
|
-
limit:
|
|
93
|
-
offset:
|
|
94
|
-
}, ctx);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
106
|
+
limit: PAGE_SIZE,
|
|
107
|
+
offset: (i + 1) * PAGE_SIZE,
|
|
108
|
+
}, ctx)));
|
|
109
|
+
const all = [...first.data, ...pages.flatMap((p) => p.data)];
|
|
110
|
+
all.sort((a, b) => {
|
|
111
|
+
const ad = a.updateDate ?? '';
|
|
112
|
+
const bd = b.updateDate ?? '';
|
|
113
|
+
return bd.localeCompare(ad);
|
|
114
|
+
});
|
|
115
|
+
const slice = all.slice(params.offset, params.offset + params.limit);
|
|
116
|
+
const nextOffset = params.offset + slice.length < all.length ? params.offset + slice.length : null;
|
|
117
|
+
ctx.log.info('Votes listed (recent order, strict)', {
|
|
98
118
|
congress: params.congress,
|
|
99
119
|
session: params.session,
|
|
100
|
-
total,
|
|
101
|
-
returned:
|
|
120
|
+
total: all.length,
|
|
121
|
+
returned: slice.length,
|
|
102
122
|
offset: params.offset,
|
|
123
|
+
upstreamRequests: 1 + remainingPages,
|
|
103
124
|
});
|
|
104
|
-
return { ...
|
|
125
|
+
return { ...first, data: slice, pagination: { count: all.length, nextOffset } };
|
|
105
126
|
}
|
|
106
127
|
//# sourceMappingURL=roll-votes.tool.js.map
|
|
@@ -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,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,wBAAwB,EAAE;IAC1D,WAAW,EAAE,yVAAyV;IACtW,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QACjF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,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,CAAC,IAAI,CAAC;IAClF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,EAAE;QAClD,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK,EAAE,GAAG,CAAC,MAAM;QACjB,QAAQ,EAAE,KAAK,CAAC,MAAM;QACtB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,gBAAgB,EAAE,CAAC,GAAG,cAAc;KACrC,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC;AAClF,CAAC"}
|
|
@@ -17,5 +17,12 @@ export declare const senateNominationsTool: import("@cyanheads/mcp-ts-core").Too
|
|
|
17
17
|
ordinal: z.ZodOptional<z.ZodNumber>;
|
|
18
18
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
19
19
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
20
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
|
|
22
|
+
pagination: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
count: z.ZodNumber;
|
|
24
|
+
nextOffset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
query: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$loose>, undefined>;
|
|
21
28
|
//# sourceMappingURL=senate-nominations.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"senate-nominations.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/senate-nominations.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"senate-nominations.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/senate-nominations.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAOjD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;6BA+GhC,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { formatNominations } from '../../../mcp-server/tools/format-helpers.js';
|
|
8
|
+
import { buildQueryEcho, listOrDetail } from '../../../mcp-server/tools/tool-helpers.js';
|
|
8
9
|
import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
|
|
9
10
|
export const senateNominationsTool = tool('congressgov_senate_nominations', {
|
|
10
11
|
description: `Browse presidential nominations to federal positions and track the Senate confirmation process. Use 'list' to browse, 'get' for nomination detail, 'actions'/'committees'/'hearings' for confirmation pipeline data, or 'nominees' to retrieve individual appointees in a multi-nominee batch. Nominations use 'PN' (Presidential Nomination) numbering. Most nominations carry confirmation activity on the parent (e.g., PN1000); multi-part parents (e.g., PN851) carry no activity of their own — their actions, committees, hearings, and nominees live on partitioned children (PN851-1, PN851-2, …). 'get' on a parent that has no \`nominees\` array signals the partitioned form is needed for everything below it.`,
|
|
@@ -27,7 +28,7 @@ export const senateNominationsTool = tool('congressgov_senate_nominations', {
|
|
|
27
28
|
limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
|
|
28
29
|
offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
|
|
29
30
|
}),
|
|
30
|
-
output:
|
|
31
|
+
output: listOrDetail('nomination', 'Nomination record for `get` (description, dates, nominees array, sub-resource counts); absent for `list` and sub-resources.'),
|
|
31
32
|
format: formatNominations,
|
|
32
33
|
async handler(input, ctx) {
|
|
33
34
|
const api = getCongressApi();
|
|
@@ -41,7 +42,10 @@ export const senateNominationsTool = tool('congressgov_senate_nominations', {
|
|
|
41
42
|
congress: input.congress,
|
|
42
43
|
count: result.data.length,
|
|
43
44
|
});
|
|
44
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
...result,
|
|
47
|
+
query: buildQueryEcho('nominations', { congress: input.congress }),
|
|
48
|
+
};
|
|
45
49
|
}
|
|
46
50
|
if (!input.nominationNumber) {
|
|
47
51
|
throw validationError(`The '${input.operation}' operation requires nominationNumber. Use 'list' to browse nominations.`, { field: 'nominationNumber', operation: input.operation });
|
|
@@ -96,7 +100,7 @@ function withParentFormHint(result, nominationNumber) {
|
|
|
96
100
|
return result;
|
|
97
101
|
return {
|
|
98
102
|
...result,
|
|
99
|
-
|
|
103
|
+
query: `If \`${nominationNumber}\` is a multi-part parent, its actions/committees/hearings/nominees live on the partitioned children. Try \`${nominationNumber}-1\` (and -2, -3, …) instead.`,
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
106
|
//# sourceMappingURL=senate-nominations.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"senate-nominations.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/senate-nominations.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,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC,gCAAgC,EAAE;IAC1E,WAAW,EAAE,8rBAA8rB;IAC3sB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC;aACT,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;aACtE,QAAQ,CAAC,yBAAyB,CAAC;QACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAClE,gBAAgB,EAAE,CAAC;aAChB,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,6NAA6N,CAC9N;QACH,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,GAAG,EAAE;aACL,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CACP,yUAAyU,CAC1U;QACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;QACzF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;KAC1E,CAAC;IACF,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"senate-nominations.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/senate-nominations.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,EAAE,cAAc,EAAE,YAA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AC,CAAC;IAC5D,CAAC;CACF,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAgC,MAAS,EAAE,gBAAwB;IAC5F,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC;IAC5E,OAAO;QACL,GAAG,MAAM;QACT,KAAK,EAAE,QAAQ,gBAAgB,+GAA+G,gBAAgB,+BAA+B;KAC9L,CAAC;AACJ,CAAC"}
|
|
@@ -29,7 +29,7 @@ export declare function formatCrsReports(result: Record<string, unknown>): TextB
|
|
|
29
29
|
/** Daily Congressional Record — volumes, issues, articles. */
|
|
30
30
|
/** Daily Congressional Record. Dispatches between volumes/issues and flattened articles. */
|
|
31
31
|
export declare function formatDailyRecord(result: Record<string, unknown>): TextBlock[];
|
|
32
|
-
/** Enacted public and private laws. */
|
|
32
|
+
/** Enacted public and private laws. Upstream /law mirrors /bill, so reuse bill formatters. */
|
|
33
33
|
export declare const formatLaws: (result: Record<string, unknown>) => TextBlock[];
|
|
34
34
|
/** House roll call votes and member voting positions. */
|
|
35
35
|
export declare function formatVotes(result: Record<string, unknown>): TextBlock[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-helpers.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/format-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,KAAK,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"format-helpers.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/format-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,KAAK,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AA8nChD,sF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