@cyanheads/secedgar-mcp-server 0.15.6 → 0.15.8

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 (103) hide show
  1. package/AGENTS.md +35 -23
  2. package/CLAUDE.md +35 -23
  3. package/README.md +112 -159
  4. package/changelog/0.15.x/0.15.7.md +36 -0
  5. package/changelog/0.15.x/0.15.8.md +29 -0
  6. package/changelog/template.md +7 -7
  7. package/dist/config/server-config.d.ts +1 -0
  8. package/dist/config/server-config.d.ts.map +1 -1
  9. package/dist/config/server-config.js +8 -1
  10. package/dist/config/server-config.js.map +1 -1
  11. package/dist/index.js +5 -3
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp-server/resources/definitions/filing-types.resource.js +2 -2
  14. package/dist/mcp-server/resources/definitions/filing-types.resource.js.map +1 -1
  15. package/dist/mcp-server/tools/definitions/company-search.tool.d.ts +8 -1
  16. package/dist/mcp-server/tools/definitions/company-search.tool.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/definitions/company-search.tool.js +39 -34
  18. package/dist/mcp-server/tools/definitions/company-search.tool.js.map +1 -1
  19. package/dist/mcp-server/tools/definitions/compare-companies.tool.d.ts +7 -0
  20. package/dist/mcp-server/tools/definitions/compare-companies.tool.d.ts.map +1 -1
  21. package/dist/mcp-server/tools/definitions/compare-companies.tool.js +8 -0
  22. package/dist/mcp-server/tools/definitions/compare-companies.tool.js.map +1 -1
  23. package/dist/mcp-server/tools/definitions/dataframe-query.tool.d.ts +31 -2
  24. package/dist/mcp-server/tools/definitions/dataframe-query.tool.d.ts.map +1 -1
  25. package/dist/mcp-server/tools/definitions/dataframe-query.tool.js +53 -5
  26. package/dist/mcp-server/tools/definitions/dataframe-query.tool.js.map +1 -1
  27. package/dist/mcp-server/tools/definitions/fetch-frames.tool.d.ts +7 -0
  28. package/dist/mcp-server/tools/definitions/fetch-frames.tool.d.ts.map +1 -1
  29. package/dist/mcp-server/tools/definitions/fetch-frames.tool.js +8 -0
  30. package/dist/mcp-server/tools/definitions/fetch-frames.tool.js.map +1 -1
  31. package/dist/mcp-server/tools/definitions/find-holders.tool.d.ts +7 -0
  32. package/dist/mcp-server/tools/definitions/find-holders.tool.d.ts.map +1 -1
  33. package/dist/mcp-server/tools/definitions/find-holders.tool.js +9 -1
  34. package/dist/mcp-server/tools/definitions/find-holders.tool.js.map +1 -1
  35. package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.d.ts +7 -0
  36. package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.d.ts.map +1 -1
  37. package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.js +9 -1
  38. package/dist/mcp-server/tools/definitions/get-beneficial-owners.tool.js.map +1 -1
  39. package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts +7 -0
  40. package/dist/mcp-server/tools/definitions/get-filing.tool.d.ts.map +1 -1
  41. package/dist/mcp-server/tools/definitions/get-filing.tool.js +24 -11
  42. package/dist/mcp-server/tools/definitions/get-filing.tool.js.map +1 -1
  43. package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts +7 -0
  44. package/dist/mcp-server/tools/definitions/get-financials.tool.d.ts.map +1 -1
  45. package/dist/mcp-server/tools/definitions/get-financials.tool.js +10 -0
  46. package/dist/mcp-server/tools/definitions/get-financials.tool.js.map +1 -1
  47. package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.d.ts +8 -1
  48. package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.d.ts.map +1 -1
  49. package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.js +9 -1
  50. package/dist/mcp-server/tools/definitions/get-fund-holdings.tool.js.map +1 -1
  51. package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.d.ts +14 -4
  52. package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.d.ts.map +1 -1
  53. package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.js +167 -34
  54. package/dist/mcp-server/tools/definitions/get-insider-transactions.tool.js.map +1 -1
  55. package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.d.ts +11 -4
  56. package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.d.ts.map +1 -1
  57. package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.js +113 -55
  58. package/dist/mcp-server/tools/definitions/get-institutional-holdings.tool.js.map +1 -1
  59. package/dist/mcp-server/tools/definitions/get-material-events.tool.d.ts +7 -0
  60. package/dist/mcp-server/tools/definitions/get-material-events.tool.d.ts.map +1 -1
  61. package/dist/mcp-server/tools/definitions/get-material-events.tool.js +47 -33
  62. package/dist/mcp-server/tools/definitions/get-material-events.tool.js.map +1 -1
  63. package/dist/mcp-server/tools/definitions/get-snapshot.tool.d.ts +7 -0
  64. package/dist/mcp-server/tools/definitions/get-snapshot.tool.d.ts.map +1 -1
  65. package/dist/mcp-server/tools/definitions/get-snapshot.tool.js +10 -0
  66. package/dist/mcp-server/tools/definitions/get-snapshot.tool.js.map +1 -1
  67. package/dist/mcp-server/tools/definitions/index.d.ts +141 -15
  68. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  69. package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts +14 -4
  70. package/dist/mcp-server/tools/definitions/search-filings.tool.d.ts.map +1 -1
  71. package/dist/mcp-server/tools/definitions/search-filings.tool.js +49 -38
  72. package/dist/mcp-server/tools/definitions/search-filings.tool.js.map +1 -1
  73. package/dist/services/canvas-bridge/canvas-bridge.d.ts +4 -1
  74. package/dist/services/canvas-bridge/canvas-bridge.d.ts.map +1 -1
  75. package/dist/services/canvas-bridge/canvas-bridge.js +4 -1
  76. package/dist/services/canvas-bridge/canvas-bridge.js.map +1 -1
  77. package/dist/services/edgar/edgar-api-service.d.ts +82 -51
  78. package/dist/services/edgar/edgar-api-service.d.ts.map +1 -1
  79. package/dist/services/edgar/edgar-api-service.js +332 -167
  80. package/dist/services/edgar/edgar-api-service.js.map +1 -1
  81. package/dist/services/edgar/filing-headers.d.ts +37 -9
  82. package/dist/services/edgar/filing-headers.d.ts.map +1 -1
  83. package/dist/services/edgar/filing-headers.js +40 -11
  84. package/dist/services/edgar/filing-headers.js.map +1 -1
  85. package/dist/services/edgar/filing-to-text.d.ts.map +1 -1
  86. package/dist/services/edgar/filing-to-text.js +24 -2
  87. package/dist/services/edgar/filing-to-text.js.map +1 -1
  88. package/dist/services/edgar/mirror/tickers-sync.d.ts +4 -2
  89. package/dist/services/edgar/mirror/tickers-sync.d.ts.map +1 -1
  90. package/dist/services/edgar/mirror/tickers-sync.js +4 -2
  91. package/dist/services/edgar/mirror/tickers-sync.js.map +1 -1
  92. package/dist/services/edgar/mirror/types.d.ts +6 -2
  93. package/dist/services/edgar/mirror/types.d.ts.map +1 -1
  94. package/dist/services/edgar/ownership-parser.d.ts +16 -0
  95. package/dist/services/edgar/ownership-parser.d.ts.map +1 -1
  96. package/dist/services/edgar/ownership-parser.js +19 -0
  97. package/dist/services/edgar/ownership-parser.js.map +1 -1
  98. package/dist/services/edgar/submissions-archive.d.ts +78 -0
  99. package/dist/services/edgar/submissions-archive.d.ts.map +1 -0
  100. package/dist/services/edgar/submissions-archive.js +87 -0
  101. package/dist/services/edgar/submissions-archive.js.map +1 -0
  102. package/package.json +7 -7
  103. package/server.json +17 -3
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @fileoverview Fetch 13F-HR quarterly institutional holdings by parsing the SEC EDGAR
3
- * information table XML. Institution lookup only — `ticker_or_cik` is the 13F filer.
3
+ * information table XML. Institution lookup only — `company` is the 13F filer.
4
4
  * The reverse direction (which institutions hold an issuer) is secedgar_find_holders,
5
5
  * which searches the information tables by CUSIP and returns filer CIKs to feed back
6
6
  * into this tool (#81).
@@ -10,7 +10,8 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
10
10
  import { JsonRpcErrorCode, McpError, validationError } from '@cyanheads/mcp-ts-core/errors';
11
11
  import { dataframeGuidance, getCanvasBridge, toDatasetField, } from '../../../services/canvas-bridge/canvas-bridge.js';
12
12
  import { getEdgarApiService } from '../../../services/edgar/edgar-api-service.js';
13
- import { parseInfoTableXml } from '../../../services/edgar/ownership-parser.js';
13
+ import { parseInfoTableXml, parseThirteenFCoverPage } from '../../../services/edgar/ownership-parser.js';
14
+ import { ARCHIVE_PAGE_SCAN_CAP, SubmissionsArchiveWalk, } from '../../../services/edgar/submissions-archive.js';
14
15
  /**
15
16
  * Map a quarter string like "2025-Q4" to its calendar quarter-end date (YYYY-MM-DD) — the
16
17
  * filing's reporting-period end (`reportDate`) in the SEC submissions API. Returns undefined
@@ -82,37 +83,47 @@ function findInfoTableDocument(items) {
82
83
  * secedgar_get_financials / secedgar_search_filings, not a 13F (#86).
83
84
  */
84
85
  const OPERATING_COMPANY_FORMS = ['10-K', '10-K/A', '10-Q', '10-Q/A', '8-K', '8-K/A'];
86
+ /** The holdings report, and the notice a manager files instead when others report its holdings. */
87
+ const HOLDINGS_REPORT_FORM = '13F-HR';
88
+ const NOTICE_FORMS = new Set(['13F-NT', '13F-NT/A']);
85
89
  /**
86
- * Zip the submissions recent-filings parallel arrays into records for the requested
87
- * form types, in submission order (newest first), capped at `limit`. Inlined here
88
- * rather than via `EdgarApiService.getRecentFilingsByForm` so this tool reads the full
89
- * recent-form list off the same submissions fetch for 404 handling (#76) and
90
- * operating-company classification (#86) — without a shared-method signature change
91
- * that would ripple into the insider-transactions tool.
90
+ * Zip a submissions block (the recent window or an archive page) into its 13F-HR and
91
+ * 13F-NT rows, in block order — newest filed first. Read off the submissions fetch the
92
+ * tool already holds, which also feeds the 404 handling (#76) and the operating-company
93
+ * classification (#86).
92
94
  */
93
- function recentFilingsOfForm(recent, formTypes, limit) {
95
+ function thirteenFRows(block) {
94
96
  const out = [];
95
- for (let i = 0; i < recent.form.length && out.length < limit; i++) {
96
- if (formTypes.includes(recent.form[i] ?? '')) {
97
- out.push({
98
- accessionNumber: recent.accessionNumber[i] ?? '',
99
- filingDate: recent.filingDate[i] ?? '',
100
- primaryDocument: recent.primaryDocument[i] ?? '',
101
- reportDate: recent.reportDate[i] ?? '',
102
- });
103
- }
97
+ for (let i = 0; i < block.form.length; i++) {
98
+ const form = block.form[i] ?? '';
99
+ if (form !== HOLDINGS_REPORT_FORM && !NOTICE_FORMS.has(form))
100
+ continue;
101
+ out.push({
102
+ accessionNumber: block.accessionNumber[i] ?? '',
103
+ filingDate: block.filingDate[i] ?? '',
104
+ form,
105
+ reportDate: block.reportDate[i] ?? '',
106
+ });
104
107
  }
105
108
  return out;
106
109
  }
110
+ /** The newest-filed 13F-HR and 13F-NT for one period among `rows`. */
111
+ function forPeriod(rows, periodEnd) {
112
+ const inPeriod = rows.filter((r) => r.reportDate === periodEnd);
113
+ return {
114
+ report: inPeriod.find((r) => r.form === HOLDINGS_REPORT_FORM),
115
+ notice: inPeriod.find((r) => NOTICE_FORMS.has(r.form)),
116
+ };
117
+ }
107
118
  export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_holdings', {
108
119
  title: 'Get Institutional Holdings',
109
- description: 'Fetch 13F-HR quarterly institutional holdings by parsing the SEC EDGAR information table XML. ticker_or_cik is the institutional filer — its 10-digit CIK (e.g. 0000102909), or an entity name resolved through EDGAR entity search — and the tool returns what that institution holds. A name that matches several EDGAR filers (some legal names are shared across entities) returns those candidates so you can retry with the exact CIK, rather than guessing. For the reverse direction — which institutions hold a given portfolio company — use secedgar_find_holders, whose filer_cik results feed straight back into this tool. The 13F information table lists each position: issuer name, CUSIP, shares held, market value (in whole USD), and put/call designation for options. Sub-lines for the same security are consolidated into distinct positions sorted by value by default (set consolidate=false for raw filing rows). The inline holdings list is one page of limit rows starting at offset — pass the returned next_offset to walk further down a large information table. The full parsed holdings set is also materialized as df_<id> when a canvas is available — inspect it with secedgar_dataframe_describe, then query it with secedgar_dataframe_query to aggregate the whole filing or self-join across quarters on cusip + reporting_period. Institutions with less than $100M in 13(f) securities are exempt and may not file. Use secedgar_search_filings with forms=["13F-HR"] for broader search.',
120
+ description: 'Fetch 13F-HR quarterly institutional holdings by parsing the SEC EDGAR information table XML. company is the institutional filer — its 10-digit CIK (e.g. 0000102909), a ticker, or an entity name (names outside EDGAR\'s ticker file resolve through EDGAR entity search) — and the tool returns what that institution holds. A name that matches several EDGAR filers (some legal names are shared across entities) returns those candidates so you can retry with the exact CIK, rather than guessing. For the reverse direction — which institutions hold a given portfolio company — use secedgar_find_holders, whose filer_cik results feed straight back into this tool. The 13F information table lists each position: issuer name, CUSIP, shares held, market value (in whole USD), and put/call designation for options. Sub-lines for the same security are consolidated into distinct positions sorted by value by default (set consolidate=false for raw filing rows). The inline holdings list is one page of limit rows starting at offset — pass the returned next_offset to walk further down a large information table. The full parsed holdings set is also materialized as df_<id> when a canvas is available — inspect it with secedgar_dataframe_describe, then query it with secedgar_dataframe_query to aggregate the whole filing or self-join across quarters on cusip + reporting_period. Institutions with less than $100M in 13(f) securities are exempt and may not file. Use secedgar_search_filings with forms=["13F-HR"] for broader search.',
110
121
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
111
122
  errors: [
112
123
  {
113
124
  reason: 'company_not_found',
114
125
  code: JsonRpcErrorCode.NotFound,
115
- when: 'The ticker or CIK does not resolve to a known company or institution',
126
+ when: 'The company input does not resolve to a known company or institution',
116
127
  recovery: 'Use secedgar_company_search to find the correct CIK or full entity name.',
117
128
  },
118
129
  {
@@ -124,7 +135,7 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
124
135
  {
125
136
  reason: 'no_filings_found',
126
137
  code: JsonRpcErrorCode.NotFound,
127
- when: 'No 13F-HR filings found for this entity in the recent submissions window',
138
+ when: 'No 13F-HR matches — the entity files none, none exists for the requested quarter in the recent submissions window or the archive pages searched, or the manager filed a 13F-NT notice instead (for the requested quarter, or as its only recent 13F filing when no quarter is given)',
128
139
  recovery: 'Use secedgar_search_filings with forms=["13F-HR"] for broader search, or check that the entity is an institutional investment manager.',
129
140
  },
130
141
  {
@@ -133,16 +144,24 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
133
144
  when: 'The 13F-HR filing was found but the information table XML document could not be located',
134
145
  recovery: 'Use secedgar_get_filing with the accession number to inspect the filing documents directly.',
135
146
  },
147
+ {
148
+ reason: 'rate_limited',
149
+ code: JsonRpcErrorCode.RateLimited,
150
+ when: "SEC is rate-limiting this server's IP — SEC answered 429, or the call was refused without being sent while the cool-down after one runs",
151
+ recovery: 'Wait the retryAfter seconds the error carries, then retry — SEC lifts the block only once requests stop for ten minutes.',
152
+ retryable: true,
153
+ thrownBy: 'service',
154
+ },
136
155
  ],
137
156
  input: z.object({
138
- ticker_or_cik: z
157
+ company: z
139
158
  .string()
140
159
  .min(1)
141
- .describe('The institutional filer whose 13F to fetch — a 10-digit CIK (e.g. "0000102909" for VANGUARD GROUP INC, the most reliable form) or an entity name. Names resolve through EDGAR entity search, which covers institutional managers absent from the ticker file; a name matching several filers (some legal names are shared across entities) returns those candidates so you can retry with the exact CIK. This is NOT the portfolio company — passing an issuer ticker like "AAPL" finds that operating company\'s own filings (it files no 13F), not who holds it; use secedgar_find_holders for that direction.'),
160
+ .describe('The institutional filer whose 13F to fetch — a 10-digit CIK (e.g. "0000102909" for VANGUARD GROUP INC, the most reliable form), a ticker, or an entity name. A name is matched against the registrants in EDGAR\'s ticker file first (current and former names) and, when none match, resolved through EDGAR entity search, which covers institutional managers absent from that file; a name matching several filers (some legal names are shared across entities) returns those candidates so you can retry with the exact CIK. This is NOT the portfolio company — passing an issuer ticker like "AAPL" finds that operating company\'s own filings (it files no 13F), not who holds it; use secedgar_find_holders for that direction.'),
142
161
  quarter: z
143
162
  .string()
144
163
  .optional()
145
- .describe('Reporting quarter to target, in "YYYY-QN" format (e.g., "2025-Q4"). When omitted, returns the most recent 13F-HR available. Quarters map to the filing window: Q4 2025 = filings submitted roughly Jan–Mar 2026.'),
164
+ .describe('Reporting quarter to target, in "YYYY-QN" format (e.g., "2025-Q4"), matched exactly against each 13F-HR\'s period of report. When omitted, returns the most recent 13F-HR in the submissions feed\'s recent window (the last year or 1,000 filings, whichever holds more). Quarters map to the filing window: Q4 2025 = filings submitted roughly Jan–Mar 2026. A quarter older than the recent window is looked up in the archive, reading forward from the quarter end up to 10 archive pages. A quarter the manager covered with a 13F-NT notice (holdings reported by other managers) fails naming that notice.'),
146
165
  limit: z
147
166
  .number()
148
167
  .int()
@@ -161,6 +180,8 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
161
180
  .default(true)
162
181
  .describe('When true (default), info-table sub-lines for the same security (CUSIP + class + put/call) are summed into one position and results are sorted by market value descending, so `limit` returns the largest distinct holdings. Set false to return raw information-table rows in filing order (one per investment-discretion/manager sub-line), preserving investment_discretion.'),
163
182
  }),
183
+ // Other tools' spellings of the company parameter, and this tool's former one (#115).
184
+ inputAliases: { ticker: 'company', cik: 'company', ticker_or_cik: 'company' },
164
185
  output: z.object({
165
186
  filer_name: z.string().describe('Name of the institutional filer (the 13F submitter).'),
166
187
  filer_cik: z.string().describe('CIK of the 13F filer, zero-padded to 10 digits.'),
@@ -251,10 +272,10 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
251
272
  // institutional managers, trusts, individuals — that company_tickers.json can never
252
273
  // contain (#73). Both paths normalize to a candidate list so ambiguity is handled
253
274
  // uniformly and index 0 is never taken silently.
254
- const resolved = await api.resolveCik(input.ticker_or_cik);
275
+ const resolved = await api.resolveCik(input.company);
255
276
  const candidates = Array.isArray(resolved)
256
277
  ? resolved.length === 0
257
- ? (await api.resolveEntityByName(input.ticker_or_cik)).map((m) => ({
278
+ ? (await api.resolveEntityByName(input.company)).map((m) => ({
258
279
  cik: m.cik,
259
280
  name: m.name,
260
281
  ticker: undefined,
@@ -267,14 +288,14 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
267
288
  if (candidates.length > 1) {
268
289
  const shown = candidates.slice(0, 10);
269
290
  const list = shown.map((c) => `${c.cik}${c.name ? ` (${c.name})` : ''}`).join(', ');
270
- throw ctx.fail('ambiguous_entity', `'${input.ticker_or_cik}' matches multiple EDGAR entities: ${list}. Retry with the exact 10-digit CIK.`, {
291
+ throw ctx.fail('ambiguous_entity', `'${input.company}' matches multiple EDGAR entities: ${list}. Retry with the exact 10-digit CIK.`, {
271
292
  ...ctx.recoveryFor('ambiguous_entity'),
272
293
  matches: shown.map((c) => ({ cik: c.cik, name: c.name, ticker: c.ticker })),
273
294
  });
274
295
  }
275
296
  const [match] = candidates;
276
297
  if (!match) {
277
- throw ctx.fail('company_not_found', `Entity '${input.ticker_or_cik}' not found.`, {
298
+ throw ctx.fail('company_not_found', `Entity '${input.company}' not found.`, {
278
299
  ...ctx.recoveryFor('company_not_found'),
279
300
  });
280
301
  }
@@ -308,13 +329,59 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
308
329
  // Each 13F-HR carries a reportDate (the period-end), so a requested quarter is
309
330
  // matched exactly. No quarter → most-recent; with a quarter, a miss is reported,
310
331
  // never silently the latest filing.
311
- const recentFilings = recentFilingsOfForm(submissions.filings.recent, ['13F-HR'], 80);
312
- const filingMeta = periodEnd
313
- ? recentFilings.find((f) => f.reportDate === periodEnd)
314
- : recentFilings[0];
332
+ const recentRows = thirteenFRows(submissions.filings.recent);
333
+ // A 13F-HR or a notice either one marks a 13F manager; only an entity whose rows
334
+ // read hold neither gets the #86 classification below.
335
+ let filesThirteenF = recentRows.length > 0;
336
+ let filingMeta;
337
+ let notice;
338
+ let walk;
339
+ if (!periodEnd) {
340
+ filingMeta = recentRows.find((r) => r.form === HOLDINGS_REPORT_FORM);
341
+ // A manager whose recent filings are notices only: name its newest notice rather
342
+ // than calling it a non-filer (#133).
343
+ if (!filingMeta)
344
+ notice = recentRows.find((r) => NOTICE_FORMS.has(r.form));
345
+ }
346
+ else {
347
+ ({ report: filingMeta, notice } = forPeriod(recentRows, periodEnd));
348
+ // A quarter the recent window does not reach: a 13F-HR is filed after its period
349
+ // ends, so read the archive forward in time from the page covering the quarter
350
+ // end and stop on the first page holding a report or notice for it (#117, #133).
351
+ // A quarter ending on or after the window's oldest filing selects no page.
352
+ if (!filingMeta && !notice) {
353
+ walk = new SubmissionsArchiveWalk(api, submissions, {
354
+ filedAfter: periodEnd,
355
+ order: 'oldest-first',
356
+ });
357
+ for await (const { block } of walk) {
358
+ const rows = thirteenFRows(block);
359
+ filesThirteenF ||= rows.length > 0;
360
+ ({ report: filingMeta, notice } = forPeriod(rows, periodEnd));
361
+ if (filingMeta || notice)
362
+ break;
363
+ }
364
+ }
365
+ }
315
366
  if (!filingMeta) {
316
- if (recentFilings.length === 0) {
317
- // Entity files no 13F-HR at all. Classify from the recent-form list (#86): an
367
+ if (notice) {
368
+ // The manager filed a notice for this quarter — or, asked for no quarter, files
369
+ // only notices: another manager's 13F-HR carries its holdings, so there is no
370
+ // information table here to read (#133).
371
+ const scope = input.quarter
372
+ ? `for quarter "${input.quarter}"`
373
+ : 'in its recent submissions window';
374
+ throw ctx.fail('no_filings_found', `No 13F-HR filed by '${input.company}' (${submissions.name}) ${scope} — it filed a ${notice.form} notice (accession ${notice.accessionNumber}, period ${notice.reportDate}, filed ${notice.filingDate}) instead: its holdings for that quarter are reported by other managers in their own 13F-HR filings.`, {
375
+ recovery: {
376
+ hint: `Read notice ${notice.accessionNumber} with secedgar_get_filing — its cover page lists the managers reporting these holdings — then call this tool with one of those managers' CIKs.`,
377
+ },
378
+ notice_accession_number: notice.accessionNumber,
379
+ notice_form: notice.form,
380
+ notice_period: notice.reportDate,
381
+ });
382
+ }
383
+ if (!filesThirteenF) {
384
+ // Entity files no 13F-HR or notice at all. Classify from the recent-form list (#86): an
318
385
  // entity filing 10-K/10-Q/8-K is an operating company, not an institutional
319
386
  // manager — route the caller to the tools that fit. Use the submissions identity
320
387
  // so it works for CIKs absent from the ticker cache too.
@@ -322,9 +389,9 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
322
389
  const operatingForms = OPERATING_COMPANY_FORMS.filter((f) => recentForms.has(f));
323
390
  if (operatingForms.length > 0) {
324
391
  const tickerSuffix = submissions.tickers[0] ? ` (${submissions.tickers[0]})` : '';
325
- throw ctx.fail('no_filings_found', `No 13F-HR filings found for '${input.ticker_or_cik}' — resolves to ${submissions.name}${tickerSuffix}, an operating company (files ${operatingForms.join(', ')}), not an institutional investment manager. To find which managers hold it, use secedgar_find_holders; for financials use secedgar_get_financials.`, {
392
+ throw ctx.fail('no_filings_found', `No 13F-HR filings found for '${input.company}' — resolves to ${submissions.name}${tickerSuffix}, an operating company (files ${operatingForms.join(', ')}), not an institutional investment manager. To find which managers hold it, use secedgar_find_holders; for financials use secedgar_get_financials.`, {
326
393
  recovery: {
327
- hint: `${submissions.name} is an operating company, not a 13F filer. Use secedgar_find_holders with issuer "${input.ticker_or_cik}" to list its institutional holders.`,
394
+ hint: `${submissions.name} is an operating company, not a 13F filer. Use secedgar_find_holders with issuer "${input.company}" to list its institutional holders.`,
328
395
  },
329
396
  resolved_cik: match.cik,
330
397
  resolved_name: submissions.name,
@@ -346,10 +413,13 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
346
413
  }
347
414
  // No operating-company signal (e.g. a filing agent or an unusual filer) — a true
348
415
  // unknown, so keep the generic recovery.
349
- throw ctx.fail('no_filings_found', `No 13F-HR filings found for '${input.ticker_or_cik}' (resolves to ${submissions.name}). This entity is not a 13F institutional filer.`, { ...ctx.recoveryFor('no_filings_found') });
416
+ throw ctx.fail('no_filings_found', `No 13F-HR filings found for '${input.company}' (resolves to ${submissions.name}). This entity is not a 13F institutional filer.`, { ...ctx.recoveryFor('no_filings_found') });
350
417
  }
351
418
  // 13F filings exist, but none for the requested quarter (#31) — a real 13F filer.
352
- throw ctx.fail('no_filings_found', `No 13F-HR filings found for '${input.ticker_or_cik}' for quarter "${input.quarter}".`, { ...ctx.recoveryFor('no_filings_found') });
419
+ const searched = walk && walk.pagesRead > 0
420
+ ? ` Searched the recent submissions window and ${walk.pagesRead} archive page${walk.pagesRead === 1 ? '' : 's'} filed from ${walk.scannedThrough} forward${walk.truncated ? `; the ${ARCHIVE_PAGE_SCAN_CAP}-page cap stopped the search before later pages` : ''}.`
421
+ : '';
422
+ throw ctx.fail('no_filings_found', `No 13F-HR filings found for '${input.company}' for quarter "${input.quarter}".${searched}`, { ...ctx.recoveryFor('no_filings_found') });
353
423
  }
354
424
  // Get the filing index to find the information table document
355
425
  const filingIndex = await api.tryGetFilingIndex(match.cik, filingMeta.accessionNumber);
@@ -371,22 +441,10 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
371
441
  // Pull reporting period and filing-manager name from the primary_doc.xml cover page.
372
442
  // The CIK resolver only knows names for ticker-listed entities, but most 13F filers
373
443
  // are investment managers that aren't listed — the cover page is the reliable source.
374
- let reportingPeriod;
375
- let filerName;
376
444
  const primaryXml = await api.tryGetFilingDocument(match.cik, filingMeta.accessionNumber, 'primary_doc.xml');
377
- if (primaryXml) {
378
- // <periodOfReport>12-31-2025</periodOfReport> or <reportCalendarOrQuarter>12-31-2025</reportCalendarOrQuarter>
379
- const periodMatch = primaryXml.match(/<periodOfReport>(\d{2}-\d{2}-\d{4})<\/periodOfReport>/) ??
380
- primaryXml.match(/<reportCalendarOrQuarter>(\d{2}-\d{2}-\d{4})<\/reportCalendarOrQuarter>/);
381
- if (periodMatch?.[1]) {
382
- // Convert MM-DD-YYYY to YYYY-MM-DD
383
- const [mm, dd, yyyy] = periodMatch[1].split('-');
384
- reportingPeriod = `${yyyy}-${mm}-${dd}`;
385
- }
386
- const nameMatch = primaryXml.match(/<(?:\w+:)?filingManager>[\s\S]*?<(?:\w+:)?name>([^<]+)<\/(?:\w+:)?name>/i);
387
- if (nameMatch?.[1])
388
- filerName = nameMatch[1].trim();
389
- }
445
+ const { filerName, reportingPeriod } = primaryXml
446
+ ? parseThirteenFCoverPage(primaryXml)
447
+ : { filerName: undefined, reportingPeriod: undefined };
390
448
  let parsed;
391
449
  try {
392
450
  parsed = parseInfoTableXml(xmlText);
@@ -437,7 +495,7 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
437
495
  })),
438
496
  sourceTool: 'secedgar_get_institutional_holdings',
439
497
  queryParams: {
440
- ticker_or_cik: input.ticker_or_cik,
498
+ company: input.company,
441
499
  cik: match.cik,
442
500
  quarter: input.quarter,
443
501
  consolidate: input.consolidate,
@@ -485,7 +543,7 @@ export const getInstitutionalHoldingsTool = tool('secedgar_get_institutional_hol
485
543
  datasetName: dataset?.name,
486
544
  });
487
545
  return {
488
- filer_name: filerName ?? match.name ?? input.ticker_or_cik,
546
+ filer_name: filerName ?? match.name ?? input.company,
489
547
  filer_cik: match.cik,
490
548
  reporting_period: reportingPeriod,
491
549
  filing_date: filingMeta.filingDate,
@@ -1 +1 @@
1
- {"version":3,"file":"get-institutional-holdings.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-institutional-holdings.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAGzE;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAA2B;IACjD,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC/C,IAAI,CAAC,CAAC;QAAE,OAAO;IACf,0CAA0C;IAC1C,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,OAAO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GACR,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;gBAC/C,CAAC,CAAC,cAAc,MAAM,CAAC,QAAQ,CAAC,MAAM,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,8CAA8C;gBACnH,CAAC,CAAC,EAAE,CAAC;YACT,KAAK,CAAC,IAAI,CACR,cAAc,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,SAAS,kBAAkB,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,yCAAyC,CAC3J,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"get-institutional-holdings.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-institutional-holdings.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yCAAyC,CAAC;AAGjD;;;;GAIG;AACH,SAAS,cAAc,CAAC,OAA2B;IACjD,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC/C,IAAI,CAA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AG,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,IAAI,GACR,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;gBAC/C,CAAC,CAAC,cAAc,MAAM,CAAC,QAAQ,CAAC,MAAM,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,8CAA8C;gBACnH,CAAC,CAAC,EAAE,CAAC;YACT,KAAK,CAAC,IAAI,CACR,cAAc,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,SAAS,kBAAkB,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,yCAAyC,CAC3J,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -54,6 +54,13 @@ export declare const getMaterialEventsTool: import("@cyanheads/mcp-ts-core").Too
54
54
  readonly code: JsonRpcErrorCode.NotFound;
55
55
  readonly when: "The query is ambiguous and matches several companies";
56
56
  readonly recovery: "Retry with a ticker symbol or the 10-digit CIK from the matches list.";
57
+ }, {
58
+ readonly reason: "rate_limited";
59
+ readonly code: JsonRpcErrorCode.RateLimited;
60
+ readonly when: "SEC is rate-limiting this server's IP — SEC answered 429, or the call was refused without being sent while the cool-down after one runs";
61
+ readonly recovery: "Wait the retryAfter seconds the error carries, then retry — SEC lifts the block only once requests stop for ten minutes.";
62
+ readonly retryable: true;
63
+ readonly thrownBy: "service";
57
64
  }], {
58
65
  readonly notice: z.ZodOptional<z.ZodString>;
59
66
  readonly truncated: z.ZodOptional<z.ZodBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"get-material-events.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-material-events.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAmE3E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2ZhC,CAAC"}
1
+ {"version":3,"file":"get-material-events.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-material-events.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAwD3E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmbhC,CAAC"}
@@ -7,15 +7,9 @@
7
7
  import { tool, z } from '@cyanheads/mcp-ts-core';
8
8
  import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
9
9
  import { dataframeGuidance, getCanvasBridge, toDatasetField, } from '../../../services/canvas-bridge/canvas-bridge.js';
10
- import { getEdgarApiService, selectArchivePages, suggestCompanies, } from '../../../services/edgar/edgar-api-service.js';
10
+ import { getEdgarApiService, suggestCompanies } from '../../../services/edgar/edgar-api-service.js';
11
11
  import { decodeEightKItem, EIGHT_K_ITEM_CODES, EIGHT_K_RENUMBERING_DATE, parseEightKItems, } from '../../../services/edgar/eight-k-items.js';
12
- /**
13
- * Cap on submissions archive pages fetched in one call — bounds latency and the
14
- * rate-limited request budget. Mirrors the same constant in company-search and
15
- * search-filings; hitting it sets `dataset.truncated` and is disclosed by
16
- * `history_scanned_through`.
17
- */
18
- const ARCHIVE_PAGE_SCAN_CAP = 10;
12
+ import { SubmissionsArchiveWalk } from '../../../services/edgar/submissions-archive.js';
19
13
  /** True for 8-K and its amendments (8-K/A), excluding the 8-K12B-family registration forms. */
20
14
  function isMaterialEventForm(form) {
21
15
  const upper = form.toUpperCase();
@@ -44,7 +38,7 @@ function zipEightKs(block) {
44
38
  }
45
39
  export const getMaterialEventsTool = tool('secedgar_get_material_events', {
46
40
  title: 'Get Material Events',
47
- description: "Retrieve a company's 8-K filings with their item codes decoded, optionally filtered to specific items. 8-K item codes are how material events are actually scoped — 1.01 material agreements, 2.02 results of operations, 4.02 non-reliance on previously issued financials, 5.02 officer and director departures — and filtering by them is narrower than any form-level filter in secedgar_search_filings or secedgar_company_search, neither of which can see items. Each row carries the accession number and primary document for secedgar_get_filing; press releases usually ride as EX-99 exhibits rather than in the primary document. Two numbering regimes exist: filings from 2004-08-23 onward use the x.xx codes, earlier ones use single integers (12 was the old results-of-operations item, 9 the old Regulation FD item), and both are accepted as filters and decoded in the response. A date window reaches filings older than the recent submissions window by paging into the archive. The full filtered set is materialized as df_<id> for item-distribution analysis over time — inspect it with secedgar_dataframe_describe, then analyze it with secedgar_dataframe_query.",
41
+ description: "Retrieve a company's 8-K filings with their item codes decoded, optionally filtered to specific items. 8-K item codes are how material events are actually scoped — 1.01 material agreements, 2.02 results of operations, 4.02 non-reliance on previously issued financials, 5.02 officer and director departures — and filtering by them is narrower than any form-level filter in secedgar_search_filings or secedgar_company_search, neither of which can see items. Each row carries the accession number and primary document for secedgar_get_filing; press releases usually ride as EX-99 exhibits rather than in the primary document. Two numbering regimes exist: filings from 2004-08-23 onward use the x.xx codes, earlier ones use single integers (12 was the old results-of-operations item, 9 the old Regulation FD item), and both are accepted as filters and decoded in the response. A date window reaches filings older than the recent submissions window by reading every archive page it overlaps, up to 10; without one, the scan reads back only as far as it needs to fill limit. Every scanned filing that passes the filter is materialized as df_<id> for item-distribution analysis over time (pass a date window to cover a longer span) — inspect it with secedgar_dataframe_describe, then analyze it with secedgar_dataframe_query.",
48
42
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
49
43
  errors: [
50
44
  {
@@ -59,6 +53,14 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
59
53
  when: 'The query is ambiguous and matches several companies',
60
54
  recovery: 'Retry with a ticker symbol or the 10-digit CIK from the matches list.',
61
55
  },
56
+ {
57
+ reason: 'rate_limited',
58
+ code: JsonRpcErrorCode.RateLimited,
59
+ when: "SEC is rate-limiting this server's IP — SEC answered 429, or the call was refused without being sent while the cool-down after one runs",
60
+ recovery: 'Wait the retryAfter seconds the error carries, then retry — SEC lifts the block only once requests stop for ten minutes.',
61
+ retryable: true,
62
+ thrownBy: 'service',
63
+ },
62
64
  ],
63
65
  input: z.object({
64
66
  company: z
@@ -80,7 +82,7 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
80
82
  .describe('YYYY-MM-DD'),
81
83
  ])
82
84
  .optional()
83
- .describe('Only include filings filed on or after this date (YYYY-MM-DD). A date filter routes the scan into the older submissions archive pages, so it reaches 8-K filings that predate the ~1000-filing recent window.'),
85
+ .describe('Only include filings filed on or after this date (YYYY-MM-DD). A date filter routes the scan into the older submissions archive pages, so it reaches 8-K filings that predate the recent window (the last year or 1,000 filings of every form, whichever holds more).'),
84
86
  filed_before: z
85
87
  .union([
86
88
  z.literal(''),
@@ -97,8 +99,18 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
97
99
  .min(1)
98
100
  .max(100)
99
101
  .default(20)
100
- .describe('Filings returned inline, newest first. The full filtered set is materialized as a dataframe when it exceeds this and a canvas is available. Default 20.'),
102
+ .describe('Filings returned inline, newest first. Every scanned filing that passes the filter is materialized as a dataframe when there are more than this and a canvas is available. Default 20.'),
101
103
  }),
104
+ // Other spellings of the company and filing-date parameters in use across tools (#115).
105
+ inputAliases: {
106
+ ticker: 'company',
107
+ cik: 'company',
108
+ ticker_or_cik: 'company',
109
+ start_date: 'filed_after',
110
+ date_from: 'filed_after',
111
+ end_date: 'filed_before',
112
+ date_to: 'filed_before',
113
+ },
102
114
  output: z.object({
103
115
  cik: z
104
116
  .string()
@@ -120,7 +132,7 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
120
132
  history_scanned_through: z
121
133
  .string()
122
134
  .optional()
123
- .describe('Oldest filing date reached by the scan (YYYY-MM-DD). Older filings were not examined: the recent window caps at ~1000 filings, and archive pages are fetched only when a date filter or an under-filled result requires them. Absent when no filings were scanned.'),
135
+ .describe('Oldest filing date reached by the scan (YYYY-MM-DD). Older filings were not examined: the recent window holds the last year or 1,000 filings of every form, whichever is more, and archive pages are read only for a date filter (every page overlapping it, up to 10) or to fill limit (stopping on the page that fills it). Absent when no filings were scanned.'),
124
136
  filings: z
125
137
  .array(z
126
138
  .object({
@@ -168,10 +180,10 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
168
180
  expires_at: z.string().describe('ISO 8601 expiry timestamp.'),
169
181
  truncated: z
170
182
  .boolean()
171
- .describe('True when the archive scan hit its page cap before exhausting the history — older matching filings exist beyond the dataframe.'),
183
+ .describe('True when archive pages in range went unread — the 10-page cap ended the scan, or an undated call stopped once limit was filled, which is before any archive page when the recent window alone fills it — so older matching filings may exist beyond the dataframe. Pass filed_after / filed_before to reach them.'),
172
184
  })
173
185
  .optional()
174
- .describe("Canvas dataframe holding the full filtered 8-K set. Item codes ride as a comma-separated `item_codes` column, so item-frequency-over-time queries split it (`unnest(string_split(item_codes, ','))`). Absent when the result fits inline, canvas is unavailable, or materialization failed."),
186
+ .describe("Canvas dataframe holding every scanned 8-K that passes the filter. Item codes ride as a comma-separated `item_codes` column, so item-frequency-over-time queries split it (`unnest(string_split(item_codes, ','))`). Absent when the result fits inline, canvas is unavailable, or materialization failed."),
175
187
  }),
176
188
  enrichment: {
177
189
  notice: z
@@ -235,27 +247,31 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
235
247
  const itemsFilter = input.items?.length ? input.items : undefined;
236
248
  const inWindow = (row) => (!filedAfter || row.filing_date >= filedAfter) &&
237
249
  (!filedBefore || row.filing_date <= filedBefore);
250
+ const passesItems = (row) => !itemsFilter || row.item_codes.some((code) => itemsFilter.includes(code));
238
251
  const scanned = zipEightKs(submissions.filings.recent).filter(inWindow);
239
- // Oldest date scanned so far — the recent window's tail (newest-first, so last).
240
- let historyScannedThrough = submissions.filings.recent.filingDate.at(-1);
241
252
  // Page into the older archive when the caller targets a date range that may
242
253
  // predate the recent window, or when that window under-fills the inline list.
243
- const files = submissions.filings.files;
244
- const underFill = scanned.length < input.limit;
245
- let archiveTruncated = false;
246
- if (files.length > 0 && (hasDateFilter || underFill)) {
247
- const pages = selectArchivePages(files, filedAfter, filedBefore);
248
- const pageLimit = Math.min(pages.length, ARCHIVE_PAGE_SCAN_CAP);
249
- archiveTruncated = pages.length > pageLimit;
250
- for (let i = 0; i < pageLimit; i++) {
251
- const page = pages[i];
252
- if (!page)
254
+ // A date window reads every page overlapping it, up to the cap; the under-fill
255
+ // walk stops on the page that fills `limit` with rows passing the items filter,
256
+ // since an undated call asks for the newest `limit` and nothing older (#134).
257
+ const walk = new SubmissionsArchiveWalk(api, submissions, {
258
+ filedAfter,
259
+ filedBefore,
260
+ order: 'newest-first',
261
+ });
262
+ if (hasDateFilter || scanned.length < input.limit) {
263
+ let matchedSoFar = scanned.filter(passesItems).length;
264
+ for await (const { block } of walk) {
265
+ const rows = zipEightKs(block).filter(inWindow);
266
+ scanned.push(...rows);
267
+ matchedSoFar += rows.filter(passesItems).length;
268
+ if (!hasDateFilter && matchedSoFar >= input.limit)
253
269
  break;
254
- const block = await api.fetchArchivePage(page.name);
255
- historyScannedThrough = page.filingFrom;
256
- scanned.push(...zipEightKs(block).filter(inWindow));
257
270
  }
258
271
  }
272
+ // Oldest date reached — the deepest archive page read, else the recent window's tail.
273
+ const historyScannedThrough = walk.scannedThrough ?? submissions.filings.recent.filingDate.at(-1);
274
+ const archiveTruncated = walk.truncated;
259
275
  scanned.sort((a, b) => b.filing_date.localeCompare(a.filing_date));
260
276
  const itemDistribution = {};
261
277
  for (const row of scanned) {
@@ -263,9 +279,7 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
263
279
  itemDistribution[code] = (itemDistribution[code] ?? 0) + 1;
264
280
  }
265
281
  }
266
- const matched = itemsFilter
267
- ? scanned.filter((row) => row.item_codes.some((code) => itemsFilter.includes(code)))
268
- : scanned;
282
+ const matched = scanned.filter(passesItems);
269
283
  let dataset;
270
284
  const bridge = getCanvasBridge();
271
285
  if (bridge && matched.length > input.limit) {
@@ -370,7 +384,7 @@ export const getMaterialEventsTool = tool('secedgar_get_material_events', {
370
384
  }
371
385
  if (result.dataset) {
372
386
  const truncatedNote = result.dataset.truncated
373
- ? ' (truncated — older filings exist beyond the scanned pages)'
387
+ ? ' (truncated — older filings exist beyond the scanned history)'
374
388
  : '';
375
389
  lines.push(`Dataset: ${result.dataset.name} (${result.dataset.row_count} rows, expires ${result.dataset.expires_at})${truncatedNote} — query with secedgar_dataframe_query.`);
376
390
  }