@cyanheads/congressgov-mcp-server 0.4.3 → 0.5.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 (51) hide show
  1. package/AGENTS.md +20 -5
  2. package/CLAUDE.md +20 -5
  3. package/README.md +3 -1
  4. package/dist/index.js +2 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.d.ts +9 -0
  7. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.d.ts.map +1 -1
  8. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.js +46 -15
  9. package/dist/mcp-server/prompts/definitions/legislative-research.prompt.js.map +1 -1
  10. package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts +38 -0
  11. package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts.map +1 -1
  12. package/dist/mcp-server/tools/definitions/bill-lookup.tool.js +72 -4
  13. package/dist/mcp-server/tools/definitions/bill-lookup.tool.js.map +1 -1
  14. package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts +37 -0
  15. package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts.map +1 -1
  16. package/dist/mcp-server/tools/definitions/committee-reports.tool.js +66 -7
  17. package/dist/mcp-server/tools/definitions/committee-reports.tool.js.map +1 -1
  18. package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts +41 -3
  19. package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/daily-record.tool.js +61 -8
  21. package/dist/mcp-server/tools/definitions/daily-record.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/format-helpers.d.ts +9 -5
  23. package/dist/mcp-server/tools/format-helpers.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/format-helpers.js +397 -89
  25. package/dist/mcp-server/tools/format-helpers.js.map +1 -1
  26. package/dist/mcp-server/tools/tool-helpers.d.ts +67 -0
  27. package/dist/mcp-server/tools/tool-helpers.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/tool-helpers.js +85 -0
  29. package/dist/mcp-server/tools/tool-helpers.js.map +1 -1
  30. package/dist/services/congress-documents/congress-documents-service.d.ts +85 -0
  31. package/dist/services/congress-documents/congress-documents-service.d.ts.map +1 -0
  32. package/dist/services/congress-documents/congress-documents-service.js +289 -0
  33. package/dist/services/congress-documents/congress-documents-service.js.map +1 -0
  34. package/dist/services/congress-documents/document-formats.d.ts +29 -0
  35. package/dist/services/congress-documents/document-formats.d.ts.map +1 -0
  36. package/dist/services/congress-documents/document-formats.js +51 -0
  37. package/dist/services/congress-documents/document-formats.js.map +1 -0
  38. package/dist/services/congress-documents/extract-text-stream.d.ts +58 -0
  39. package/dist/services/congress-documents/extract-text-stream.d.ts.map +1 -0
  40. package/dist/services/congress-documents/extract-text-stream.js +689 -0
  41. package/dist/services/congress-documents/extract-text-stream.js.map +1 -0
  42. package/dist/services/congress-documents/extract-text.d.ts +27 -0
  43. package/dist/services/congress-documents/extract-text.d.ts.map +1 -0
  44. package/dist/services/congress-documents/extract-text.js +87 -0
  45. package/dist/services/congress-documents/extract-text.js.map +1 -0
  46. package/dist/services/congress-documents/types.d.ts +45 -0
  47. package/dist/services/congress-documents/types.d.ts.map +1 -0
  48. package/dist/services/congress-documents/types.js +6 -0
  49. package/dist/services/congress-documents/types.js.map +1 -0
  50. package/package.json +1 -1
  51. package/server.json +3 -3
@@ -5,29 +5,45 @@
5
5
  import { tool, z } from '@cyanheads/mcp-ts-core';
6
6
  import { validationError } from '@cyanheads/mcp-ts-core/errors';
7
7
  import { formatCommitteeReports } from '../../../mcp-server/tools/format-helpers.js';
8
- import { buildEffectiveQuery, congressErrorContracts, listEnrichment, listOrDetail, notifyIfNoMatches, } from '../../../mcp-server/tools/tool-helpers.js';
8
+ import { buildEffectiveQuery, congressErrorContracts, documentErrorContracts, documentWindowInput, listEnrichment, listOrDetail, notifyIfNoMatches, } from '../../../mcp-server/tools/tool-helpers.js';
9
9
  import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
10
+ import { getCongressDocuments } from '../../../services/congress-documents/congress-documents-service.js';
11
+ import { describeFormat, selectDocumentUrl, } from '../../../services/congress-documents/document-formats.js';
12
+ /**
13
+ * Committee report text arrives as `[{formats:[…]}, …]` — one format per entry,
14
+ * unlike bill text versions, which carry every format on a single row. Flatten so
15
+ * the format selector sees them all.
16
+ */
17
+ function collectReportFormats(text) {
18
+ if (!Array.isArray(text))
19
+ return [];
20
+ return text.flatMap((entry) => {
21
+ const formats = entry?.formats;
22
+ return Array.isArray(formats) ? formats : [];
23
+ });
24
+ }
10
25
  export const committeeReportsTool = tool('congressgov_committee_reports', {
11
- description: `Browse and retrieve committee reports from Congress.gov — reports accompany legislation reported out of committee and explain the bill's purpose, committee amendments, dissenting views, and the committee vote. Report types are 'hrpt' (House), 'srpt' (Senate), and 'erpt' (Executive).`,
26
+ description: `Browse and retrieve committee reports from Congress.gov — reports accompany legislation reported out of committee and explain the bill's purpose, committee amendments, dissenting views, and the committee vote. Report types are 'hrpt' (House), 'srpt' (Senate), and 'erpt' (Executive). 'text' lists the published format URLs; 'content' then reads the report's actual text, a bounded character window at a time.`,
12
27
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
13
- errors: congressErrorContracts,
28
+ errors: [...congressErrorContracts, ...documentErrorContracts],
14
29
  input: z.object({
15
- operation: z.enum(['list', 'get', 'text']).describe('Which data to retrieve.'),
30
+ operation: z.enum(['list', 'get', 'text', 'content']).describe('Which data to retrieve.'),
16
31
  congress: z.number().int().positive().describe('Congress number.'),
17
32
  reportType: z
18
33
  .enum(['hrpt', 'srpt', 'erpt'])
19
34
  .optional()
20
- .describe('Report type. Required for get and text operations.'),
35
+ .describe('Report type. Required for get, text, and content operations.'),
21
36
  reportNumber: z
22
37
  .number()
23
38
  .int()
24
39
  .positive()
25
40
  .optional()
26
- .describe('Committee report number. Required for get and text operations.'),
41
+ .describe('Committee report number. Required for get, text, and content operations.'),
27
42
  limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
28
43
  offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
44
+ ...documentWindowInput,
29
45
  }),
30
- output: listOrDetail('report', "the committee report (citation, title, committees, associated bill); for `text`, an alternative key 'text' carries an array of {type, url} format links."),
46
+ output: listOrDetail('report', "the committee report (citation, title, committees, associated bill); for `text`, an alternative key 'text' carries an array of {type, url} format links; for `content`, an alternative key 'content' carries {text, format, sourceUrl, documentTitle, totalCharacters, offset, truncated, nextOffset} — one exact character window of the report."),
31
47
  enrichment: listEnrichment,
32
48
  format: formatCommitteeReports,
33
49
  async handler(input, ctx) {
@@ -58,6 +74,49 @@ export const committeeReportsTool = tool('congressgov_committee_reports', {
58
74
  reportNumber: input.reportNumber,
59
75
  });
60
76
  }
77
+ if (input.operation === 'content') {
78
+ const citation = `${input.reportType.toUpperCase()} ${input.congress}-${input.reportNumber}`;
79
+ const result = await api.getCommitteeReportText({
80
+ congress: input.congress,
81
+ reportType: input.reportType,
82
+ reportNumber: input.reportNumber,
83
+ }, ctx);
84
+ const formats = collectReportFormats(result.text);
85
+ if (formats.length === 0) {
86
+ throw ctx.fail('document_unavailable', `Committee report ${citation} publishes no document formats.`, {
87
+ ...ctx.recoveryFor('document_unavailable'),
88
+ congress: input.congress,
89
+ reportType: input.reportType,
90
+ reportNumber: input.reportNumber,
91
+ });
92
+ }
93
+ const url = selectDocumentUrl(formats, input.format);
94
+ if (!url) {
95
+ throw ctx.fail('format_unavailable', `Committee report ${citation} publishes no '${input.format}' document (looked for ${describeFormat(input.format)}).`, { ...ctx.recoveryFor('format_unavailable'), format: input.format });
96
+ }
97
+ const document = await getCongressDocuments().fetchDocument({
98
+ url,
99
+ characterOffset: input.characterOffset,
100
+ characterLimit: input.characterLimit,
101
+ }, ctx);
102
+ ctx.log.info('Committee report content retrieved', {
103
+ congress: input.congress,
104
+ reportType: input.reportType,
105
+ reportNumber: input.reportNumber,
106
+ format: input.format,
107
+ totalCharacters: document.totalCharacters,
108
+ });
109
+ ctx.enrich.echo(`${citation}, ${input.format} characters ${document.offset}–${document.offset + document.text.length}`);
110
+ ctx.enrich.total(document.totalCharacters);
111
+ return {
112
+ content: {
113
+ ...document,
114
+ format: input.format,
115
+ sourceUrl: url,
116
+ documentTitle: `Committee Report ${citation}`,
117
+ },
118
+ };
119
+ }
61
120
  if (input.operation === 'text') {
62
121
  const result = await api.getCommitteeReportText({
63
122
  congress: input.congress,
@@ -1 +1 @@
1
- {"version":3,"file":"committee-reports.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/committee-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,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,+BAA+B,EAAE;IACxE,WAAW,EAAE,6RAA6R;IAC1S,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,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;QAC9E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;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AY,KAAK,KAAK,CAAC,QAAQ,cAAc,CAC1G,CAAC;YACF,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtE,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,kBAAkB,CACzC;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,EACD,GAAG,CACJ,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACzC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,QAAQ,cAAc,CACzF,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"committee-reports.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/committee-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,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,sBAA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GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACzC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,QAAQ,cAAc,CACzF,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
@@ -4,8 +4,15 @@
4
4
  */
5
5
  import { z } from '@cyanheads/mcp-ts-core';
6
6
  export declare const dailyRecordTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
7
+ format: z.ZodDefault<z.ZodEnum<{
8
+ text: "text";
9
+ xml: "xml";
10
+ }>>;
11
+ characterOffset: z.ZodDefault<z.ZodNumber>;
12
+ characterLimit: z.ZodDefault<z.ZodNumber>;
7
13
  operation: z.ZodEnum<{
8
14
  articles: "articles";
15
+ content: "content";
9
16
  issues: "issues";
10
17
  list: "list";
11
18
  }>;
@@ -13,12 +20,13 @@ export declare const dailyRecordTool: import("@cyanheads/mcp-ts-core").ToolDefin
13
20
  issueNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
14
21
  limit: z.ZodDefault<z.ZodNumber>;
15
22
  offset: z.ZodDefault<z.ZodNumber>;
23
+ articleIndex: z.ZodDefault<z.ZodNumber>;
16
24
  }, z.core.$strip>, z.ZodObject<{
17
- data: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
18
- pagination: z.ZodObject<{
25
+ data: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$loose>>>;
26
+ pagination: z.ZodOptional<z.ZodObject<{
19
27
  count: z.ZodNumber;
20
28
  nextOffset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
21
- }, z.core.$strip>;
29
+ }, z.core.$strip>>;
22
30
  }, z.core.$loose>, readonly [{
23
31
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
24
32
  readonly reason: 'not_found';
@@ -43,6 +51,36 @@ export declare const dailyRecordTool: import("@cyanheads/mcp-ts-core").ToolDefin
43
51
  readonly retryable: true;
44
52
  readonly when: 'Congress.gov returned an unexpected error (5xx or another non-2xx status).';
45
53
  readonly recovery: 'Retry after a short delay; if the failure persists the Congress.gov service may be temporarily degraded.';
54
+ }, {
55
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
56
+ readonly reason: 'document_unavailable';
57
+ readonly retryable: false;
58
+ readonly when: "The 'content' selection resolves to no retrievable document — the text version or article index is past the end of the list, the record publishes no formats at all, or Congress.gov does not hold the file its own metadata names.";
59
+ readonly recovery: "Run the tool's 'text' or 'articles' operation first to see which documents Congress.gov publishes for this record, then retry with a selection it lists.";
60
+ }, {
61
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
62
+ readonly reason: 'format_unavailable';
63
+ readonly retryable: false;
64
+ readonly when: "The document exists but publishes nothing in the requested 'format' — some text versions and committee reports ship PDF only, and no Congressional Record article publishes XML.";
65
+ readonly recovery: "Retry with format 'text', which every document checked publishes; if that fails too the document is PDF-only, so read it at the format URL the text operation returns.";
66
+ }, {
67
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
68
+ readonly reason: 'document_fetch_failed';
69
+ readonly retryable: true;
70
+ readonly when: 'www.congress.gov did not return a readable document — a non-2xx status, a network failure, an empty body, or a content type that is not text or XML.';
71
+ readonly recovery: 'Retry after a short delay; if the failure persists, request a different format or read the document at the sourceUrl the text operation returns.';
72
+ }, {
73
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
74
+ readonly reason: 'document_too_large';
75
+ readonly retryable: false;
76
+ readonly when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.';
77
+ readonly recovery: 'Read the document at the sourceUrl the text operation returns. A document this size clears the ceiling in every format it publishes, so switching format reaches the same limit.';
78
+ }, {
79
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
80
+ readonly reason: 'offset_past_end';
81
+ readonly retryable: false;
82
+ readonly when: 'characterOffset is at or beyond the last character of the document, so the window would be empty.';
83
+ readonly recovery: 'Restart the walk at characterOffset 0 and follow nextOffset, which goes null once the document has been read to the end.';
46
84
  }], {
47
85
  effectiveQuery: z.ZodString;
48
86
  totalCount: z.ZodNumber;
@@ -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;AAcjD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoF1B,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;AAqBjD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiK1B,CAAC"}
@@ -5,20 +5,31 @@
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 { congressErrorContracts, listEnrichment, listOutput, notifyIfNoMatches, numericIdentifier, toIdentifierNumber, } from '../../../mcp-server/tools/tool-helpers.js';
8
+ import { congressErrorContracts, documentErrorContracts, documentWindowInput, listEnrichment, listOrDetail, notifyIfNoMatches, numericIdentifier, toIdentifierNumber, } from '../../../mcp-server/tools/tool-helpers.js';
9
9
  import { getCongressApi } from '../../../services/congress-api/congress-api-service.js';
10
+ import { getCongressDocuments } from '../../../services/congress-documents/congress-documents-service.js';
11
+ import { describeFormat, selectDocumentUrl, } from '../../../services/congress-documents/document-formats.js';
10
12
  export const dailyRecordTool = tool('congressgov_daily_record', {
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.`,
13
+ 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. 'articles' lists each article and its format URLs; 'content' then reads one article's actual text, a bounded character window at a time.`,
12
14
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
13
- errors: congressErrorContracts,
15
+ errors: [...congressErrorContracts, ...documentErrorContracts],
14
16
  input: z.object({
15
- operation: z.enum(['list', 'issues', 'articles']).describe('Which data to retrieve.'),
16
- volumeNumber: numericIdentifier("Volume number. Required for 'issues' and 'articles'. Accepts a number or the digit-string form list rows carry.").optional(),
17
- issueNumber: numericIdentifier('Issue number within a volume. Required for \'articles\'. List rows carry this as a string (e.g. "109") — both forms are accepted.').optional(),
17
+ operation: z
18
+ .enum(['list', 'issues', 'articles', 'content'])
19
+ .describe('Which data to retrieve.'),
20
+ volumeNumber: numericIdentifier("Volume number. Required for 'issues', 'articles', and 'content'. Accepts a number or the digit-string form list rows carry.").optional(),
21
+ issueNumber: numericIdentifier("Issue number within a volume. Required for 'articles' and 'content'. List rows carry this as a string (e.g. \"109\") — both forms are accepted.").optional(),
18
22
  limit: z.number().int().min(1).max(250).default(20).describe('Results per page (1-250).'),
19
23
  offset: z.number().int().min(0).default(0).describe('Pagination offset.'),
24
+ articleIndex: z
25
+ .number()
26
+ .int()
27
+ .min(0)
28
+ .default(0)
29
+ .describe("Which article 'content' reads, 0-based against the issue's whole article sequence — the same absolute position 'articles' pages through with offset. Ignored by other operations."),
30
+ ...documentWindowInput,
20
31
  }),
21
- output: listOutput,
32
+ output: listOrDetail('content', '{text, format, sourceUrl, documentTitle, totalCharacters, offset, truncated, nextOffset} for `content` — one exact character window of an article; absent for `list`, `issues`, and `articles`, which carry `data` + `pagination`.'),
22
33
  enrichment: listEnrichment,
23
34
  format: formatDailyRecord,
24
35
  async handler(input, ctx) {
@@ -49,9 +60,51 @@ export const dailyRecordTool = tool('congressgov_daily_record', {
49
60
  return result;
50
61
  }
51
62
  if (!input.issueNumber) {
52
- throw validationError("The 'articles' operation requires both volumeNumber and issueNumber. Use 'issues' to see available issues within a volume.", { field: 'issueNumber' });
63
+ throw validationError(`The '${input.operation}' operation requires both volumeNumber and issueNumber. Use 'issues' to see available issues within a volume.`, { field: 'issueNumber' });
53
64
  }
54
65
  const issueNumber = toIdentifierNumber(input.issueNumber);
66
+ if (input.operation === 'content') {
67
+ /** One upstream page of exactly the selected article — not the whole issue. */
68
+ const articles = await api.getDailyArticles({ volumeNumber, issueNumber, limit: 1, offset: input.articleIndex }, ctx);
69
+ const article = articles.data[0];
70
+ if (!article) {
71
+ throw ctx.fail('document_unavailable', `No article at index ${input.articleIndex} in volume ${volumeNumber}, issue ${issueNumber} — the issue holds ${articles.pagination.count} article(s).`, {
72
+ ...ctx.recoveryFor('document_unavailable'),
73
+ articleIndex: input.articleIndex,
74
+ available: articles.pagination.count,
75
+ });
76
+ }
77
+ /** Articles carry their format links on `text[]`, not `formats[]`. */
78
+ const url = selectDocumentUrl(article.text, input.format);
79
+ if (!url) {
80
+ throw ctx.fail('format_unavailable', `This article publishes no '${input.format}' document (looked for ${describeFormat(input.format)}). The Congressional Record publishes Formatted Text and PDF only.`, {
81
+ ...ctx.recoveryFor('format_unavailable'),
82
+ format: input.format,
83
+ articleIndex: input.articleIndex,
84
+ });
85
+ }
86
+ const document = await getCongressDocuments().fetchDocument({ url, characterOffset: input.characterOffset, characterLimit: input.characterLimit }, ctx);
87
+ const articleTitle = typeof article.title === 'string' && article.title.trim() !== ''
88
+ ? article.title
89
+ : `Volume ${volumeNumber}, issue ${issueNumber}, article ${input.articleIndex}`;
90
+ ctx.log.info('Daily record article content retrieved', {
91
+ volumeNumber,
92
+ issueNumber,
93
+ articleIndex: input.articleIndex,
94
+ format: input.format,
95
+ totalCharacters: document.totalCharacters,
96
+ });
97
+ ctx.enrich.echo(`article ${input.articleIndex} of volume ${volumeNumber}, issue ${issueNumber}, ${input.format} characters ${document.offset}–${document.offset + document.text.length}`);
98
+ ctx.enrich.total(document.totalCharacters);
99
+ return {
100
+ content: {
101
+ ...document,
102
+ format: input.format,
103
+ sourceUrl: url,
104
+ documentTitle: articleTitle,
105
+ },
106
+ };
107
+ }
55
108
  const result = await api.getDailyArticles({
56
109
  volumeNumber,
57
110
  issueNumber,
@@ -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,EACL,sBAAsB,EACtB,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF,MAAM,CAAC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B,MAAM,eAAe,CACnB,4HAA4H,EAC5H,EAAE,KAAK,EAAE,aAAa,EAAE,CACzB,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAG,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,gBAAgB,CACvC;YACE,YAAY;YACZ,WAAW;YACX,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,EACD,GAAG,CACJ,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/E,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,YAAY,WAAW,WAAW,EAAE,CAAC,CAAC;QAC7E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1C,iBAAiB,CACf,GAAG,EACH,MAAM,EACN,gCAAgC,YAAY,WAAW,WAAW,GAAG,CACtE,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
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,EACL,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACjF,O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,IAAI,CAAC,MAAM,EAAE,CACzK,CAAC;YACF,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;YAC3C,OAAO;gBACL,OAAO,EAAE;oBACP,GAAG,QAAQ;oBACX,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,SAAS,EAAE,GAAG;oBACd,aAAa,EAAE,YAAY;iBAC5B;aACF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,gBAAgB,CACvC;YACE,YAAY;YACZ,WAAW;YACX,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,EACD,GAAG,CACJ,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/E,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,YAAY,WAAW,WAAW,EAAE,CAAC,CAAC;QAC7E,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1C,iBAAiB,CACf,GAAG,EACH,MAAM,EACN,gCAAgC,YAAY,WAAW,WAAW,GAAG,CACtE,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
@@ -6,11 +6,15 @@
6
6
  * NOT reliably forwarded. These formatters render complete, structured
7
7
  * markdown so the LLM can reason about all returned data.
8
8
  *
9
- * **Completeness invariant.** A record reaching a detail renderer is rendered
10
- * whole: every upstream field appears, and no value is cut mid-string. A
11
- * hand-built header may curate presentation, but it ends in `renderDetailRest`,
12
- * and a curated collection row ends in `withUnnamedFields` — so a field neither
13
- * one names still reaches the reader. The single deliberate exception is a
9
+ * **Completeness invariant.** A record reaching any renderer — detail view or
10
+ * list row — is rendered whole: every upstream field appears, and no value is
11
+ * cut mid-string. A hand-built header may curate presentation, but a detail
12
+ * header ends in `renderDetailRest`, a list row ends in `withRowRest`, and a
13
+ * curated single-line row ends in `withUnnamedFields` — so a field none of them
14
+ * names still reaches the reader. A collection a curated line renders lossily
15
+ * (its latest entry only, or only some of each entry's fields) is deliberately
16
+ * left out of the row's named set, so the fall-through carries it whole. The
17
+ * single deliberate exception is a
14
18
  * `{count, url}` sub-resource reference, rendered as "N available": the URL is
15
19
  * the upstream REST endpoint, and the tool's own operation is the callable path
16
20
  * to those rows. Caps belong to pagination, which has a continuation path
@@ -1 +1 @@
1
- {"version":3,"file":"format-helpers.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/format-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,KAAK,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAohDhD,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,CAUxE;AAqCD,2DAA2D;AAC3D,eAAO,MAAM,eAAe,WAlEhB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,EAkEkB,CAAC;AAkCpE,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,WArGlB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,EAqGuB,CAAC;AAEzE,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,CAoB1E;AAWD,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,CAkB7E;AAED,kDAAkD;AAClD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,S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