@cyanheads/ris-austria-mcp-server 0.1.5
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 +401 -0
- package/CLAUDE.md +401 -0
- package/Dockerfile +125 -0
- package/LICENSE +201 -0
- package/README.md +309 -0
- package/changelog/0.1.x/0.1.0.md +25 -0
- package/changelog/0.1.x/0.1.1.md +24 -0
- package/changelog/0.1.x/0.1.2.md +16 -0
- package/changelog/0.1.x/0.1.3.md +11 -0
- package/changelog/0.1.x/0.1.4.md +11 -0
- package/changelog/0.1.x/0.1.5.md +18 -0
- package/changelog/template.md +129 -0
- package/dist/config/server-config.d.ts +19 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +35 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/ris-document.resource.d.ts +30 -0
- package/dist/mcp-server/resources/definitions/ris-document.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/ris-document.resource.js +75 -0
- package/dist/mcp-server/resources/definitions/ris-document.resource.js.map +1 -0
- package/dist/mcp-server/tools/definitions/_shared.d.ts +8 -0
- package/dist/mcp-server/tools/definitions/_shared.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/_shared.js +10 -0
- package/dist/mcp-server/tools/definitions/_shared.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-get-document.tool.d.ts +189 -0
- package/dist/mcp-server/tools/definitions/ris-get-document.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-get-document.tool.js +504 -0
- package/dist/mcp-server/tools/definitions/ris-get-document.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-list-reference.tool.d.ts +42 -0
- package/dist/mcp-server/tools/definitions/ris-list-reference.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-list-reference.tool.js +316 -0
- package/dist/mcp-server/tools/definitions/ris-list-reference.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-lookup-citation.tool.d.ts +80 -0
- package/dist/mcp-server/tools/definitions/ris-lookup-citation.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-lookup-citation.tool.js +529 -0
- package/dist/mcp-server/tools/definitions/ris-lookup-citation.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-announcements.tool.d.ts +118 -0
- package/dist/mcp-server/tools/definitions/ris-search-announcements.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-announcements.tool.js +389 -0
- package/dist/mcp-server/tools/definitions/ris-search-announcements.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-case-law.tool.d.ts +178 -0
- package/dist/mcp-server/tools/definitions/ris-search-case-law.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-case-law.tool.js +495 -0
- package/dist/mcp-server/tools/definitions/ris-search-case-law.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-drafts.tool.d.ts +80 -0
- package/dist/mcp-server/tools/definitions/ris-search-drafts.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-drafts.tool.js +264 -0
- package/dist/mcp-server/tools/definitions/ris-search-drafts.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-gazette.tool.d.ts +147 -0
- package/dist/mcp-server/tools/definitions/ris-search-gazette.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-gazette.tool.js +509 -0
- package/dist/mcp-server/tools/definitions/ris-search-gazette.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-legislation.tool.d.ts +145 -0
- package/dist/mcp-server/tools/definitions/ris-search-legislation.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-search-legislation.tool.js +466 -0
- package/dist/mcp-server/tools/definitions/ris-search-legislation.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-track-changes.tool.d.ts +73 -0
- package/dist/mcp-server/tools/definitions/ris-track-changes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/ris-track-changes.tool.js +265 -0
- package/dist/mcp-server/tools/definitions/ris-track-changes.tool.js.map +1 -0
- package/dist/services/ris/normalizer.d.ts +40 -0
- package/dist/services/ris/normalizer.d.ts.map +1 -0
- package/dist/services/ris/normalizer.js +480 -0
- package/dist/services/ris/normalizer.js.map +1 -0
- package/dist/services/ris/reference/applications.d.ts +529 -0
- package/dist/services/ris/reference/applications.d.ts.map +1 -0
- package/dist/services/ris/reference/applications.js +520 -0
- package/dist/services/ris/reference/applications.js.map +1 -0
- package/dist/services/ris/reference/changed-since-intervals.d.ts +42 -0
- package/dist/services/ris/reference/changed-since-intervals.d.ts.map +1 -0
- package/dist/services/ris/reference/changed-since-intervals.js +16 -0
- package/dist/services/ris/reference/changed-since-intervals.js.map +1 -0
- package/dist/services/ris/reference/citation-formats.d.ts +39 -0
- package/dist/services/ris/reference/citation-formats.d.ts.map +1 -0
- package/dist/services/ris/reference/citation-formats.js +39 -0
- package/dist/services/ris/reference/citation-formats.js.map +1 -0
- package/dist/services/ris/reference/collections.d.ts +82 -0
- package/dist/services/ris/reference/collections.d.ts.map +1 -0
- package/dist/services/ris/reference/collections.js +102 -0
- package/dist/services/ris/reference/collections.js.map +1 -0
- package/dist/services/ris/reference/courts.d.ts +201 -0
- package/dist/services/ris/reference/courts.d.ts.map +1 -0
- package/dist/services/ris/reference/courts.js +198 -0
- package/dist/services/ris/reference/courts.js.map +1 -0
- package/dist/services/ris/reference/decision-kinds.d.ts +78 -0
- package/dist/services/ris/reference/decision-kinds.d.ts.map +1 -0
- package/dist/services/ris/reference/decision-kinds.js +117 -0
- package/dist/services/ris/reference/decision-kinds.js.map +1 -0
- package/dist/services/ris/reference/decision-types.d.ts +36 -0
- package/dist/services/ris/reference/decision-types.d.ts.map +1 -0
- package/dist/services/ris/reference/decision-types.js +29 -0
- package/dist/services/ris/reference/decision-types.js.map +1 -0
- package/dist/services/ris/reference/district-authorities.d.ts +314 -0
- package/dist/services/ris/reference/district-authorities.d.ts.map +1 -0
- package/dist/services/ris/reference/district-authorities.js +212 -0
- package/dist/services/ris/reference/district-authorities.js.map +1 -0
- package/dist/services/ris/reference/gazette-parts.d.ts +73 -0
- package/dist/services/ris/reference/gazette-parts.d.ts.map +1 -0
- package/dist/services/ris/reference/gazette-parts.js +58 -0
- package/dist/services/ris/reference/gazette-parts.js.map +1 -0
- package/dist/services/ris/reference/index.d.ts +23 -0
- package/dist/services/ris/reference/index.d.ts.map +1 -0
- package/dist/services/ris/reference/index.js +23 -0
- package/dist/services/ris/reference/index.js.map +1 -0
- package/dist/services/ris/reference/issuing-bodies.d.ts +642 -0
- package/dist/services/ris/reference/issuing-bodies.d.ts.map +1 -0
- package/dist/services/ris/reference/issuing-bodies.js +616 -0
- package/dist/services/ris/reference/issuing-bodies.js.map +1 -0
- package/dist/services/ris/reference/justiz-subject-areas.d.ts +133 -0
- package/dist/services/ris/reference/justiz-subject-areas.d.ts.map +1 -0
- package/dist/services/ris/reference/justiz-subject-areas.js +67 -0
- package/dist/services/ris/reference/justiz-subject-areas.js.map +1 -0
- package/dist/services/ris/reference/law-types.d.ts +46 -0
- package/dist/services/ris/reference/law-types.d.ts.map +1 -0
- package/dist/services/ris/reference/law-types.js +41 -0
- package/dist/services/ris/reference/law-types.js.map +1 -0
- package/dist/services/ris/reference/ministries.d.ts +360 -0
- package/dist/services/ris/reference/ministries.d.ts.map +1 -0
- package/dist/services/ris/reference/ministries.js +408 -0
- package/dist/services/ris/reference/ministries.js.map +1 -0
- package/dist/services/ris/reference/search-syntax.d.ts +66 -0
- package/dist/services/ris/reference/search-syntax.d.ts.map +1 -0
- package/dist/services/ris/reference/search-syntax.js +65 -0
- package/dist/services/ris/reference/search-syntax.js.map +1 -0
- package/dist/services/ris/reference/section-types.d.ts +33 -0
- package/dist/services/ris/reference/section-types.d.ts.map +1 -0
- package/dist/services/ris/reference/section-types.js +29 -0
- package/dist/services/ris/reference/section-types.js.map +1 -0
- package/dist/services/ris/reference/stages.d.ts +41 -0
- package/dist/services/ris/reference/stages.d.ts.map +1 -0
- package/dist/services/ris/reference/stages.js +27 -0
- package/dist/services/ris/reference/stages.js.map +1 -0
- package/dist/services/ris/reference/states.d.ts +90 -0
- package/dist/services/ris/reference/states.d.ts.map +1 -0
- package/dist/services/ris/reference/states.js +85 -0
- package/dist/services/ris/reference/states.js.map +1 -0
- package/dist/services/ris/request-builder.d.ts +195 -0
- package/dist/services/ris/request-builder.d.ts.map +1 -0
- package/dist/services/ris/request-builder.js +673 -0
- package/dist/services/ris/request-builder.js.map +1 -0
- package/dist/services/ris/ris-service.d.ts +65 -0
- package/dist/services/ris/ris-service.d.ts.map +1 -0
- package/dist/services/ris/ris-service.js +200 -0
- package/dist/services/ris/ris-service.js.map +1 -0
- package/dist/services/ris/types.d.ts +651 -0
- package/dist/services/ris/types.d.ts.map +1 -0
- package/dist/services/ris/types.js +11 -0
- package/dist/services/ris/types.js.map +1 -0
- package/package.json +108 -0
- package/server.json +111 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ris_get_document — read one RIS document's full text (markdown/html/xml)
|
|
3
|
+
* or its rendition URLs, with explicit binding status and the amtssigniert Authentisch PDF
|
|
4
|
+
* surfaced wherever it exists. Two addressing modes route to the same fetch path:
|
|
5
|
+
* `document_number` + `application`, or a `document_url` from a result's content_urls.
|
|
6
|
+
* Format availability varies by application (full text · authentic-PDF-only · PDF-only ·
|
|
7
|
+
* metadata-only) — a text-format request against a non-text application degrades to a
|
|
8
|
+
* `format_unavailable` notice on a success result, never an error. Oversized markdown
|
|
9
|
+
* overflows to a retrievable §/Artikel/Anlage section outline (never a silent truncation);
|
|
10
|
+
* a follow-up call with `sections:[…]` returns just the chosen sections. The shared
|
|
11
|
+
* {@link renderDocument} helper backs both this tool and the `ris://document/…` resource.
|
|
12
|
+
* @module mcp-server/tools/definitions/ris-get-document
|
|
13
|
+
*/
|
|
14
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
15
|
+
import { JsonRpcErrorCode, McpError, validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
16
|
+
import { OUTLINE_VARIANT, outlineOnOverflow, } from '@cyanheads/mcp-ts-core/utils';
|
|
17
|
+
import { NodeHtmlMarkdown } from 'node-html-markdown';
|
|
18
|
+
import { getServerConfig } from '../../../config/server-config.js';
|
|
19
|
+
import { RIS_APPLICATIONS } from '../../../services/ris/reference/index.js';
|
|
20
|
+
import { getRisService, RIS_CONTENT_FORMATS, } from '../../../services/ris/ris-service.js';
|
|
21
|
+
/** The seven canonical binding labels (Design Decisions › Binding status). */
|
|
22
|
+
const BINDING_STATUSES = [
|
|
23
|
+
'authentic',
|
|
24
|
+
'consolidated_informational',
|
|
25
|
+
'historical_record',
|
|
26
|
+
'decision',
|
|
27
|
+
'preparatory',
|
|
28
|
+
'administrative_directive',
|
|
29
|
+
'translation',
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Serialized-length budget for inlining document text. Above it, markdown overflows to a
|
|
33
|
+
* §/Artikel/Anlage section outline instead of returning whole — generous, so it fires only
|
|
34
|
+
* on the pathological documents (multi-hundred-KB consolidations and government bills).
|
|
35
|
+
* Handed to `outlineOnOverflow`, which measures `JSON.stringify` length (≈ UTF-8 bytes for
|
|
36
|
+
* the mostly-Latin legal text); the exact `byte_size` is reported separately.
|
|
37
|
+
*/
|
|
38
|
+
const OUTLINE_BUDGET_BYTES = 500_000;
|
|
39
|
+
const APPLICATION_CODES = RIS_APPLICATIONS.map((app) => app.code);
|
|
40
|
+
const APPLICATION_BY_CODE = new Map(RIS_APPLICATIONS.map((app) => [app.code, app]));
|
|
41
|
+
/** Content-path segment → application, for reverse-mapping a passed document_url. */
|
|
42
|
+
const APPLICATION_BY_SEGMENT = new Map(RIS_APPLICATIONS.flatMap((app) => app.contentPathSegment !== null ? [[app.contentPathSegment, app]] : []));
|
|
43
|
+
/**
|
|
44
|
+
* Lowercase file extensions a main-document rendition URL may end in — the constructible
|
|
45
|
+
* `RisContentFormat` set plus the derived `.pdfsig` authentic variant (see
|
|
46
|
+
* {@link authenticPdfFrom}). A `document_url`'s trailing filename must be
|
|
47
|
+
* `{documentNumber}.{ext}` for one of these; any other filename (a `Materialien_`/`Anlagen_…`
|
|
48
|
+
* content attachment, an unknown extension) addresses non-main content this tool would
|
|
49
|
+
* otherwise silently swap for the main document.
|
|
50
|
+
*/
|
|
51
|
+
const RENDITION_EXTENSIONS = new Set([...RIS_CONTENT_FORMATS, 'pdfsig']);
|
|
52
|
+
/** Map an empty string from a form-based client to `undefined`. */
|
|
53
|
+
function meaningful(value) {
|
|
54
|
+
return value !== undefined && value !== '' ? value : undefined;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse a caller-supplied `document_url` into `(application, documentNumber)` — errors as
|
|
58
|
+
* values (no throw). Enforces the same host + `/Dokumente/` allowlist as the service's
|
|
59
|
+
* fetch guard, then reverse-maps the content-path segment to its application.
|
|
60
|
+
*/
|
|
61
|
+
export function parseDocumentUrl(url, contentBaseUrl) {
|
|
62
|
+
let parsed;
|
|
63
|
+
try {
|
|
64
|
+
parsed = new URL(url);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return { error: `"${url}" is not a valid URL` };
|
|
68
|
+
}
|
|
69
|
+
if (parsed.origin !== new URL(contentBaseUrl).origin) {
|
|
70
|
+
return { error: `only ${new URL(contentBaseUrl).origin} URLs are fetchable` };
|
|
71
|
+
}
|
|
72
|
+
if (!parsed.pathname.startsWith('/Dokumente/')) {
|
|
73
|
+
return { error: 'the path is outside the /Dokumente/ tree' };
|
|
74
|
+
}
|
|
75
|
+
const [, segment, rawDocumentNumber, filename, ...rest] = parsed.pathname
|
|
76
|
+
.split('/')
|
|
77
|
+
.filter((part) => part !== '');
|
|
78
|
+
if (segment === undefined || rawDocumentNumber === undefined) {
|
|
79
|
+
return { error: 'the path is not /Dokumente/{segment}/{documentNumber}/…' };
|
|
80
|
+
}
|
|
81
|
+
const app = APPLICATION_BY_SEGMENT.get(segment);
|
|
82
|
+
if (!app) {
|
|
83
|
+
return { error: `path segment "${segment}" is not a recognized RIS application` };
|
|
84
|
+
}
|
|
85
|
+
const documentNumber = decodeURIComponent(rawDocumentNumber);
|
|
86
|
+
// A folder URL (…/{segment}/{documentNumber}[/]) carries no trailing filename and resolves
|
|
87
|
+
// fine. A trailing filename is a main-document rendition only when it is exactly
|
|
88
|
+
// {documentNumber}.{ext} for a known rendition extension; a content attachment
|
|
89
|
+
// (Materialien_/Anlagen_… memoranda and annexes) or any deeper nesting names non-main
|
|
90
|
+
// content the fetch would silently swap for the main document — reject it here instead.
|
|
91
|
+
if (filename !== undefined) {
|
|
92
|
+
const decodedFilename = decodeURIComponent(filename);
|
|
93
|
+
const dot = decodedFilename.lastIndexOf('.');
|
|
94
|
+
const stem = dot === -1 ? decodedFilename : decodedFilename.slice(0, dot);
|
|
95
|
+
const extension = dot === -1 ? '' : decodedFilename.slice(dot + 1).toLowerCase();
|
|
96
|
+
if (rest.length > 0 || stem !== documentNumber || !RENDITION_EXTENSIONS.has(extension)) {
|
|
97
|
+
return {
|
|
98
|
+
error: `"${decodedFilename}" points at a content attachment or non-rendition file, not a main-document rendition — pass a main-document URL as returned in content_urls`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return { application: app.code, documentNumber };
|
|
103
|
+
}
|
|
104
|
+
/** Derive the `.pdfsig` (Authentisch) URL from a constructed `.pdf` rendition URL. */
|
|
105
|
+
function authenticPdfFrom(pdfUrl) {
|
|
106
|
+
return pdfUrl.replace(/\.pdf$/u, '.pdfsig');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Construct the rendition URLs for a document from its application's format availability.
|
|
110
|
+
* `buildDocumentContentUrl` throws `ValidationError` for an unsafe document number.
|
|
111
|
+
*/
|
|
112
|
+
function buildRenditionUrls(service, app, documentNumber) {
|
|
113
|
+
if (app.formats === 'none')
|
|
114
|
+
return { contentUrls: {} }; // BgblAlt — no content URLs to build
|
|
115
|
+
const pdf = service.buildDocumentContentUrl(app.code, documentNumber, 'pdf');
|
|
116
|
+
const authenticPdfUrl = app.binding === 'authentic' ? authenticPdfFrom(pdf) : undefined;
|
|
117
|
+
if (app.formats === 'authentic_pdf_only') {
|
|
118
|
+
// The signed PDF is the only rendition; the plain .pdf is not published separately.
|
|
119
|
+
return { contentUrls: {}, ...(authenticPdfUrl !== undefined && { authenticPdfUrl }) };
|
|
120
|
+
}
|
|
121
|
+
if (app.formats === 'pdf_only')
|
|
122
|
+
return { contentUrls: { pdf } };
|
|
123
|
+
return {
|
|
124
|
+
contentUrls: {
|
|
125
|
+
xml: service.buildDocumentContentUrl(app.code, documentNumber, 'xml'),
|
|
126
|
+
html: service.buildDocumentContentUrl(app.code, documentNumber, 'html'),
|
|
127
|
+
pdf,
|
|
128
|
+
rtf: service.buildDocumentContentUrl(app.code, documentNumber, 'rtf'),
|
|
129
|
+
},
|
|
130
|
+
...(authenticPdfUrl !== undefined && { authenticPdfUrl }),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** Compose the `format_unavailable` notice for an application with no text rendition. */
|
|
134
|
+
function formatUnavailableNotice(app, format, urls) {
|
|
135
|
+
if (app.formats === 'authentic_pdf_only') {
|
|
136
|
+
return `${app.code} publishes only the signed authentic PDF (amtssigniert, .pdfsig) — no ${format} rendition exists. Fetch the authentic PDF from authentic_pdf_url${urls.authenticPdfUrl !== undefined ? ` (${urls.authenticPdfUrl})` : ''}.`;
|
|
137
|
+
}
|
|
138
|
+
if (app.formats === 'pdf_only') {
|
|
139
|
+
return `${app.code} publishes a PDF only — no ${format} rendition exists. Fetch the PDF from content_urls.pdf${urls.contentUrls.pdf !== undefined ? ` (${urls.contentUrls.pdf})` : ''}.`;
|
|
140
|
+
}
|
|
141
|
+
return `${app.code} carries no content URLs in RIS — it is metadata-only, with document scans hosted by the Austrian National Library (ÖNB). Retrieve the record and its ÖNB scan link via ris_search_gazette or ris_lookup_citation; RIS serves no fetchable rendition here.`;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Line-leading structural markers of Austrian legal text as the HTML→markdown rendering
|
|
145
|
+
* emits them: ATX headings (`##`/`###`) opening with a paragraph (§ / §§), article
|
|
146
|
+
* (Artikel / Art.), or annex (Anlage) marker. The `#` prefix is required — it is what
|
|
147
|
+
* separates a real heading from the many in-body `§ n` cross-references, which the
|
|
148
|
+
* converter leaves as plain (indented) text.
|
|
149
|
+
*/
|
|
150
|
+
const SECTION_HEADING = /^#{1,6}[ \t]+(§§?[ \t]*\d+[ \t]*[a-z]?|Art(?:ikel|\.)[ \t]*[\dIVXLC]+[ \t]*[a-z]?|Anlage(?:[ \t]+[\dA-Za-z]+)?)/gim;
|
|
151
|
+
/**
|
|
152
|
+
* Segment rendered document text into its §/Artikel/Anlage sections. Each heading starts a
|
|
153
|
+
* section running to the next heading; text before the first heading becomes `Präambel`.
|
|
154
|
+
* Paragraph (§) sections are qualified by their containing article (`Artikel 25 § 39`) so
|
|
155
|
+
* names stay unique across a bill that amends many laws; any residual collision gets a
|
|
156
|
+
* ` (n)` suffix. Returns `[]` when the text carries no structural headings (e.g. a raw
|
|
157
|
+
* html/xml rendition) — the caller reads that as "nothing to outline".
|
|
158
|
+
*/
|
|
159
|
+
export function segmentDocument(text) {
|
|
160
|
+
const marks = [...text.matchAll(SECTION_HEADING)].map((match) => ({
|
|
161
|
+
index: match.index,
|
|
162
|
+
marker: (match[1] ?? '').replace(/[ \t]+/gu, ' ').trim(),
|
|
163
|
+
}));
|
|
164
|
+
const firstMark = marks[0];
|
|
165
|
+
if (firstMark === undefined)
|
|
166
|
+
return [];
|
|
167
|
+
const encoder = new TextEncoder();
|
|
168
|
+
const sections = [];
|
|
169
|
+
const counts = new Map();
|
|
170
|
+
const push = (name, slice) => {
|
|
171
|
+
const seen = (counts.get(name) ?? 0) + 1;
|
|
172
|
+
counts.set(name, seen);
|
|
173
|
+
sections.push({
|
|
174
|
+
name: seen > 1 ? `${name} (${seen})` : name,
|
|
175
|
+
text: slice,
|
|
176
|
+
bytes: encoder.encode(slice).length,
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
if (firstMark.index > 0) {
|
|
180
|
+
const preamble = text.slice(0, firstMark.index);
|
|
181
|
+
if (preamble.trim() !== '')
|
|
182
|
+
push('Präambel', preamble);
|
|
183
|
+
}
|
|
184
|
+
let container = '';
|
|
185
|
+
marks.forEach((mark, i) => {
|
|
186
|
+
const end = marks[i + 1]?.index ?? text.length;
|
|
187
|
+
const isContainer = /^(?:Art|Anlage)/iu.test(mark.marker);
|
|
188
|
+
if (isContainer)
|
|
189
|
+
container = mark.marker;
|
|
190
|
+
const name = !isContainer && container !== '' ? `${container} ${mark.marker}` : mark.marker;
|
|
191
|
+
push(name, text.slice(mark.index, end));
|
|
192
|
+
});
|
|
193
|
+
return sections;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Return the concatenated text of the named sections, or `undefined` when none match — the
|
|
197
|
+
* selective-retrieval counterpart to the outline. The handler re-fetches the document (the
|
|
198
|
+
* upstream query is deterministic, so it reproduces the same text) and slices it to the
|
|
199
|
+
* requested sections; a no-match falls through to a fresh outline so the agent can re-pick.
|
|
200
|
+
*/
|
|
201
|
+
export function selectDocumentSections(text, want) {
|
|
202
|
+
const wanted = new Set(want);
|
|
203
|
+
const matched = segmentDocument(text).filter((section) => wanted.has(section.name));
|
|
204
|
+
return matched.length > 0 ? matched.map((section) => section.text).join('\n\n') : undefined;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Apply the outline-on-overflow contract to rendered document text: whole under the byte
|
|
208
|
+
* budget (or with fewer than two structural sections), else a section outline. Shares
|
|
209
|
+
* {@link segmentDocument} as the section extractor so the tool and the resource segment
|
|
210
|
+
* identically; the `notice` builder is caller-specific (each points at its own re-call).
|
|
211
|
+
*/
|
|
212
|
+
export function outlineDocument(text, notice) {
|
|
213
|
+
return outlineOnOverflow({ text }, {
|
|
214
|
+
budget: OUTLINE_BUDGET_BYTES,
|
|
215
|
+
extract: (doc) => segmentDocument(doc.text).map(({ name, bytes }) => ({ name, bytes })),
|
|
216
|
+
notice,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/** Name the three largest sections, quoted, as examples for a re-call notice. */
|
|
220
|
+
export function exampleSectionNames(sections) {
|
|
221
|
+
return sections
|
|
222
|
+
.slice(0, 3)
|
|
223
|
+
.map((section) => `"${section.name}"`)
|
|
224
|
+
.join(', ');
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Render an overflow outline — the section roster the agent picks from — to markdown.
|
|
228
|
+
* Shared by the tool's `format()` (as a content block) and the resource (as its body), so
|
|
229
|
+
* both client surfaces list identical sections.
|
|
230
|
+
*/
|
|
231
|
+
export function renderOutlineSections(sections) {
|
|
232
|
+
return [
|
|
233
|
+
`**${sections.length} sections** (document too large to inline — retrieve by name):`,
|
|
234
|
+
...sections.map((section) => `- \`${section.name}\` — ${section.bytes} bytes`),
|
|
235
|
+
].join('\n');
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Resolve, construct URLs for, and (for text formats on text-bearing applications) fetch
|
|
239
|
+
* and convert one RIS document. Throws framework errors (`validationError` for an unknown
|
|
240
|
+
* application or unsafe document number; `notFound`/`serviceUnavailable`/`timeout` from the
|
|
241
|
+
* content fetch) — callers map these onto their own typed contract.
|
|
242
|
+
*/
|
|
243
|
+
export async function renderDocument(applicationCode, documentNumber, format, ctx) {
|
|
244
|
+
const app = APPLICATION_BY_CODE.get(applicationCode);
|
|
245
|
+
if (!app) {
|
|
246
|
+
throw validationError(`Unknown RIS application "${applicationCode}".`, {
|
|
247
|
+
application: applicationCode,
|
|
248
|
+
valid: [...APPLICATION_BY_CODE.keys()],
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const service = getRisService();
|
|
252
|
+
const urls = buildRenditionUrls(service, app, documentNumber);
|
|
253
|
+
const base = {
|
|
254
|
+
application: app.code,
|
|
255
|
+
bindingStatus: app.binding,
|
|
256
|
+
contentUrls: urls.contentUrls,
|
|
257
|
+
documentNumber,
|
|
258
|
+
format,
|
|
259
|
+
...(urls.authenticPdfUrl !== undefined && { authenticPdfUrl: urls.authenticPdfUrl }),
|
|
260
|
+
};
|
|
261
|
+
// No usable payload for the request: a metadata-only application (no URLs at all, any
|
|
262
|
+
// format), or a text format against an application with no text rendition.
|
|
263
|
+
if (app.formats === 'none' || (format !== 'urls_only' && app.formats !== 'full')) {
|
|
264
|
+
return { ...base, unavailableNotice: formatUnavailableNotice(app, format, urls) };
|
|
265
|
+
}
|
|
266
|
+
// urls_only on a full / authentic-PDF-only / PDF-only application — URLs already in base.
|
|
267
|
+
if (format === 'urls_only')
|
|
268
|
+
return base;
|
|
269
|
+
const fetchFormat = format === 'xml' ? 'xml' : 'html';
|
|
270
|
+
const url = service.buildDocumentContentUrl(app.code, documentNumber, fetchFormat);
|
|
271
|
+
const fetched = await service.fetchDocumentContent(url, ctx);
|
|
272
|
+
const rendered = format === 'markdown' ? NodeHtmlMarkdown.translate(fetched.text) : fetched.text;
|
|
273
|
+
const encoded = new TextEncoder().encode(rendered);
|
|
274
|
+
ctx.log.info('Document rendered', {
|
|
275
|
+
application: app.code,
|
|
276
|
+
byteSize: encoded.length,
|
|
277
|
+
format,
|
|
278
|
+
});
|
|
279
|
+
return { ...base, byteSize: encoded.length, text: rendered };
|
|
280
|
+
}
|
|
281
|
+
const ContentUrlsSchema = z
|
|
282
|
+
.object({
|
|
283
|
+
xml: z.string().optional().describe('XML rendition URL (RIS Nutzdaten schema).'),
|
|
284
|
+
html: z.string().optional().describe('HTML rendition URL.'),
|
|
285
|
+
pdf: z.string().optional().describe('PDF rendition URL.'),
|
|
286
|
+
rtf: z.string().optional().describe('RTF rendition URL.'),
|
|
287
|
+
})
|
|
288
|
+
.describe('Constructed rendition URLs. Empty for authentic-PDF-only (Bvb/GrA/KmGer) and metadata-only (BgblAlt) applications — see authentic_pdf_url and the notice.');
|
|
289
|
+
export const risGetDocument = tool('ris_get_document', {
|
|
290
|
+
title: 'Get RIS Document',
|
|
291
|
+
description: 'Fetch one RIS document’s full text or its rendition URLs, with explicit binding status and the amtssigniert authentic PDF surfaced wherever it exists. Address the document exactly one of two ways: document_number plus application (both copied verbatim from a ris_search_* or ris_lookup_citation result), or a document_url from a result’s content_urls. format: markdown (default — the HTML rendition converted to markdown), html (raw HTML rendition), xml (the RIS Nutzdaten XML), or urls_only (no fetch — every rendition URL, including the Authentisch PDF). Format availability varies by application and the tool degrades explicitly, never silently: consolidated law, gazettes, case law, drafts, and most sectoral collections carry full text; district and municipal promulgations and court rules (Bvb, GrA, KmGer) publish only the signed authentic PDF; party-transparency decisions and council minutes (Upts, Mrp) are PDF-only; the 1848–1940 imperial gazettes (BgblAlt) are metadata-only — for these a text-format request returns a format_unavailable notice with the usable URL, not an error. Every result carries binding_status; only authentic (amtssigniert) publications are legally binding. This tool returns content, not fresh metadata — the metadata rides the search/lookup step that produced the document number. When the markdown text overflows the byte budget the tool returns a §/Artikel/Anlage section outline (kind: outline) instead of truncating; re-call with sections:[…] naming outline entries to retrieve just those. Raw html/xml renditions, which carry no such headings, return in full.',
|
|
292
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
293
|
+
input: z.object({
|
|
294
|
+
document_number: z
|
|
295
|
+
.string()
|
|
296
|
+
.optional()
|
|
297
|
+
.describe('Technical RIS document number (Technisch.ID), e.g. NOR40262691, JJT_…, BGBLA_2026_II_171 — copy verbatim from a ris_search_* or ris_lookup_citation result. Requires application; mutually exclusive with document_url.'),
|
|
298
|
+
application: z
|
|
299
|
+
.enum(APPLICATION_CODES)
|
|
300
|
+
.optional()
|
|
301
|
+
.describe('RIS application the document belongs to (e.g. BrKons, Dsk, BgblAuth) — copy verbatim from the same result. Required with document_number. Codes and coverage: ris_list_reference topic applications.'),
|
|
302
|
+
document_url: z
|
|
303
|
+
.string()
|
|
304
|
+
.optional()
|
|
305
|
+
.describe('A https://www.ris.bka.gv.at/Dokumente/… main-document rendition URL as returned in a result’s content_urls — the alternative to document_number + application. Must address a main-document rendition ({documentNumber}.{ext}); content-attachment URLs (Materialien_/Anlagen_… memoranda and annexes) are not fetchable this way.'),
|
|
306
|
+
format: z
|
|
307
|
+
.enum(['markdown', 'html', 'xml', 'urls_only'])
|
|
308
|
+
.default('markdown')
|
|
309
|
+
.describe('markdown (default — the HTML rendition converted to markdown), html (raw HTML rendition), xml (RIS Nutzdaten schema), or urls_only (no fetch — all rendition URLs incl. the authentic PDF).'),
|
|
310
|
+
sections: z
|
|
311
|
+
.array(z.string())
|
|
312
|
+
.optional()
|
|
313
|
+
.describe('Section names to retrieve, each copied verbatim from a prior outline response (kind: outline). Omit for the full document — which returns a §/Artikel/Anlage outline instead when the markdown overflows the byte budget. Applies to text formats; ignored for urls_only.'),
|
|
314
|
+
}),
|
|
315
|
+
output: z.object({
|
|
316
|
+
text: z
|
|
317
|
+
.string()
|
|
318
|
+
.optional()
|
|
319
|
+
.describe('The document text in the requested format. Absent for urls_only and when the application carries no text rendition (see the notice).'),
|
|
320
|
+
format: z
|
|
321
|
+
.enum(['markdown', 'html', 'xml', 'urls_only'])
|
|
322
|
+
.describe('The format served — echoes the requested format.'),
|
|
323
|
+
byte_size: z
|
|
324
|
+
.number()
|
|
325
|
+
.optional()
|
|
326
|
+
.describe('Full UTF-8 byte size of the document text. Present when text was fetched — for an overflowed document (kind: outline) this reports the full text’s size, not the outline payload’s.'),
|
|
327
|
+
truncated: z
|
|
328
|
+
.boolean()
|
|
329
|
+
.optional()
|
|
330
|
+
.describe('Present and true when the full text isn’t inline because the document overflowed to a section outline (kind: outline) — retrieve sections via the sections input, or fetch content_urls for the whole artifact.'),
|
|
331
|
+
kind: z
|
|
332
|
+
.enum(['full', 'outline'])
|
|
333
|
+
.describe('full — the complete response (document text, selected sections, or rendition URLs). outline — the text overflowed the byte budget, so sections lists the retrievable §/Artikel/Anlage units; re-call with sections:[…] to fetch specific ones.'),
|
|
334
|
+
sections: z
|
|
335
|
+
.array(OUTLINE_VARIANT.shape.sections.element.describe('A retrievable §/Artikel/Anlage section — its name and UTF-8 byte size.'))
|
|
336
|
+
.optional()
|
|
337
|
+
.describe('Present when kind = outline: the document’s §/Artikel/Anlage sections, largest first, each with its UTF-8 byte size. Copy names into the sections input to retrieve them.'),
|
|
338
|
+
binding_status: z
|
|
339
|
+
.enum(BINDING_STATUSES)
|
|
340
|
+
.describe('Legal binding status: authentic (amtssigniert, legally binding), consolidated_informational (consolidated view — not binding), historical_record (superseded/pre-e-Recht promulgation), decision (court/tribunal ruling), preparatory (draft/bill/minutes), administrative_directive (binds the administration, not citizens), or translation (unofficial English).'),
|
|
341
|
+
content_urls: ContentUrlsSchema,
|
|
342
|
+
authentic_pdf_url: z
|
|
343
|
+
.string()
|
|
344
|
+
.optional()
|
|
345
|
+
.describe('The amtssigniert authentic PDF (.pdfsig, Authentisch DataType) — the legally binding artifact — where the application publishes one.'),
|
|
346
|
+
document_number: z.string().describe('Technical RIS document number (echoed).'),
|
|
347
|
+
application: z.string().describe('RIS application the document belongs to (echoed).'),
|
|
348
|
+
}),
|
|
349
|
+
enrichment: {
|
|
350
|
+
notice: z
|
|
351
|
+
.string()
|
|
352
|
+
.optional()
|
|
353
|
+
.describe('Agent-facing notice: either the requested text format is unavailable for this application (names why and the usable URL), or the document overflowed to a section outline (names how to retrieve sections).'),
|
|
354
|
+
},
|
|
355
|
+
errors: [
|
|
356
|
+
{
|
|
357
|
+
reason: 'invalid_addressing',
|
|
358
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
359
|
+
when: 'Neither or both addressing modes were provided, document_number was given without application, or the document_number/application pairing is not a valid RIS document — thrown locally before any fetch.',
|
|
360
|
+
recovery: 'Provide exactly one addressing mode: document_number plus application (both from one search result), or a document_url from a result’s content_urls.',
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
reason: 'unsupported_url',
|
|
364
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
365
|
+
when: 'document_url fails the host + /Dokumente/ path-prefix allowlist, or its path segment is not a recognized RIS application — thrown locally, nothing fetched.',
|
|
366
|
+
recovery: 'Only ris.bka.gv.at /Dokumente/ URLs are fetchable — pass a URL exactly as returned in content_urls, or switch to document_number + application.',
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
reason: 'document_not_found',
|
|
370
|
+
code: JsonRpcErrorCode.NotFound,
|
|
371
|
+
when: 'The constructed or passed content URL returned 404.',
|
|
372
|
+
recovery: 'The document_number/application pairing didn’t resolve — copy both verbatim from a fresh search result, or resolve the citation with ris_lookup_citation. Document numbers are application-specific.',
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
reason: 'upstream_error',
|
|
376
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
377
|
+
when: 'The RIS content host was unreachable or returned a server error.',
|
|
378
|
+
retryable: true,
|
|
379
|
+
recovery: 'The RIS content host is temporarily unavailable — retry the fetch after a short delay.',
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
async handler(input, ctx) {
|
|
383
|
+
const documentNumber = meaningful(input.document_number);
|
|
384
|
+
const application = meaningful(input.application);
|
|
385
|
+
const documentUrl = meaningful(input.document_url);
|
|
386
|
+
const { format } = input;
|
|
387
|
+
const failAddressing = (message) => ctx.fail('invalid_addressing', message, { ...ctx.recoveryFor('invalid_addressing') });
|
|
388
|
+
let resolvedApplication;
|
|
389
|
+
let resolvedDocumentNumber;
|
|
390
|
+
if (documentUrl !== undefined) {
|
|
391
|
+
if (documentNumber !== undefined || application !== undefined) {
|
|
392
|
+
throw failAddressing('Provide document_url OR document_number + application, not both addressing modes.');
|
|
393
|
+
}
|
|
394
|
+
const parsed = parseDocumentUrl(documentUrl, getServerConfig().contentBaseUrl);
|
|
395
|
+
if ('error' in parsed) {
|
|
396
|
+
throw ctx.fail('unsupported_url', `document_url is not fetchable — ${parsed.error}.`, {
|
|
397
|
+
...ctx.recoveryFor('unsupported_url'),
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
resolvedApplication = parsed.application;
|
|
401
|
+
resolvedDocumentNumber = parsed.documentNumber;
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
if (documentNumber === undefined || application === undefined) {
|
|
405
|
+
throw failAddressing('Provide document_number together with application, or a document_url instead.');
|
|
406
|
+
}
|
|
407
|
+
resolvedApplication = application;
|
|
408
|
+
resolvedDocumentNumber = documentNumber;
|
|
409
|
+
}
|
|
410
|
+
// Map framework errors from resolution/fetch onto this tool's declared contract.
|
|
411
|
+
const rendition = await renderDocument(resolvedApplication, resolvedDocumentNumber, format, ctx).catch((err) => {
|
|
412
|
+
if (err instanceof McpError) {
|
|
413
|
+
if (err.code === JsonRpcErrorCode.ValidationError) {
|
|
414
|
+
throw ctx.fail('invalid_addressing', err.message, {
|
|
415
|
+
...ctx.recoveryFor('invalid_addressing'),
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
if (err.code === JsonRpcErrorCode.NotFound) {
|
|
419
|
+
throw ctx.fail('document_not_found', err.message, {
|
|
420
|
+
...ctx.recoveryFor('document_not_found'),
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
if (err.code === JsonRpcErrorCode.ServiceUnavailable) {
|
|
424
|
+
throw ctx.fail('upstream_error', err.message, { ...ctx.recoveryFor('upstream_error') });
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
throw err;
|
|
428
|
+
});
|
|
429
|
+
const base = {
|
|
430
|
+
application: rendition.application,
|
|
431
|
+
binding_status: rendition.bindingStatus,
|
|
432
|
+
content_urls: rendition.contentUrls,
|
|
433
|
+
document_number: rendition.documentNumber,
|
|
434
|
+
format: rendition.format,
|
|
435
|
+
...(rendition.authenticPdfUrl !== undefined && {
|
|
436
|
+
authentic_pdf_url: rendition.authenticPdfUrl,
|
|
437
|
+
}),
|
|
438
|
+
};
|
|
439
|
+
// No text payload — format_unavailable (with its notice) or urls_only. Complete either way.
|
|
440
|
+
if (rendition.text === undefined) {
|
|
441
|
+
if (rendition.unavailableNotice !== undefined)
|
|
442
|
+
ctx.enrich.notice(rendition.unavailableNotice);
|
|
443
|
+
return { ...base, kind: 'full' };
|
|
444
|
+
}
|
|
445
|
+
const { byteSize } = rendition;
|
|
446
|
+
const requestedSections = input.sections?.filter((name) => name.trim() !== '') ?? [];
|
|
447
|
+
// Selective retrieval — the re-call after an outline. A no-match falls through to a fresh
|
|
448
|
+
// outline so the agent can re-pick valid section names.
|
|
449
|
+
if (requestedSections.length > 0) {
|
|
450
|
+
const selected = selectDocumentSections(rendition.text, requestedSections);
|
|
451
|
+
if (selected !== undefined) {
|
|
452
|
+
return {
|
|
453
|
+
...base,
|
|
454
|
+
kind: 'full',
|
|
455
|
+
text: selected,
|
|
456
|
+
byte_size: new TextEncoder().encode(selected).length,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
// Disclosure — whole text under budget (or unsegmentable), else a section outline.
|
|
461
|
+
const decision = outlineDocument(rendition.text, (sections) => `Document too large to return in full${byteSize !== undefined ? ` (${byteSize} bytes)` : ''}. Re-call ris_get_document with the same addressing plus sections:[…] naming entries from the outline — e.g. ${exampleSectionNames(sections)}.`);
|
|
462
|
+
if (decision.kind === 'full') {
|
|
463
|
+
return {
|
|
464
|
+
...base,
|
|
465
|
+
kind: 'full',
|
|
466
|
+
text: decision.text,
|
|
467
|
+
...(byteSize !== undefined && { byte_size: byteSize }),
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
ctx.enrich.notice(decision.notice);
|
|
471
|
+
return {
|
|
472
|
+
...base,
|
|
473
|
+
kind: 'outline',
|
|
474
|
+
sections: decision.sections,
|
|
475
|
+
truncated: true,
|
|
476
|
+
...(byteSize !== undefined && { byte_size: byteSize }),
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
// format() populates content[] — the markdown twin of structuredContent. Every output
|
|
480
|
+
// field renders here; the notice rides the enrichment trailer. The full-text (`text`) and
|
|
481
|
+
// outline (`sections`) arms render on field presence, independently — never branch on
|
|
482
|
+
// `kind` (format-parity walks one sample with every optional field populated at once).
|
|
483
|
+
format: (result) => {
|
|
484
|
+
const lines = [`## ${result.document_number} (${result.application})`];
|
|
485
|
+
lines.push(`**Binding:** ${result.binding_status} | **Format:** ${result.format} | **Kind:** ${result.kind}`);
|
|
486
|
+
if (result.byte_size !== undefined) {
|
|
487
|
+
lines.push(`**Size:** ${result.byte_size} bytes${result.truncated === true ? ' (truncated — retrieve sections from the outline below)' : ''}`);
|
|
488
|
+
}
|
|
489
|
+
if (result.authentic_pdf_url !== undefined) {
|
|
490
|
+
lines.push(`**Authentic PDF:** ${result.authentic_pdf_url}`);
|
|
491
|
+
}
|
|
492
|
+
const urls = ['html', 'pdf', 'rtf', 'xml']
|
|
493
|
+
.filter((key) => result.content_urls[key] !== undefined)
|
|
494
|
+
.map((key) => `[${key.toUpperCase()}](${result.content_urls[key]})`);
|
|
495
|
+
if (urls.length > 0)
|
|
496
|
+
lines.push(`**Renditions:** ${urls.join(' · ')}`);
|
|
497
|
+
if (result.sections !== undefined)
|
|
498
|
+
lines.push('', renderOutlineSections(result.sections));
|
|
499
|
+
if (result.text !== undefined)
|
|
500
|
+
lines.push('', result.text);
|
|
501
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
502
|
+
},
|
|
503
|
+
});
|
|
504
|
+
//# sourceMappingURL=ris-get-document.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ris-get-document.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/ris-get-document.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,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|
|
2
|
+
* @fileoverview ris_list_reference — static, offline reference for the opaque German codes
|
|
3
|
+
* across the RIS surface. No service dependency, no upstream calls: every topic renders
|
|
4
|
+
* from the typed tables in `src/services/ris/reference/`. The other ris_* tools' recovery
|
|
5
|
+
* hints and zero-hit notices route here.
|
|
6
|
+
* @module mcp-server/tools/definitions/ris-list-reference
|
|
7
|
+
*/
|
|
8
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
9
|
+
export declare const risListReference: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
10
|
+
topic: z.ZodEnum<{
|
|
11
|
+
applications: "applications";
|
|
12
|
+
courts: "courts";
|
|
13
|
+
states: "states";
|
|
14
|
+
decision_types: "decision_types";
|
|
15
|
+
decision_kinds: "decision_kinds";
|
|
16
|
+
issuing_bodies: "issuing_bodies";
|
|
17
|
+
ministries: "ministries";
|
|
18
|
+
collections: "collections";
|
|
19
|
+
stages: "stages";
|
|
20
|
+
changed_since_intervals: "changed_since_intervals";
|
|
21
|
+
section_types: "section_types";
|
|
22
|
+
gazette_parts: "gazette_parts";
|
|
23
|
+
law_types: "law_types";
|
|
24
|
+
district_authorities: "district_authorities";
|
|
25
|
+
justiz_subject_areas: "justiz_subject_areas";
|
|
26
|
+
search_syntax: "search_syntax";
|
|
27
|
+
citation_formats: "citation_formats";
|
|
28
|
+
}>;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
topic: z.ZodString;
|
|
31
|
+
summary: z.ZodString;
|
|
32
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
33
|
+
value: z.ZodString;
|
|
34
|
+
label: z.ZodString;
|
|
35
|
+
details: z.ZodArray<z.ZodObject<{
|
|
36
|
+
key: z.ZodString;
|
|
37
|
+
value: z.ZodString;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
notes: z.ZodArray<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>, undefined, undefined>;
|
|
42
|
+
//# sourceMappingURL=ris-list-reference.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ris-list-reference.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/ris-list-reference.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AA8UjD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA8E3B,CAAC"}
|