@cyanheads/federal-regulations-mcp-server 0.1.4 → 0.2.0
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 +11 -6
- package/changelog/0.2.x/0.2.0.md +26 -0
- package/dist/mcp-server/resources/definitions/cfr-section.resource.d.ts +4 -0
- package/dist/mcp-server/resources/definitions/cfr-section.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/cfr-section.resource.js +12 -5
- package/dist/mcp-server/resources/definitions/cfr-section.resource.js.map +1 -1
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.d.ts +2 -0
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.js +24 -6
- package/dist/mcp-server/tools/definitions/browse-cfr.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.d.ts +30 -9
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.js +115 -24
- package/dist/mcp-server/tools/definitions/get-cfr-section.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +22 -4
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/services/ecfr/cite.d.ts +23 -0
- package/dist/services/ecfr/cite.d.ts.map +1 -0
- package/dist/services/ecfr/cite.js +29 -0
- package/dist/services/ecfr/cite.js.map +1 -0
- package/dist/services/ecfr/ecfr-service.d.ts +30 -3
- package/dist/services/ecfr/ecfr-service.d.ts.map +1 -1
- package/dist/services/ecfr/ecfr-service.js +99 -10
- package/dist/services/ecfr/ecfr-service.js.map +1 -1
- package/dist/services/ecfr/types.d.ts +64 -0
- package/dist/services/ecfr/types.d.ts.map +1 -1
- package/dist/services/ecfr/xml.d.ts +20 -9
- package/dist/services/ecfr/xml.d.ts.map +1 -1
- package/dist/services/ecfr/xml.js +121 -33
- package/dist/services/ecfr/xml.js.map +1 -1
- package/dist/services/ecfr-mirror/ecfr-mirror.d.ts +24 -3
- package/dist/services/ecfr-mirror/ecfr-mirror.d.ts.map +1 -1
- package/dist/services/ecfr-mirror/ecfr-mirror.js +142 -32
- package/dist/services/ecfr-mirror/ecfr-mirror.js.map +1 -1
- package/package.json +1 -1
- package/scripts/ecfr-mirror-verify.ts +22 -5
- package/server.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** federal-regulations-mcp-server
|
|
4
|
-
**Version:** 0.
|
|
4
|
+
**Version:** 0.2.0
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** federal-regulations-mcp-server
|
|
4
|
-
**Version:** 0.
|
|
4
|
+
**Version:** 0.2.0
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/federal-regulations-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/federal-regulations-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -40,7 +40,7 @@ Seven tools across the regulatory workflow. The **Federal Register** and **eCFR*
|
|
|
40
40
|
| `regulations_search_rules` | Federal Register | — | Search proposed rules, final rules, notices, and presidential documents by query, type, agency, date range, and open-for-comment status. The primary discovery entry point. |
|
|
41
41
|
| `regulations_get_document` | Federal Register | — | Fetch one FR document by number — full metadata plus the cross-source handles (docket ID, CFR parts, comment count) that chain into the comment and codified-text tools. |
|
|
42
42
|
| `regulations_browse_cfr` | eCFR | — | Walk the CFR hierarchy (structure mode) or full-text-search the codified CFR (search mode). Both feed `regulations_get_cfr_section`. |
|
|
43
|
-
| `regulations_get_cfr_section` | eCFR | — | Read the codified text
|
|
43
|
+
| `regulations_get_cfr_section` | eCFR | — | Read the codified text at a CFR location — a section, a whole part, or an appendix — current or as of a past date. |
|
|
44
44
|
| `regulations_get_docket` | Regulations.gov | ✔ | Pull a rulemaking docket and the documents filed in it (NPRM, final rule, supporting materials). |
|
|
45
45
|
| `regulations_find_comments` | Regulations.gov | ✔ | Fetch public comments on a document or docket, or one comment's full body and attachments. Flags attachment-only submissions. |
|
|
46
46
|
| `regulations_list_open_comments` | Federal Register (+ Reg.gov enrich) | optional | Rules currently open for public comment, closing soonest first. Fully functional keyless; enriches comment counts when keyed. |
|
|
@@ -79,17 +79,20 @@ Explore the codified Code of Federal Regulations via eCFR in two modes. Keyless.
|
|
|
79
79
|
- Search is served from the synced local mirror (FTS5) only when the mirror's title coverage can answer the request — a title it does not hold, an all-titles query against a scoped mirror, a `date`, or a cold deploy all go to the live eCFR search API instead
|
|
80
80
|
- Every search result reports `source` (`mirror` or `live`) and `sourceScope` — which corpus answered and what it covers, so an empty result is never mistaken for "no such regulation"
|
|
81
81
|
- `date` searches the section text in effect that day; eCFR indexes 2017-01-03 onward, and an undated search is pinned to eCFR's current index date rather than spanning every historical version
|
|
82
|
-
- Both modes assemble a `cfrCite` that feeds `regulations_get_cfr_section`
|
|
82
|
+
- Both modes assemble a `cfrCite` that feeds `regulations_get_cfr_section`, and both hand appendices back the same way: an `appendix` field with eCFR's verbatim identifier, and a cite that names the appendix rather than the part around it
|
|
83
|
+
- The mirror indexes section text only, so it never matches an appendix — its `sourceScope` says so, since otherwise an appendix that exists and one that does not both read as zero matches
|
|
83
84
|
|
|
84
85
|
---
|
|
85
86
|
|
|
86
87
|
### `regulations_get_cfr_section`
|
|
87
88
|
|
|
88
|
-
Read the codified text
|
|
89
|
+
Read the codified text at a CFR location — one section, a whole part, or one appendix — via eCFR. Keyless.
|
|
89
90
|
|
|
90
91
|
- Answers "what does 40 CFR 50.1 say today?" and "...as of 2019-01-01?" — pass `date` for point-in-time text
|
|
91
92
|
- Provide `title` + `part` + `section` for one section, or omit `section` to fetch the whole part
|
|
92
|
-
-
|
|
93
|
+
- Provide `appendix` to read an appendix, passing the identifier verbatim as `regulations_browse_cfr` emits it (`Appendix A-1 to Part 50`, `Schedule I to Part 789`, `Special Federal Aviation Regulation No. 88`) — the identifiers are prose, not letters, and a short form matches nothing
|
|
94
|
+
- A whole-part read names the part's appendices and their headings but does not inline their text; appendices routinely run several times the length of the sections around them, so reading one is a deliberate second call
|
|
95
|
+
- Current single-section reads are served from the local mirror when ready (the `source` is reported); historical dates, whole-part fetches, appendix reads, and a cold mirror fall back to the live eCFR versioner
|
|
93
96
|
- eCFR retains historical versions back to roughly 2017; a date before coverage is rejected with guidance
|
|
94
97
|
|
|
95
98
|
---
|
|
@@ -318,10 +321,12 @@ ECFR_MIRROR_TITLES=21,40 bun run mirror:init
|
|
|
318
321
|
# Incremental refresh against the latest eCFR issues
|
|
319
322
|
bun run mirror:refresh
|
|
320
323
|
|
|
321
|
-
# Report row counts
|
|
324
|
+
# Report row counts, the last-synced issue date, and whether the index is stale
|
|
322
325
|
bun run mirror:verify
|
|
323
326
|
```
|
|
324
327
|
|
|
328
|
+
**An index written by an older ingester is not served.** The ingester stamps a version into the mirror once a run has re-derived every title the index holds; when a release changes how rows are derived, an index carrying an older stamp is treated exactly like a cold one — every read falls back to live eCFR until `bun run mirror:refresh` re-derives it. `mirror:verify` says so explicitly, and a refresh removes the rows the previous ingester filed under keys the current one no longer produces. A run that skips a title — a failed fetch, or an `ECFR_MIRROR_TITLES` scope narrower than the index — names it in the log and leaves the stamp unwritten, because those untouched titles are exactly the ones a stamp would certify wrongly.
|
|
329
|
+
|
|
325
330
|
Until the mirror has completed an init, the codified-text tools run against the live eCFR API — so the server is useful immediately on a fresh deploy; the mirror is a latency/throughput optimization, not a hard dependency. On the HTTP transport a weekly refresh is scheduled automatically (`ECFR_MIRROR_REFRESH_CRON`); stdio operators run the lifecycle scripts above.
|
|
326
331
|
|
|
327
332
|
The mirror database (`./data/ecfr-mirror.sqlite`) is a local artifact — it is git-ignored and excluded from the `.mcpb` bundle, never shipped in the package.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "regulations_get_cfr_section reads CFR appendices by verbatim identifier, with appendix handles surfaced from regulations_browse_cfr; the eCFR mirror now files dotless-numbered sections under their correct part and versions its ingest so stale rows fall back to live eCFR."
|
|
3
|
+
breaking: true
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.0 — 2026-08-10
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`regulations_get_cfr_section` `appendix` input** — reads one CFR appendix by its verbatim identifier (`title` + `appendix`, `part` optional but disambiguating); adds `appendix` and `appendices` (a whole-part read's un-inlined appendix identifiers + headings) to the output, plus `location_required` and `conflicting_target` error reasons. ([#6](https://github.com/cyanheads/federal-regulations-mcp-server/issues/6))
|
|
12
|
+
- **`regulations_browse_cfr`** — structure nodes and search hits carry an `appendix` field; an appendix's `cfrCite` now names the appendix itself, not the part around it. ([#6](https://github.com/cyanheads/federal-regulations-mcp-server/issues/6))
|
|
13
|
+
- **`mirror:verify`** — reports whether the index was written by the current ingester, naming `mirror:refresh` as the fix when it wasn't. ([#9](https://github.com/cyanheads/federal-regulations-mcp-server/issues/9))
|
|
14
|
+
|
|
15
|
+
## Changed
|
|
16
|
+
|
|
17
|
+
- **`regulations_get_cfr_section` `part`** — input is now optional (required unless `appendix` is given); output `part` is nullable. **Breaking**: a caller assuming `part` is always a non-null string must now handle `null` (an appendix hanging off a chapter, subchapter, or subtitle rather than a part).
|
|
18
|
+
- **CFR cites** — a section or appendix cite now names its enclosing part explicitly when the section number doesn't embed it (`14 CFR 241 § 25`, not `14 CFR 25`), applied uniformly to live hits, mirror hits, the read tool, and the `regulations://cfr/{title}/{part}/{section}` resource. ([#9](https://github.com/cyanheads/federal-regulations-mcp-server/issues/9))
|
|
19
|
+
- **eCFR body-text extraction** — keeps `<HD1>`–`<HD7>` subheadings, `<TABLE>` rows (pipe-delimited), the flush-paragraph family (`<FP-1>`, `<FP1-2>`), and an editorial note's `<HED>`/`<PSPACE>`, for sections and appendices alike; previously only `<P>`/`<FP>` paragraphs were kept, which answered 61% of appendix nodes in a sample with an empty body. ([#6](https://github.com/cyanheads/federal-regulations-mcp-server/issues/6))
|
|
20
|
+
|
|
21
|
+
## Fixed
|
|
22
|
+
|
|
23
|
+
- **eCFR mirror ingest** — a section's part now comes from its enclosing `<DIV5 TYPE="PART">` element instead of the section number cut at its first dot; a part with dotless section identifiers (14 CFR 241: `Section 25`, `Sec. 1-1`) was filing rows under a part named after the section number, so a scoped search or cite could return an unrelated regulation's text. ([#9](https://github.com/cyanheads/federal-regulations-mcp-server/issues/9))
|
|
24
|
+
- **Mirror ingest versioning** — the ingester now stamps an `ingest_version`; rows from a superseded ingester are treated as not ready (every read falls back to live eCFR until `mirror:refresh` re-derives them), and a refresh tombstones rows it no longer writes so corrected or withdrawn rows don't survive beside the fix. ([#9](https://github.com/cyanheads/federal-regulations-mcp-server/issues/9))
|
|
25
|
+
- **`mirror:verify`** — its sample query was passing its result limit into the `part` filter added in 0.1.4, leaving the limit unset. ([#9](https://github.com/cyanheads/federal-regulations-mcp-server/issues/9))
|
|
26
|
+
- **XML paragraph parsing** — a malformed `<FP-1>`/`<FP-2>` closing-tag match could swallow up to 257 KB of content, every paragraph and subheading up to the next plain `</FP>` in the document. ([#6](https://github.com/cyanheads/federal-regulations-mcp-server/issues/6))
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* current CFR section, the same payload as regulations_get_cfr_section at the
|
|
4
4
|
* current date, for clients that support injectable context. Mirror-backed with a
|
|
5
5
|
* live eCFR fallback. Every datum is also reachable through the tool surface.
|
|
6
|
+
*
|
|
7
|
+
* Sections only. An appendix is addressed by a free-form phrase ("Appendix A-1
|
|
8
|
+
* to Part 50"), not by a path segment, so it stays on the tool surface rather
|
|
9
|
+
* than becoming a URI template whose last component is an encoded sentence.
|
|
6
10
|
* @module mcp-server/resources/definitions/cfr-section.resource
|
|
7
11
|
*/
|
|
8
12
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cfr-section.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/cfr-section.resource.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cfr-section.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/cfr-section.resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAMrD,eAAO,MAAM,kBAAkB;;;;wCAiF7B,CAAC"}
|
|
@@ -3,16 +3,21 @@
|
|
|
3
3
|
* current CFR section, the same payload as regulations_get_cfr_section at the
|
|
4
4
|
* current date, for clients that support injectable context. Mirror-backed with a
|
|
5
5
|
* live eCFR fallback. Every datum is also reachable through the tool surface.
|
|
6
|
+
*
|
|
7
|
+
* Sections only. An appendix is addressed by a free-form phrase ("Appendix A-1
|
|
8
|
+
* to Part 50"), not by a path segment, so it stays on the tool surface rather
|
|
9
|
+
* than becoming a URI template whose last component is an encoded sentence.
|
|
6
10
|
* @module mcp-server/resources/definitions/cfr-section.resource
|
|
7
11
|
*/
|
|
8
12
|
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
9
13
|
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
14
|
+
import { sectionCite } from '../../../services/ecfr/cite.js';
|
|
10
15
|
import { getEcfrService } from '../../../services/ecfr/ecfr-service.js';
|
|
11
16
|
import { mirrorGetSection, mirrorReady } from '../../../services/ecfr-mirror/ecfr-mirror.js';
|
|
12
17
|
export const cfrSectionResource = resource('regulations://cfr/{title}/{part}/{section}', {
|
|
13
18
|
name: 'cfr-section',
|
|
14
19
|
title: 'CFR section (current)',
|
|
15
|
-
description: 'Codified text of a current CFR section by title/part/section (e.g. regulations://cfr/40/50/50.1). Mirrors regulations_get_cfr_section at the current date — mirror-backed with a live eCFR fallback.',
|
|
20
|
+
description: 'Codified text of a current CFR section by title/part/section (e.g. regulations://cfr/40/50/50.1). Mirrors regulations_get_cfr_section at the current date — mirror-backed with a live eCFR fallback. Sections only; read an appendix through regulations_get_cfr_section with its `appendix` input.',
|
|
16
21
|
mimeType: 'application/json',
|
|
17
22
|
params: z.object({
|
|
18
23
|
title: z
|
|
@@ -28,12 +33,13 @@ export const cfrSectionResource = resource('regulations://cfr/{title}/{part}/{se
|
|
|
28
33
|
if (await mirrorReady()) {
|
|
29
34
|
const hit = await mirrorGetSection(titleNum, params.part, params.section);
|
|
30
35
|
if (hit) {
|
|
31
|
-
const hierarchyPath = await service.hierarchyPath(titleNum, params.part, params.section, hit.date, ctx);
|
|
36
|
+
const hierarchyPath = await service.hierarchyPath(titleNum, { part: params.part, section: params.section }, hit.date, ctx);
|
|
32
37
|
return {
|
|
33
|
-
cfrCite:
|
|
38
|
+
cfrCite: sectionCite(titleNum, params.part, params.section),
|
|
34
39
|
title: titleNum,
|
|
35
40
|
part: params.part,
|
|
36
41
|
section: params.section,
|
|
42
|
+
appendix: null,
|
|
37
43
|
heading: hit.heading,
|
|
38
44
|
hierarchyPath,
|
|
39
45
|
date: hit.date,
|
|
@@ -51,12 +57,13 @@ export const cfrSectionResource = resource('regulations://cfr/{title}/{part}/{se
|
|
|
51
57
|
section: params.section,
|
|
52
58
|
});
|
|
53
59
|
}
|
|
54
|
-
const hierarchyPath = await service.hierarchyPath(titleNum, params.part, params.section, result.date, ctx);
|
|
60
|
+
const hierarchyPath = await service.hierarchyPath(titleNum, { part: params.part, section: params.section }, result.date, ctx);
|
|
55
61
|
return {
|
|
56
|
-
cfrCite:
|
|
62
|
+
cfrCite: sectionCite(titleNum, params.part, params.section),
|
|
57
63
|
title: titleNum,
|
|
58
64
|
part: params.part,
|
|
59
65
|
section: params.section,
|
|
66
|
+
appendix: null,
|
|
60
67
|
heading: result.heading,
|
|
61
68
|
hierarchyPath,
|
|
62
69
|
date: result.date,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cfr-section.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/cfr-section.resource.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cfr-section.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/cfr-section.resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,4CAA4C,EAAE;IACvF,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EACT,qSAAqS;IACvS,QAAQ,EAA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gBACnC,IAAI,EAAE,mCAAmC;gBACzC,QAAQ,EAAE,kBAAkB;aAC7B;SACF;KACF,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -37,6 +37,7 @@ export declare const browseCfrTool: import("@cyanheads/mcp-ts-core").ToolDefinit
|
|
|
37
37
|
description: z.ZodNullable<z.ZodString>;
|
|
38
38
|
reserved: z.ZodBoolean;
|
|
39
39
|
cfrCite: z.ZodNullable<z.ZodString>;
|
|
40
|
+
appendix: z.ZodNullable<z.ZodString>;
|
|
40
41
|
}, z.core.$strip>>>;
|
|
41
42
|
source: z.ZodOptional<z.ZodEnum<{
|
|
42
43
|
live: "live";
|
|
@@ -47,6 +48,7 @@ export declare const browseCfrTool: import("@cyanheads/mcp-ts-core").ToolDefinit
|
|
|
47
48
|
title: z.ZodNumber;
|
|
48
49
|
part: z.ZodString;
|
|
49
50
|
section: z.ZodNullable<z.ZodString>;
|
|
51
|
+
appendix: z.ZodNullable<z.ZodString>;
|
|
50
52
|
heading: z.ZodString;
|
|
51
53
|
hierarchyPath: z.ZodString;
|
|
52
54
|
excerpt: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browse-cfr.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/browse-cfr.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"browse-cfr.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/browse-cfr.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAyHjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0PxB,CAAC"}
|
|
@@ -27,7 +27,9 @@ function filterClause(title, part) {
|
|
|
27
27
|
/** Human-readable coverage of the mirror index, for the `sourceScope` field. */
|
|
28
28
|
function describeMirrorScope(scope, title, part) {
|
|
29
29
|
const held = scope.complete ? 'all CFR titles' : `CFR titles ${scope.titles.join(', ')}`;
|
|
30
|
-
|
|
30
|
+
// The index holds section text alone, so an appendix match cannot come back
|
|
31
|
+
// from it — which is indistinguishable from no such appendix unless said.
|
|
32
|
+
return `Local mirror index — ${held}${filterClause(title, part)}, current section text only; appendices are not indexed, so no result here is evidence about them.`;
|
|
31
33
|
}
|
|
32
34
|
/** Human-readable coverage of the live eCFR search index, for `sourceScope`. */
|
|
33
35
|
function describeLiveScope(date, title, part) {
|
|
@@ -65,7 +67,11 @@ const structureNode = z
|
|
|
65
67
|
cfrCite: z
|
|
66
68
|
.string()
|
|
67
69
|
.nullable()
|
|
68
|
-
.describe('Assembled cite for a part
|
|
70
|
+
.describe('Assembled cite → regulations_get_cfr_section: "40 CFR 50" / "40 CFR 50.1" for a part or section, "Appendix A-1 to Part 50, Title 40" for an appendix. Null on a level with no read path (chapter, subchapter, subpart, subject group).'),
|
|
71
|
+
appendix: z
|
|
72
|
+
.string()
|
|
73
|
+
.nullable()
|
|
74
|
+
.describe('On an appendix node, the identifier to pass straight back as regulations_get_cfr_section\'s `appendix` input; null on every other node type. It is free-form prose, not a letter ("Schedule I to Part 789", "Special Federal Aviation Regulation No. 88"), so pass it verbatim rather than abbreviating it.'),
|
|
69
75
|
})
|
|
70
76
|
.describe('One hierarchy node.');
|
|
71
77
|
const searchHit = z
|
|
@@ -76,6 +82,10 @@ const searchHit = z
|
|
|
76
82
|
.string()
|
|
77
83
|
.nullable()
|
|
78
84
|
.describe('Section identifier, or null when the match is an appendix or a whole part.'),
|
|
85
|
+
appendix: z
|
|
86
|
+
.string()
|
|
87
|
+
.nullable()
|
|
88
|
+
.describe("On an appendix hit, the identifier to pass straight back as regulations_get_cfr_section's `appendix` input; null on a section hit. Always null on a mirror hit — the index holds section text only, so mirror-sourced results never match an appendix."),
|
|
79
89
|
heading: z
|
|
80
90
|
.string()
|
|
81
91
|
.describe('What the matched node is called — the section, appendix, or part heading. Distinct from cfrCite, which is where it lives.'),
|
|
@@ -83,9 +93,11 @@ const searchHit = z
|
|
|
83
93
|
.string()
|
|
84
94
|
.describe('Path down to the match. A live hit names the part it sits in — "Title 40 › Chapter I › Subchapter C › Part 51 — Requirements for Preparation, Adoption, and Submittal of Implementation Plans › § 51.190" — so the subject matter is readable without a second call. A mirror hit is structural only ("Title 14 › Part 25 › § 25.1043"): the index stores no level names. Check `source` before comparing paths across results.'),
|
|
85
95
|
excerpt: z.string().describe('Matched text snippet.'),
|
|
86
|
-
cfrCite: z
|
|
96
|
+
cfrCite: z
|
|
97
|
+
.string()
|
|
98
|
+
.describe('Assembled cite → regulations_get_cfr_section. A section hit cites the section ("40 CFR 51.190"); an appendix hit cites the appendix in eCFR\'s own form ("Appendix C to Part 58, Title 40"), not the part around it, since the part\'s sections do not contain the matched text.'),
|
|
87
99
|
})
|
|
88
|
-
.describe('One matching CFR section.');
|
|
100
|
+
.describe('One matching CFR section or appendix.');
|
|
89
101
|
export const browseCfrTool = tool('regulations_browse_cfr', {
|
|
90
102
|
title: 'regulations_browse_cfr',
|
|
91
103
|
description: 'Explore the codified Code of Federal Regulations via eCFR in two modes. "structure" walks the CFR hierarchy (all 50 titles, or one title\'s chapters → parts → sections) to discover a cite when the exact citation is unknown. "search" runs a full-text query across the codified CFR and returns matching sections with their hierarchy path and a snippet. Both modes accept title and part to narrow the scope, so a part surfaced by structure mode can be searched directly instead of filtering a whole title\'s hits by eye. Both feed regulations_get_cfr_section. Every search result reports which corpus answered it — the synced local mirror or the live eCFR index — and what that corpus covers, in `source` and `sourceScope`.',
|
|
@@ -274,7 +286,8 @@ export const browseCfrTool = tool('regulations_browse_cfr', {
|
|
|
274
286
|
const reserved = n.reserved ? ' _(reserved)_' : '';
|
|
275
287
|
const cite = n.cfrCite ? ` — \`${n.cfrCite}\` → regulations_get_cfr_section` : '';
|
|
276
288
|
const desc = n.description && n.description !== n.label ? ` — ${n.description}` : '';
|
|
277
|
-
|
|
289
|
+
const appendix = n.appendix ? ` (appendix: \`${n.appendix}\`)` : '';
|
|
290
|
+
lines.push(`- **${n.type}** ${n.identifier}: ${n.label}${desc}${reserved}${cite}${appendix}`);
|
|
278
291
|
}
|
|
279
292
|
}
|
|
280
293
|
if (result.results || result.source) {
|
|
@@ -284,7 +297,12 @@ export const browseCfrTool = tool('regulations_browse_cfr', {
|
|
|
284
297
|
lines.push(`_${result.sourceScope ?? 'Corpus scope unreported.'}_`);
|
|
285
298
|
lines.push('');
|
|
286
299
|
for (const h of result.results ?? []) {
|
|
287
|
-
|
|
300
|
+
const where = [`Title ${h.title}`, `Part ${h.part}`];
|
|
301
|
+
if (h.section)
|
|
302
|
+
where.push(`§ ${h.section}`);
|
|
303
|
+
if (h.appendix)
|
|
304
|
+
where.push(`appendix ${h.appendix}`);
|
|
305
|
+
lines.push(`### ${h.cfrCite} — ${h.heading} [${where.join(', ')}]`);
|
|
288
306
|
lines.push(`_${h.hierarchyPath}_`);
|
|
289
307
|
lines.push(h.excerpt);
|
|
290
308
|
lines.push('');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browse-cfr.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/browse-cfr.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAEL,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,uCAAuC,CAAC;AAE/C,kFAAkF;AAClF,SAAS,YAAY,CAAC,KAAyB,EAAE,IAAwB;IACvE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,IAAI,KAAK,SAAS;QACvB,CAAC,CAAC,uBAAuB,KAAK,EAAE;QAChC,CAAC,CAAC,uBAAuB,KAAK,SAAS,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,gFAAgF;AAChF,SAAS,mBAAmB,CAC1B,KAAkB,EAClB,KAAyB,EACzB,IAAwB;IAExB,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACzF,OAAO,wBAAwB,IAAI,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"browse-cfr.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/browse-cfr.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAEL,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,uCAAuC,CAAC;AAE/C,kFAAkF;AAClF,SAAS,YAAY,CAAC,KAAyB,EAAE,IAAwB;IACvE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,IAAI,KAAK,SAAS;QACvB,CAAC,CAAC,uBAAuB,KAAK,EAAE;QAChC,CAAC,CAAC,uBAAuB,KAAK,SAAS,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,gFAAgF;AAChF,SAAS,mBAA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*
|
|
4
|
-
* lookup is the primary path for a current single
|
|
5
|
-
* whole-part fetches, and a cold
|
|
6
|
-
* Keyless.
|
|
2
|
+
* @fileoverview regulations_get_cfr_section — read the codified text at a CFR
|
|
3
|
+
* location via eCFR, current or as of a past date: one section, a whole part, or
|
|
4
|
+
* one appendix. Mirror row lookup is the primary path for a current single
|
|
5
|
+
* section; historical dates, whole-part fetches, appendix reads, and a cold
|
|
6
|
+
* mirror fall back to the live eCFR versioner. Keyless.
|
|
7
|
+
*
|
|
8
|
+
* An appendix is a location in the same hierarchy as a section, reached the same
|
|
9
|
+
* way and answered in the same shape, so it is an input to this tool rather than
|
|
10
|
+
* a tool of its own. It is addressed by the identifier eCFR writes verbatim —
|
|
11
|
+
* free-form prose, not a letter — which is what regulations_browse_cfr emits.
|
|
7
12
|
* @module mcp-server/tools/definitions/get-cfr-section.tool
|
|
8
13
|
*/
|
|
9
14
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
10
15
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
11
16
|
export declare const getCfrSectionTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
12
17
|
title: z.ZodNumber;
|
|
13
|
-
part: z.ZodString
|
|
18
|
+
part: z.ZodOptional<z.ZodString>;
|
|
14
19
|
section: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>;
|
|
20
|
+
appendix: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>;
|
|
15
21
|
date: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodString]>>;
|
|
16
22
|
}, z.core.$strip>, z.ZodObject<{
|
|
17
23
|
cfrCite: z.ZodString;
|
|
18
24
|
title: z.ZodNumber;
|
|
19
|
-
part: z.ZodString
|
|
25
|
+
part: z.ZodNullable<z.ZodString>;
|
|
20
26
|
section: z.ZodNullable<z.ZodString>;
|
|
27
|
+
appendix: z.ZodNullable<z.ZodString>;
|
|
21
28
|
heading: z.ZodString;
|
|
22
29
|
hierarchyPath: z.ZodString;
|
|
23
30
|
date: z.ZodString;
|
|
@@ -31,11 +38,25 @@ export declare const getCfrSectionTool: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
31
38
|
heading: z.ZodString;
|
|
32
39
|
bodyText: z.ZodString;
|
|
33
40
|
}, z.core.$strip>>>;
|
|
41
|
+
appendices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
|
+
appendix: z.ZodString;
|
|
43
|
+
heading: z.ZodString;
|
|
44
|
+
}, z.core.$strip>>>;
|
|
34
45
|
}, z.core.$strip>, readonly [{
|
|
35
46
|
readonly reason: "not_found";
|
|
36
47
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
37
|
-
readonly when: "No such title/part/section at that date.";
|
|
38
|
-
readonly recovery: "Verify the cite with regulations_browse_cfr (structure mode); the part or
|
|
48
|
+
readonly when: "No such title/part/section/appendix at that date.";
|
|
49
|
+
readonly recovery: "Verify the cite with regulations_browse_cfr (structure mode); the part, section, or appendix may not exist, may be reserved, or — for an appendix — may be named differently than the short form you passed.";
|
|
50
|
+
}, {
|
|
51
|
+
readonly reason: "location_required";
|
|
52
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
53
|
+
readonly when: "Neither part nor appendix was given, so the call names no location to read.";
|
|
54
|
+
readonly recovery: "Add the part to read, or the appendix identifier from regulations_browse_cfr.";
|
|
55
|
+
}, {
|
|
56
|
+
readonly reason: "conflicting_target";
|
|
57
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
58
|
+
readonly when: "Both section and appendix were given. They name two different locations, and picking one silently would return text the call did not ask for.";
|
|
59
|
+
readonly recovery: "Send section or appendix, not both; make two calls to read both.";
|
|
39
60
|
}, {
|
|
40
61
|
readonly reason: "date_out_of_range";
|
|
41
62
|
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-cfr-section.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-cfr-section.tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"get-cfr-section.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-cfr-section.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8R5B,CAAC"}
|