@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,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
# FORMAT REFERENCE — do not edit. Copy this file to
|
|
3
|
+
# `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
|
|
4
|
+
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
|
+
# with a concrete date.
|
|
6
|
+
|
|
7
|
+
# Required. One-line GitHub Release-style headline. 350 character cap.
|
|
8
|
+
# Default short and scannable. Don't pad, don't stitch unrelated changes with
|
|
9
|
+
# semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
|
|
10
|
+
# inside the value as a key separator and fails GitHub's strict parser.
|
|
11
|
+
summary: ""
|
|
12
|
+
|
|
13
|
+
# Set `true` when consumers must change code to upgrade: API removals,
|
|
14
|
+
# signature changes, config renames, behavior changes that break existing
|
|
15
|
+
# usage. Flagged as `Breaking` in the rollup.
|
|
16
|
+
breaking: false
|
|
17
|
+
|
|
18
|
+
# Set `true` ONLY for a security fix in THIS project's own source code — a
|
|
19
|
+
# vulnerability or hardening in code you ship. A dependency or transitive CVE
|
|
20
|
+
# bump is routine maintenance, NOT a security release: record it under
|
|
21
|
+
# `## Dependencies` (with the advisory ID) and leave this `false`. When true,
|
|
22
|
+
# pairs with the `## Security` section below and flags `Security` in the rollup.
|
|
23
|
+
security: false
|
|
24
|
+
|
|
25
|
+
# Optional free-form notes for maintenance agents processing this release.
|
|
26
|
+
# Not rendered in CHANGELOG — consumed by agents running `maintenance` on
|
|
27
|
+
# downstream servers. Use for adoption instructions that don't fit the
|
|
28
|
+
# human-facing sections: new files to create, fields to populate, one-time
|
|
29
|
+
# migration steps. Omit the field entirely when there's nothing to say.
|
|
30
|
+
# agent-notes: |
|
|
31
|
+
# <instructions for downstream maintenance agents>
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# <version> — YYYY-MM-DD
|
|
35
|
+
|
|
36
|
+
<!--
|
|
37
|
+
AUTHORING GUIDE — applies to the new per-version file you create from this
|
|
38
|
+
template.
|
|
39
|
+
|
|
40
|
+
Audience: someone scanning release notes to decide what affects them. Lead
|
|
41
|
+
each bullet with the symbol or concept name in **bold** so they can skip
|
|
42
|
+
what's irrelevant and zoom in on what's not.
|
|
43
|
+
|
|
44
|
+
Tone: terse, fact-dense, not verbose. Default to one sentence per bullet —
|
|
45
|
+
name the symbol, state what changed, stop. Use a second sentence only when
|
|
46
|
+
it carries weight. If a bullet feels long, it is.
|
|
47
|
+
|
|
48
|
+
Cut: mechanism walkthroughs (those belong in JSDoc, CLAUDE.md/AGENTS.md, or the
|
|
49
|
+
relevant skill), ceremonial framings ("This release introduces…",
|
|
50
|
+
backwards-compat paragraphs), file-by-file test enumerations, internal
|
|
51
|
+
implementation notes. Prefer code/symbol names over English re-explanations.
|
|
52
|
+
|
|
53
|
+
Narrative intro: skip by default. Add one short sentence only when the
|
|
54
|
+
release theme genuinely needs framing the bullets can't carry.
|
|
55
|
+
|
|
56
|
+
Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
|
|
57
|
+
Fixed, Security. Include only sections with entries; delete the rest
|
|
58
|
+
(including the commented-out scaffolding below). Don't ship empty headers.
|
|
59
|
+
|
|
60
|
+
Include: every distinct fact a reader needs to adopt or audit the release —
|
|
61
|
+
new exports, signatures, lint rule IDs, env vars, breaking changes, version
|
|
62
|
+
bumps on shipped skills. Nothing more.
|
|
63
|
+
|
|
64
|
+
Links: link issues, PRs, docs, or skills where they help a reader jump to
|
|
65
|
+
context. Once per item per entry — don't re-link the same issue in summary,
|
|
66
|
+
narrative, and bullet. Skip links for inline symbol names; code spans speak
|
|
67
|
+
for themselves.
|
|
68
|
+
|
|
69
|
+
Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
|
|
70
|
+
inside its own UI, not in npm reads or local editors.
|
|
71
|
+
|
|
72
|
+
[#38](https://github.com/cyanheads/mcp-ts-core/issues/38) ← issue
|
|
73
|
+
[#42](https://github.com/cyanheads/mcp-ts-core/pull/42) ← PR
|
|
74
|
+
|
|
75
|
+
Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
|
|
76
|
+
Never speculate on a future number — `#42` for an upcoming PR silently
|
|
77
|
+
resolves to whatever real item already owns 42, and timeline previews pull
|
|
78
|
+
in that unrelated item's metadata.
|
|
79
|
+
|
|
80
|
+
TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
|
|
81
|
+
via `gh release create --notes-from-tag`. The tag is a derivative of this
|
|
82
|
+
changelog entry — a condensed, scannable version, not a copy. Format:
|
|
83
|
+
|
|
84
|
+
<theme — omit version number, GitHub prepends it>
|
|
85
|
+
← blank line
|
|
86
|
+
<1-2 sentence context: what this release does>
|
|
87
|
+
← blank line
|
|
88
|
+
Dependency bumps: ← section header
|
|
89
|
+
← blank line
|
|
90
|
+
- `@cyanheads/mcp-ts-core` ^0.9.1 → ^0.9.6 ← bullet
|
|
91
|
+
← blank line
|
|
92
|
+
Changed: ← only sections with entries
|
|
93
|
+
← blank line
|
|
94
|
+
- `format()` output includes `query` in text mode
|
|
95
|
+
← blank line
|
|
96
|
+
Added:
|
|
97
|
+
← blank line
|
|
98
|
+
- `manifest.json` scaffolded for MCPB bundle support
|
|
99
|
+
- Install badges (Claude Desktop, Cursor, VS Code)
|
|
100
|
+
← blank line
|
|
101
|
+
<N> tests pass; `bun run devcheck` clean. ← footer
|
|
102
|
+
|
|
103
|
+
Never a flat comma-separated string. Always structured markdown with
|
|
104
|
+
sections. The tag must scan well as a rendered GitHub Release page.
|
|
105
|
+
-->
|
|
106
|
+
|
|
107
|
+
## Added
|
|
108
|
+
|
|
109
|
+
-
|
|
110
|
+
|
|
111
|
+
## Changed
|
|
112
|
+
|
|
113
|
+
-
|
|
114
|
+
|
|
115
|
+
<!-- ## Deprecated
|
|
116
|
+
|
|
117
|
+
- -->
|
|
118
|
+
|
|
119
|
+
<!-- ## Removed
|
|
120
|
+
|
|
121
|
+
- -->
|
|
122
|
+
|
|
123
|
+
## Fixed
|
|
124
|
+
|
|
125
|
+
-
|
|
126
|
+
|
|
127
|
+
<!-- ## Security
|
|
128
|
+
|
|
129
|
+
- -->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific environment configuration for ris-austria-mcp-server.
|
|
3
|
+
* All three variables are optional — the RIS OGD API is keyless.
|
|
4
|
+
* @module config/server-config
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
declare const ServerConfigSchema: z.ZodObject<{
|
|
8
|
+
apiBaseUrl: z.ZodDefault<z.ZodURL>;
|
|
9
|
+
contentBaseUrl: z.ZodDefault<z.ZodURL>;
|
|
10
|
+
contact: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* Lazily parse and cache the server config from the environment.
|
|
15
|
+
* Lazy so Workers-style runtimes can inject env vars before first use.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getServerConfig(): ServerConfig;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB;;;;iBAetB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D;;;GAGG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAO9C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific environment configuration for ris-austria-mcp-server.
|
|
3
|
+
* All three variables are optional — the RIS OGD API is keyless.
|
|
4
|
+
* @module config/server-config
|
|
5
|
+
*/
|
|
6
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
8
|
+
const ServerConfigSchema = z.object({
|
|
9
|
+
apiBaseUrl: z
|
|
10
|
+
.url()
|
|
11
|
+
.default('https://data.bka.gv.at/ris/api/v2.6')
|
|
12
|
+
.describe('RIS OGD REST API base URL.'),
|
|
13
|
+
contentBaseUrl: z
|
|
14
|
+
.url()
|
|
15
|
+
.default('https://www.ris.bka.gv.at')
|
|
16
|
+
.describe('RIS document content host — also the allowlist host for document_url fetches.'),
|
|
17
|
+
contact: z
|
|
18
|
+
.string()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe('Contact string appended to the User-Agent (RIS netiquette asks integrators to be identifiable).'),
|
|
21
|
+
});
|
|
22
|
+
let _config;
|
|
23
|
+
/**
|
|
24
|
+
* Lazily parse and cache the server config from the environment.
|
|
25
|
+
* Lazy so Workers-style runtimes can inject env vars before first use.
|
|
26
|
+
*/
|
|
27
|
+
export function getServerConfig() {
|
|
28
|
+
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
29
|
+
apiBaseUrl: 'RIS_API_BASE_URL',
|
|
30
|
+
contentBaseUrl: 'RIS_CONTENT_BASE_URL',
|
|
31
|
+
contact: 'RIS_CONTACT',
|
|
32
|
+
});
|
|
33
|
+
return _config;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=server-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,UAAU,EAAE,CAAC;SACV,GAAG,EAAE;SACL,OAAO,CAAC,qCAAqC,CAAC;SAC9C,QAAQ,CAAC,4BAA4B,CAAC;IACzC,cAAc,EAAE,CAAC;SACd,GAAG,EAAE;SACL,OAAO,CAAC,2BAA2B,CAAC;SACpC,QAAQ,CAAC,+EAA+E,CAAC;IAC5F,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,iGAAiG,CAClG;CACJ,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,UAAU,EAAE,kBAAkB;QAC9B,cAAc,EAAE,sBAAsB;QACtC,OAAO,EAAE,aAAa;KACvB,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview ris-austria-mcp-server MCP server entry point.
|
|
4
|
+
* @module index
|
|
5
|
+
*/
|
|
6
|
+
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { risDocumentResource } from './mcp-server/resources/definitions/ris-document.resource.js';
|
|
8
|
+
import { risGetDocument } from './mcp-server/tools/definitions/ris-get-document.tool.js';
|
|
9
|
+
import { risListReference } from './mcp-server/tools/definitions/ris-list-reference.tool.js';
|
|
10
|
+
import { risLookupCitation } from './mcp-server/tools/definitions/ris-lookup-citation.tool.js';
|
|
11
|
+
import { risSearchAnnouncements } from './mcp-server/tools/definitions/ris-search-announcements.tool.js';
|
|
12
|
+
import { risSearchCaseLaw } from './mcp-server/tools/definitions/ris-search-case-law.tool.js';
|
|
13
|
+
import { risSearchDrafts } from './mcp-server/tools/definitions/ris-search-drafts.tool.js';
|
|
14
|
+
import { risSearchGazette } from './mcp-server/tools/definitions/ris-search-gazette.tool.js';
|
|
15
|
+
import { risSearchLegislation } from './mcp-server/tools/definitions/ris-search-legislation.tool.js';
|
|
16
|
+
import { risTrackChanges } from './mcp-server/tools/definitions/ris-track-changes.tool.js';
|
|
17
|
+
import { initRisService } from './services/ris/ris-service.js';
|
|
18
|
+
await createApp({
|
|
19
|
+
name: 'ris-austria-mcp-server',
|
|
20
|
+
title: 'ris-austria-mcp-server',
|
|
21
|
+
tools: [
|
|
22
|
+
risSearchLegislation,
|
|
23
|
+
risSearchCaseLaw,
|
|
24
|
+
risSearchGazette,
|
|
25
|
+
risSearchDrafts,
|
|
26
|
+
risSearchAnnouncements,
|
|
27
|
+
risLookupCitation,
|
|
28
|
+
risGetDocument,
|
|
29
|
+
risTrackChanges,
|
|
30
|
+
risListReference,
|
|
31
|
+
],
|
|
32
|
+
resources: [risDocumentResource],
|
|
33
|
+
setup(core) {
|
|
34
|
+
initRisService(core.config);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,iEAAiE,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,4DAA4D,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,SAAS,CAAC;IACd,IAAI,EAAE,wBAAwB;IAC9B,KAAK,EAAE,wBAAwB;IAC/B,KAAK,EAAE;QACL,oBAAoB;QACpB,gBAAgB;QAChB,gBAAgB;QAChB,eAAe;QACf,sBAAsB;QACtB,iBAAiB;QACjB,cAAc;QACd,eAAe;QACf,gBAAgB;KACjB;IACD,SAAS,EAAE,CAAC,mBAAmB,CAAC;IAChC,KAAK,CAAC,IAAI;QACR,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ris://document/{application}/{documentNumber} — the injectable markdown twin
|
|
3
|
+
* of ris_get_document. Reads the same content path (HTML rendition converted to markdown) for
|
|
4
|
+
* an (application, documentNumber) pair. Applications with no text rendition (authentic-PDF-only,
|
|
5
|
+
* PDF-only, or metadata-only) return a short note pointing at the usable artifact instead of
|
|
6
|
+
* text. Oversized text degrades to the same §/Artikel/Anlage section outline the tool emits,
|
|
7
|
+
* plus a note pointing at ris_get_document (which carries the sections selector this bare-string
|
|
8
|
+
* resource cannot). Backed by the shared renderDocument helper from the tool definition.
|
|
9
|
+
* @module mcp-server/resources/definitions/ris-document
|
|
10
|
+
*/
|
|
11
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
12
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
13
|
+
export declare const risDocumentResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
14
|
+
application: z.ZodEnum<{
|
|
15
|
+
[x: string]: string;
|
|
16
|
+
}>;
|
|
17
|
+
documentNumber: z.ZodString;
|
|
18
|
+
}, z.core.$strip>, undefined, readonly [{
|
|
19
|
+
readonly reason: "document_not_found";
|
|
20
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
21
|
+
readonly when: "The application/documentNumber pair is not a valid RIS document, or its content URL returned 404.";
|
|
22
|
+
readonly recovery: "Copy the application and document number verbatim from a fresh search result, or resolve the citation with ris_lookup_citation. Document numbers are application-specific.";
|
|
23
|
+
}, {
|
|
24
|
+
readonly reason: "upstream_error";
|
|
25
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
26
|
+
readonly when: "The RIS content host was unreachable or returned a server error.";
|
|
27
|
+
readonly retryable: true;
|
|
28
|
+
readonly recovery: "The RIS content host is temporarily unavailable — retry the read after a short delay.";
|
|
29
|
+
}]>;
|
|
30
|
+
//# sourceMappingURL=ris-document.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ris-document.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/ris-document.resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAY3E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;GA2E9B,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ris://document/{application}/{documentNumber} — the injectable markdown twin
|
|
3
|
+
* of ris_get_document. Reads the same content path (HTML rendition converted to markdown) for
|
|
4
|
+
* an (application, documentNumber) pair. Applications with no text rendition (authentic-PDF-only,
|
|
5
|
+
* PDF-only, or metadata-only) return a short note pointing at the usable artifact instead of
|
|
6
|
+
* text. Oversized text degrades to the same §/Artikel/Anlage section outline the tool emits,
|
|
7
|
+
* plus a note pointing at ris_get_document (which carries the sections selector this bare-string
|
|
8
|
+
* resource cannot). Backed by the shared renderDocument helper from the tool definition.
|
|
9
|
+
* @module mcp-server/resources/definitions/ris-document
|
|
10
|
+
*/
|
|
11
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
12
|
+
import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
|
|
13
|
+
import { exampleSectionNames, outlineDocument, renderDocument, renderOutlineSections, } from '../../../mcp-server/tools/definitions/ris-get-document.tool.js';
|
|
14
|
+
import { RIS_APPLICATIONS } from '../../../services/ris/reference/index.js';
|
|
15
|
+
const APPLICATION_CODES = RIS_APPLICATIONS.map((app) => app.code);
|
|
16
|
+
export const risDocumentResource = resource('ris://document/{application}/{documentNumber}', {
|
|
17
|
+
name: 'ris_document',
|
|
18
|
+
title: 'RIS Document (Markdown)',
|
|
19
|
+
description: 'Markdown text of one RIS document — the injectable twin of ris_get_document (markdown format). Addressed by application code and technical document number, both copied verbatim from a ris_search_* or ris_lookup_citation result. Applications that publish no text rendition (district/municipal promulgations, court rules, party-transparency decisions, council minutes, and the 1848–1940 imperial gazettes) return a short note pointing at the authentic PDF or scan instead.',
|
|
20
|
+
mimeType: 'text/markdown',
|
|
21
|
+
params: z.object({
|
|
22
|
+
application: z
|
|
23
|
+
.enum(APPLICATION_CODES)
|
|
24
|
+
.describe('RIS application code the document belongs to (e.g. BrKons, Dsk, BgblAuth). Codes: ris_list_reference topic applications.'),
|
|
25
|
+
documentNumber: z
|
|
26
|
+
.string()
|
|
27
|
+
.describe('Technical RIS document number (Technisch.ID), e.g. NOR40262691.'),
|
|
28
|
+
}),
|
|
29
|
+
examples: [
|
|
30
|
+
{ name: 'A consolidated federal-law document', uri: 'ris://document/BrKons/NOR40262691' },
|
|
31
|
+
],
|
|
32
|
+
errors: [
|
|
33
|
+
{
|
|
34
|
+
reason: 'document_not_found',
|
|
35
|
+
code: JsonRpcErrorCode.NotFound,
|
|
36
|
+
when: 'The application/documentNumber pair is not a valid RIS document, or its content URL returned 404.',
|
|
37
|
+
recovery: 'Copy the application and document number verbatim from a fresh search result, or resolve the citation with ris_lookup_citation. Document numbers are application-specific.',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
reason: 'upstream_error',
|
|
41
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
42
|
+
when: 'The RIS content host was unreachable or returned a server error.',
|
|
43
|
+
retryable: true,
|
|
44
|
+
recovery: 'The RIS content host is temporarily unavailable — retry the read after a short delay.',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
async handler(params, ctx) {
|
|
48
|
+
// Map framework errors from resolution/fetch onto this resource's declared contract.
|
|
49
|
+
const rendition = await renderDocument(params.application, params.documentNumber, 'markdown', ctx).catch((err) => {
|
|
50
|
+
if (err instanceof McpError) {
|
|
51
|
+
if (err.code === JsonRpcErrorCode.ValidationError ||
|
|
52
|
+
err.code === JsonRpcErrorCode.NotFound) {
|
|
53
|
+
throw ctx.fail('document_not_found', err.message, {
|
|
54
|
+
...ctx.recoveryFor('document_not_found'),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (err.code === JsonRpcErrorCode.ServiceUnavailable) {
|
|
58
|
+
throw ctx.fail('upstream_error', err.message, { ...ctx.recoveryFor('upstream_error') });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
throw err;
|
|
62
|
+
});
|
|
63
|
+
if (rendition.unavailableNotice !== undefined)
|
|
64
|
+
return rendition.unavailableNotice;
|
|
65
|
+
if (rendition.text === undefined)
|
|
66
|
+
return '';
|
|
67
|
+
// Oversized markdown degrades to a section outline plus a notice pointing at the
|
|
68
|
+
// ris_get_document tool — this bare-string surface carries no section selector.
|
|
69
|
+
const decision = outlineDocument(rendition.text, (sections) => `Document too large to inline${rendition.byteSize !== undefined ? ` (${rendition.byteSize} bytes)` : ''}. Use the ris_get_document tool with sections:[…] to retrieve specific sections — e.g. ${exampleSectionNames(sections)}. This resource carries no section selector.`);
|
|
70
|
+
return decision.kind === 'full'
|
|
71
|
+
? decision.text
|
|
72
|
+
: `${renderOutlineSections(decision.sections)}\n\n${decision.notice}`;
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=ris-document.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ris-document.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/ris-document.resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,qBA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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared Zod schemas reused across multiple tool definitions.
|
|
3
|
+
* @module mcp-server/tools/definitions/_shared
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
/** An ISO calendar date (YYYY-MM-DD), validated client-side before any upstream call. */
|
|
7
|
+
export declare const isoDateString: z.ZodString;
|
|
8
|
+
//# sourceMappingURL=_shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/_shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,yFAAyF;AACzF,eAAO,MAAM,aAAa,aAEkD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared Zod schemas reused across multiple tool definitions.
|
|
3
|
+
* @module mcp-server/tools/definitions/_shared
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
/** An ISO calendar date (YYYY-MM-DD), validated client-side before any upstream call. */
|
|
7
|
+
export const isoDateString = z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/u, 'Expected an ISO date in YYYY-MM-DD form.');
|
|
10
|
+
//# sourceMappingURL=_shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/_shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAE3C,yFAAyF;AACzF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,KAAK,CAAC,sBAAsB,EAAE,0CAA0C,CAAC,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
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 type { Context } from '@cyanheads/mcp-ts-core';
|
|
15
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
16
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
17
|
+
import { type OutlineResult, type SectionMeta } from '@cyanheads/mcp-ts-core/utils';
|
|
18
|
+
import type { RisBindingStatus } from '../../../services/ris/reference/index.js';
|
|
19
|
+
/** Requested output format. `markdown` and `html` both read the HTML rendition. */
|
|
20
|
+
type DocumentFormat = 'markdown' | 'html' | 'xml' | 'urls_only';
|
|
21
|
+
/** Constructed rendition URLs for a document, keyed by DataType. */
|
|
22
|
+
interface RenditionContentUrls {
|
|
23
|
+
html?: string;
|
|
24
|
+
pdf?: string;
|
|
25
|
+
rtf?: string;
|
|
26
|
+
xml?: string;
|
|
27
|
+
}
|
|
28
|
+
/** A resolved document rendition — the shared unit behind the tool and the resource. */
|
|
29
|
+
export interface DocumentRendition {
|
|
30
|
+
/** Application code the document belongs to (echoed). */
|
|
31
|
+
readonly application: string;
|
|
32
|
+
/** The amtssigniert authentic PDF (.pdfsig), where the application publishes one. */
|
|
33
|
+
readonly authenticPdfUrl?: string;
|
|
34
|
+
/** Legal binding status of the application's documents. */
|
|
35
|
+
readonly bindingStatus: RisBindingStatus;
|
|
36
|
+
/** Full byte size (UTF-8) of the text; present when text was fetched. */
|
|
37
|
+
readonly byteSize?: number;
|
|
38
|
+
/** Constructed rendition URLs (empty for authentic-PDF-only and metadata-only apps). */
|
|
39
|
+
readonly contentUrls: RenditionContentUrls;
|
|
40
|
+
/** Technical document number (echoed). */
|
|
41
|
+
readonly documentNumber: string;
|
|
42
|
+
/** The format served (echoes the request). */
|
|
43
|
+
readonly format: DocumentFormat;
|
|
44
|
+
/** Document text in the requested format; absent for urls_only and unavailable formats. */
|
|
45
|
+
readonly text?: string;
|
|
46
|
+
/** Present when the requested text format is unavailable for this application. */
|
|
47
|
+
readonly unavailableNotice?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Result of parsing a caller-supplied document_url into an application + document number. */
|
|
50
|
+
type ParsedDocumentUrl = {
|
|
51
|
+
readonly application: string;
|
|
52
|
+
readonly documentNumber: string;
|
|
53
|
+
} | {
|
|
54
|
+
readonly error: string;
|
|
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 declare function parseDocumentUrl(url: string, contentBaseUrl: string): ParsedDocumentUrl;
|
|
62
|
+
/**
|
|
63
|
+
* One addressable section of a rendered RIS document — a structural unit sliced from its
|
|
64
|
+
* heading up to the next, plus the leading `Präambel` when the document opens with text
|
|
65
|
+
* before its first heading.
|
|
66
|
+
*/
|
|
67
|
+
export interface DocumentSection {
|
|
68
|
+
/** UTF-8 byte size of the section text. */
|
|
69
|
+
readonly bytes: number;
|
|
70
|
+
/** Section identifier — a §/Artikel/Anlage marker, article-qualified so names stay unique. */
|
|
71
|
+
readonly name: string;
|
|
72
|
+
/** The section's text, from its heading up to the next heading. */
|
|
73
|
+
readonly text: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Segment rendered document text into its §/Artikel/Anlage sections. Each heading starts a
|
|
77
|
+
* section running to the next heading; text before the first heading becomes `Präambel`.
|
|
78
|
+
* Paragraph (§) sections are qualified by their containing article (`Artikel 25 § 39`) so
|
|
79
|
+
* names stay unique across a bill that amends many laws; any residual collision gets a
|
|
80
|
+
* ` (n)` suffix. Returns `[]` when the text carries no structural headings (e.g. a raw
|
|
81
|
+
* html/xml rendition) — the caller reads that as "nothing to outline".
|
|
82
|
+
*/
|
|
83
|
+
export declare function segmentDocument(text: string): DocumentSection[];
|
|
84
|
+
/**
|
|
85
|
+
* Return the concatenated text of the named sections, or `undefined` when none match — the
|
|
86
|
+
* selective-retrieval counterpart to the outline. The handler re-fetches the document (the
|
|
87
|
+
* upstream query is deterministic, so it reproduces the same text) and slices it to the
|
|
88
|
+
* requested sections; a no-match falls through to a fresh outline so the agent can re-pick.
|
|
89
|
+
*/
|
|
90
|
+
export declare function selectDocumentSections(text: string, want: readonly string[]): string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Apply the outline-on-overflow contract to rendered document text: whole under the byte
|
|
93
|
+
* budget (or with fewer than two structural sections), else a section outline. Shares
|
|
94
|
+
* {@link segmentDocument} as the section extractor so the tool and the resource segment
|
|
95
|
+
* identically; the `notice` builder is caller-specific (each points at its own re-call).
|
|
96
|
+
*/
|
|
97
|
+
export declare function outlineDocument(text: string, notice: (sections: SectionMeta[]) => string): OutlineResult<{
|
|
98
|
+
text: string;
|
|
99
|
+
}>;
|
|
100
|
+
/** Name the three largest sections, quoted, as examples for a re-call notice. */
|
|
101
|
+
export declare function exampleSectionNames(sections: readonly SectionMeta[]): string;
|
|
102
|
+
/**
|
|
103
|
+
* Render an overflow outline — the section roster the agent picks from — to markdown.
|
|
104
|
+
* Shared by the tool's `format()` (as a content block) and the resource (as its body), so
|
|
105
|
+
* both client surfaces list identical sections.
|
|
106
|
+
*/
|
|
107
|
+
export declare function renderOutlineSections(sections: readonly SectionMeta[]): string;
|
|
108
|
+
/**
|
|
109
|
+
* Resolve, construct URLs for, and (for text formats on text-bearing applications) fetch
|
|
110
|
+
* and convert one RIS document. Throws framework errors (`validationError` for an unknown
|
|
111
|
+
* application or unsafe document number; `notFound`/`serviceUnavailable`/`timeout` from the
|
|
112
|
+
* content fetch) — callers map these onto their own typed contract.
|
|
113
|
+
*/
|
|
114
|
+
export declare function renderDocument(applicationCode: string, documentNumber: string, format: DocumentFormat, ctx: Context): Promise<DocumentRendition>;
|
|
115
|
+
export declare const risGetDocument: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
116
|
+
document_number: z.ZodOptional<z.ZodString>;
|
|
117
|
+
application: z.ZodOptional<z.ZodEnum<{
|
|
118
|
+
[x: string]: string;
|
|
119
|
+
}>>;
|
|
120
|
+
document_url: z.ZodOptional<z.ZodString>;
|
|
121
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
122
|
+
html: "html";
|
|
123
|
+
xml: "xml";
|
|
124
|
+
markdown: "markdown";
|
|
125
|
+
urls_only: "urls_only";
|
|
126
|
+
}>>;
|
|
127
|
+
sections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
text: z.ZodOptional<z.ZodString>;
|
|
130
|
+
format: z.ZodEnum<{
|
|
131
|
+
html: "html";
|
|
132
|
+
xml: "xml";
|
|
133
|
+
markdown: "markdown";
|
|
134
|
+
urls_only: "urls_only";
|
|
135
|
+
}>;
|
|
136
|
+
byte_size: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
kind: z.ZodEnum<{
|
|
139
|
+
full: "full";
|
|
140
|
+
outline: "outline";
|
|
141
|
+
}>;
|
|
142
|
+
sections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
bytes: z.ZodNumber;
|
|
145
|
+
}, z.core.$strip>>>;
|
|
146
|
+
binding_status: z.ZodEnum<{
|
|
147
|
+
translation: "translation";
|
|
148
|
+
authentic: "authentic";
|
|
149
|
+
consolidated_informational: "consolidated_informational";
|
|
150
|
+
historical_record: "historical_record";
|
|
151
|
+
decision: "decision";
|
|
152
|
+
preparatory: "preparatory";
|
|
153
|
+
administrative_directive: "administrative_directive";
|
|
154
|
+
}>;
|
|
155
|
+
content_urls: z.ZodObject<{
|
|
156
|
+
xml: z.ZodOptional<z.ZodString>;
|
|
157
|
+
html: z.ZodOptional<z.ZodString>;
|
|
158
|
+
pdf: z.ZodOptional<z.ZodString>;
|
|
159
|
+
rtf: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
authentic_pdf_url: z.ZodOptional<z.ZodString>;
|
|
162
|
+
document_number: z.ZodString;
|
|
163
|
+
application: z.ZodString;
|
|
164
|
+
}, z.core.$strip>, readonly [{
|
|
165
|
+
readonly reason: "invalid_addressing";
|
|
166
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
167
|
+
readonly 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.";
|
|
168
|
+
readonly 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.";
|
|
169
|
+
}, {
|
|
170
|
+
readonly reason: "unsupported_url";
|
|
171
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
172
|
+
readonly when: "document_url fails the host + /Dokumente/ path-prefix allowlist, or its path segment is not a recognized RIS application — thrown locally, nothing fetched.";
|
|
173
|
+
readonly 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.";
|
|
174
|
+
}, {
|
|
175
|
+
readonly reason: "document_not_found";
|
|
176
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
177
|
+
readonly when: "The constructed or passed content URL returned 404.";
|
|
178
|
+
readonly 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.";
|
|
179
|
+
}, {
|
|
180
|
+
readonly reason: "upstream_error";
|
|
181
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
182
|
+
readonly when: "The RIS content host was unreachable or returned a server error.";
|
|
183
|
+
readonly retryable: true;
|
|
184
|
+
readonly recovery: "The RIS content host is temporarily unavailable — retry the fetch after a short delay.";
|
|
185
|
+
}], {
|
|
186
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}>;
|
|
188
|
+
export {};
|
|
189
|
+
//# sourceMappingURL=ris-get-document.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ris-get-document.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/ris-get-document.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAA6B,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAmB1F,mFAAmF;AACnF,KAAK,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC;AAuChE,oEAAoE;AACpE,UAAU,oBAAoB;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC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