@cyanheads/eurostat-mcp-server 0.10.0 → 0.11.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 +17 -5
- package/CLAUDE.md +17 -5
- package/Dockerfile +9 -5
- package/README.md +63 -129
- package/changelog/0.10.x/0.10.1.md +27 -0
- package/changelog/0.11.x/0.11.0.md +33 -0
- package/dist/config/server-config.d.ts +1 -0
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +9 -4
- package/dist/config/server-config.js.map +1 -1
- package/dist/index.js +29 -16
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/clamp-read-limit.d.ts +11 -0
- package/dist/mcp-server/tools/clamp-read-limit.d.ts.map +1 -0
- package/dist/mcp-server/tools/clamp-read-limit.js +14 -0
- package/dist/mcp-server/tools/clamp-read-limit.js.map +1 -0
- package/dist/mcp-server/tools/definitions/eurostat-browse-themes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-browse-themes.tool.js +6 -5
- package/dist/mcp-server/tools/definitions/eurostat-browse-themes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-dataframe-query.tool.d.ts +3 -1
- package/dist/mcp-server/tools/definitions/eurostat-dataframe-query.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-dataframe-query.tool.js +49 -33
- package/dist/mcp-server/tools/definitions/eurostat-dataframe-query.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.d.ts +100 -0
- package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.js +24 -13
- package/dist/mcp-server/tools/definitions/eurostat-download-dataset.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.d.ts +70 -1
- package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.js +35 -54
- package/dist/mcp-server/tools/definitions/eurostat-get-dimension-values.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.d.ts +103 -0
- package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.js +43 -25
- package/dist/mcp-server/tools/definitions/eurostat-query-dataset.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-search-datasets.tool.d.ts +45 -0
- package/dist/mcp-server/tools/definitions/eurostat-search-datasets.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/eurostat-search-datasets.tool.js +12 -9
- package/dist/mcp-server/tools/definitions/eurostat-search-datasets.tool.js.map +1 -1
- package/dist/mcp-server/tools/value-list-paging.d.ts +1 -29
- package/dist/mcp-server/tools/value-list-paging.d.ts.map +1 -1
- package/dist/mcp-server/tools/value-list-paging.js +1 -47
- package/dist/mcp-server/tools/value-list-paging.js.map +1 -1
- package/dist/services/eurostat-bulk/eurostat-bulk-service.d.ts.map +1 -1
- package/dist/services/eurostat-bulk/eurostat-bulk-service.js +72 -24
- package/dist/services/eurostat-bulk/eurostat-bulk-service.js.map +1 -1
- package/dist/services/eurostat-bulk/types.d.ts +1 -1
- package/dist/services/eurostat-bulk/types.d.ts.map +1 -1
- package/dist/services/eurostat-catalogue/eurostat-catalogue-service.d.ts +1 -0
- package/dist/services/eurostat-catalogue/eurostat-catalogue-service.d.ts.map +1 -1
- package/dist/services/eurostat-catalogue/eurostat-catalogue-service.js +29 -9
- package/dist/services/eurostat-catalogue/eurostat-catalogue-service.js.map +1 -1
- package/dist/services/eurostat-data/eurostat-data-service.d.ts.map +1 -1
- package/dist/services/eurostat-data/eurostat-data-service.js +32 -14
- package/dist/services/eurostat-data/eurostat-data-service.js.map +1 -1
- package/dist/services/eurostat-data/types.d.ts +4 -2
- package/dist/services/eurostat-data/types.d.ts.map +1 -1
- package/dist/services/eurostat-data/types.js +2 -2
- package/dist/services/eurostat-data/types.js.map +1 -1
- package/package.json +11 -10
- package/server.json +31 -17
- package/skills/eurostat-guide/SKILL.md +60 -0
- package/skills/eurostat-guide/references/sql-analysis.md +40 -0
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
7
7
|
const ServerConfigSchema = z.object({
|
|
8
|
+
clampLimits: z
|
|
9
|
+
.stringbool()
|
|
10
|
+
.default(true)
|
|
11
|
+
.describe('Clamp positive read limits to preview 500, search 100 and dimension values 1,000 with a notice. False restores rejecting maximum schemas.'),
|
|
8
12
|
baseUrl: z
|
|
9
13
|
.string()
|
|
10
14
|
.url()
|
|
@@ -20,13 +24,13 @@ const ServerConfigSchema = z.object({
|
|
|
20
24
|
.int()
|
|
21
25
|
.positive()
|
|
22
26
|
.default(30_000)
|
|
23
|
-
.describe('
|
|
27
|
+
.describe('Total allowance for one Eurostat request, including retries, backoff and body consumption, in milliseconds'),
|
|
24
28
|
metadataTimeoutMs: z.coerce
|
|
25
29
|
.number()
|
|
26
30
|
.int()
|
|
27
31
|
.positive()
|
|
28
32
|
.default(120_000)
|
|
29
|
-
.describe("
|
|
33
|
+
.describe("Total allowance for one dataset's SDMX dataflow structure, including retries, backoff and body consumption, in milliseconds. Held separate from EUROSTAT_REQUEST_TIMEOUT_MS because the structure carries a label for every code the dataset uses: 23 MB, uncompressed, for the CN8 trade collection DS-045409. Defaults to 2 minutes."),
|
|
30
34
|
tocCacheTtlMs: z.coerce
|
|
31
35
|
.number()
|
|
32
36
|
.int()
|
|
@@ -38,7 +42,7 @@ const ServerConfigSchema = z.object({
|
|
|
38
42
|
.int()
|
|
39
43
|
.positive()
|
|
40
44
|
.default(120_000)
|
|
41
|
-
.describe('
|
|
45
|
+
.describe('Total allowance for one SDMX bulk download, including request retries, backoff and streaming body consumption, in milliseconds. Held separate from EUROSTAT_REQUEST_TIMEOUT_MS because a bulk body can take longer than a metadata call. Defaults to 2 minutes.'),
|
|
42
46
|
bulkMaxBytes: z.coerce
|
|
43
47
|
.number()
|
|
44
48
|
.int()
|
|
@@ -48,11 +52,12 @@ const ServerConfigSchema = z.object({
|
|
|
48
52
|
dataframeDropEnabled: z
|
|
49
53
|
.stringbool()
|
|
50
54
|
.default(false)
|
|
51
|
-
.describe('Register eurostat_dataframe_drop, which removes one staged table from a dataframe canvas. Off by default: a drop cannot be undone, and staged tables already expire with their canvas.
|
|
55
|
+
.describe('Register eurostat_dataframe_drop, which removes one staged table from a dataframe canvas. Off by default: a drop cannot be undone, and staged tables already expire with their canvas. Has no effect with CANVAS_PROVIDER_TYPE=none.'),
|
|
52
56
|
});
|
|
53
57
|
let _config;
|
|
54
58
|
export function getServerConfig() {
|
|
55
59
|
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
60
|
+
clampLimits: 'EUROSTAT_CLAMP_LIMITS',
|
|
56
61
|
baseUrl: 'EUROSTAT_BASE_URL',
|
|
57
62
|
comextBaseUrl: 'EUROSTAT_COMEXT_BASE_URL',
|
|
58
63
|
requestTimeoutMs: 'EUROSTAT_REQUEST_TIMEOUT_MS',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;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,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,iDAAiD,CAAC;SAC1D,QAAQ,CAAC,uBAAuB,CAAC;IACpC,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,wDAAwD,CAAC;SACjE,QAAQ,CACP,mMAAmM,CACpM;IACH,gBAAgB,EAAE,CAAC,CAAC,MAAM;SACvB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;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,WAAW,EAAE,CAAC;SACX,UAAU,EAAE;SACZ,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CACP,2IAA2I,CAC5I;IACH,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,iDAAiD,CAAC;SAC1D,QAAQ,CAAC,uBAAuB,CAAC;IACpC,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,wDAAwD,CAAC;SACjE,QAAQ,CACP,mMAAmM,CACpM;IACH,gBAAgB,EAAE,CAAC,CAAC,MAAM;SACvB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CACP,4GAA4G,CAC7G;IACH,iBAAiB,EAAE,CAAC,CAAC,MAAM;SACxB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,OAAO,CAAC,OAAO,CAAC;SAChB,QAAQ,CACP,wUAAwU,CACzU;IACH,aAAa,EAAE,CAAC,CAAC,MAAM;SACpB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,OAAO,CAAC,UAAU,CAAC;SACnB,QAAQ,CACP,qLAAqL,CACtL;IACH,aAAa,EAAE,CAAC,CAAC,MAAM;SACpB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,OAAO,CAAC,OAAO,CAAC;SAChB,QAAQ,CACP,iQAAiQ,CAClQ;IACH,YAAY,EAAE,CAAC,CAAC,MAAM;SACnB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,OAAO,CAAC,UAAU,CAAC;SACnB,QAAQ,CACP,0QAA0Q,CAC3Q;IACH,oBAAoB,EAAE,CAAC;SACpB,UAAU,EAAE;SACZ,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CACP,sOAAsO,CACvO;CACJ,CAAC,CAAC;AAEH,IAAI,OAAuD,CAAC;AAE5D,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,WAAW,EAAE,uBAAuB;QACpC,OAAO,EAAE,mBAAmB;QAC5B,aAAa,EAAE,0BAA0B;QACzC,gBAAgB,EAAE,6BAA6B;QAC/C,iBAAiB,EAAE,8BAA8B;QACjD,aAAa,EAAE,2BAA2B;QAC1C,aAAa,EAAE,0BAA0B;QACzC,YAAY,EAAE,yBAAyB;QACvC,oBAAoB,EAAE,iCAAiC;KACxD,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,22 +4,26 @@
|
|
|
4
4
|
* @module index
|
|
5
5
|
*/
|
|
6
6
|
import { createApp, disabledTool } from '@cyanheads/mcp-ts-core';
|
|
7
|
-
import { config } from '@cyanheads/mcp-ts-core/config';
|
|
7
|
+
import { config, parseConfig, resetConfig } from '@cyanheads/mcp-ts-core/config';
|
|
8
8
|
import { getServerConfig } from './config/server-config.js';
|
|
9
9
|
import { eurostatDatasetResource } from './mcp-server/resources/definitions/eurostat-dataset.resource.js';
|
|
10
10
|
import { eurostatBrowseThemes } from './mcp-server/tools/definitions/eurostat-browse-themes.tool.js';
|
|
11
11
|
import { eurostatDataframeDescribe } from './mcp-server/tools/definitions/eurostat-dataframe-describe.tool.js';
|
|
12
12
|
import { eurostatDataframeDrop } from './mcp-server/tools/definitions/eurostat-dataframe-drop.tool.js';
|
|
13
13
|
import { eurostatDataframeQuery } from './mcp-server/tools/definitions/eurostat-dataframe-query.tool.js';
|
|
14
|
-
import {
|
|
14
|
+
import { createEurostatDownloadDataset } from './mcp-server/tools/definitions/eurostat-download-dataset.tool.js';
|
|
15
15
|
import { eurostatGetDatasetInfo } from './mcp-server/tools/definitions/eurostat-get-dataset-info.tool.js';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import { createEurostatGetDimensionValues } from './mcp-server/tools/definitions/eurostat-get-dimension-values.tool.js';
|
|
17
|
+
import { createEurostatQueryDataset } from './mcp-server/tools/definitions/eurostat-query-dataset.tool.js';
|
|
18
|
+
import { createEurostatSearchDatasets } from './mcp-server/tools/definitions/eurostat-search-datasets.tool.js';
|
|
19
19
|
import { setCanvas } from './services/canvas-accessor.js';
|
|
20
20
|
import { initEurostatBulkService } from './services/eurostat-bulk/eurostat-bulk-service.js';
|
|
21
21
|
import { initEurostatCatalogueService } from './services/eurostat-catalogue/eurostat-catalogue-service.js';
|
|
22
22
|
import { initEurostatDataService } from './services/eurostat-data/eurostat-data-service.js';
|
|
23
|
+
parseConfig();
|
|
24
|
+
// DataCanvas defaults on; set CANVAS_PROVIDER_TYPE=none to disable it.
|
|
25
|
+
process.env.CANVAS_PROVIDER_TYPE ||= 'duckdb';
|
|
26
|
+
resetConfig();
|
|
23
27
|
/**
|
|
24
28
|
* The dataframe tools address tables on a canvas, so without one they have
|
|
25
29
|
* nothing to talk to. `disabledTool` keeps a gated tool off `tools/list` —
|
|
@@ -67,6 +71,20 @@ function dataframeDropTool() {
|
|
|
67
71
|
hint: DROP_OFF_HINT,
|
|
68
72
|
});
|
|
69
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Registration is provisional until setup validates this same memoized config.
|
|
76
|
+
* Invalid parses are never cached: setup repeats the failure inside createApp's
|
|
77
|
+
* configuration boundary, prints its banner and exits before serving a call.
|
|
78
|
+
*/
|
|
79
|
+
function readClampLimits() {
|
|
80
|
+
try {
|
|
81
|
+
return getServerConfig().clampLimits;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const clampLimits = readClampLimits();
|
|
70
88
|
await createApp({
|
|
71
89
|
name: 'eurostat-mcp-server',
|
|
72
90
|
title: 'eurostat-mcp-server',
|
|
@@ -77,25 +95,20 @@ await createApp({
|
|
|
77
95
|
*/
|
|
78
96
|
sessionMode: 'stateless',
|
|
79
97
|
tools: [
|
|
80
|
-
|
|
98
|
+
createEurostatSearchDatasets(clampLimits),
|
|
81
99
|
eurostatBrowseThemes,
|
|
82
100
|
eurostatGetDatasetInfo,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
createEurostatGetDimensionValues(clampLimits),
|
|
102
|
+
createEurostatQueryDataset(clampLimits),
|
|
103
|
+
createEurostatDownloadDataset(clampLimits),
|
|
86
104
|
canvasEnabled ? eurostatDataframeDescribe : disabledTool(eurostatDataframeDescribe, CANVAS_OFF),
|
|
87
105
|
canvasEnabled ? eurostatDataframeQuery : disabledTool(eurostatDataframeQuery, CANVAS_OFF),
|
|
88
106
|
dataframeDropTool(),
|
|
89
107
|
],
|
|
90
108
|
resources: [eurostatDatasetResource],
|
|
91
109
|
prompts: [],
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Apply dimension filters to keep queries small: an unfiltered query on a large dataset is slow and can return an async response error instead of data.
|
|
95
|
-
The catalogue covers two hosts. Most datasets come from the Eurostat dissemination table of contents; the DS-* codes — detailed trade by CN8, HS, SITC, BEC and CPA, and PRODCOM — come from the Comext host, and every tool routes a DS-* code there by its prefix. Comext collections are large: filter every request (freq included, since the trade flows mix annual and monthly series), and expect eurostat_get_dimension_values to page a long list such as the 37,069 CN8 product codes — pass filter with words of the code or label to find one value, or follow nextCursor. A collection on neither host, such as the legacy DS-056120, is not disseminated.
|
|
96
|
-
Two paths past eurostat_query_dataset's 5,000-observation inline cap. For a slice of a dataset, keep using eurostat_query_dataset: when the match is larger than the cap and this deployment runs a dataframe canvas, the whole match is also staged as a SQL table named in the response. For a whole dataset, use eurostat_download_dataset, which reads the SDMX bulk endpoint instead — about half the bytes — and stages every observation the same way, bounded by a byte budget it reports back. Read either staged table with eurostat_dataframe_query (eurostat_dataframe_describe lists the table and column names); the two stage different column sets, since the bulk endpoint carries dimension codes with no labels. To label a download's codes, pass its canvasId to eurostat_get_dimension_values as canvas_id: the dimension's values are staged beside it as a code/label table to join on.
|
|
97
|
-
Staged tables expire with their canvas. eurostat_dataframe_drop removes one sooner, leaving the canvas and its other tables in place; it is opt-in, listed only where the deployment also sets EUROSTAT_DATAFRAME_DROP_ENABLED=true.
|
|
98
|
-
The dataframe tools are not listed when the canvas is off. There, narrowing the filters is what brings a capped match into reach, and eurostat_download_dataset retains only its inline preview.`,
|
|
110
|
+
skills: 'skills',
|
|
111
|
+
instructions: 'Eurostat statistical data, including Comext DS-* collections; no API key required. Resolve dataset codes with eurostat_search_datasets or eurostat_browse_themes, inspect dimensions with eurostat_get_dataset_info, and resolve their values with eurostat_get_dimension_values before fetching observations. Filter large requests, including frequency on Comext, and keep units and aggregation levels comparable. Previews and incomplete bulk transfers cannot support complete totals; inspect notices and flags before concluding data is absent. When a response includes tableName, pass its canvasId as canvas_id to eurostat_dataframe_describe before eurostat_dataframe_query; reuse that canvas for joins. Staging and dataframe tools depend on the deployment canvas. Read eurostat-guide for statistical interpretation and SQL workflows.',
|
|
99
112
|
landing: { requireAuth: false },
|
|
100
113
|
setup(core) {
|
|
101
114
|
// Parsed here so a bad value fails startup with the configuration banner, not every call.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","s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,KAAK,EAAE,qBAAqB;IAC5B;;;;OAIG;IACH,WAAW,EAAE,WAAW;IACxB,KAAK,EAAE;QACL,4BAA4B,CAAC,WAAW,CAAC;QACzC,oBAAoB;QACpB,sBAAsB;QACtB,gCAAgC,CAAC,WAAW,CAAC;QAC7C,0BAA0B,CAAC,WAAW,CAAC;QACvC,6BAA6B,CAAC,WAAW,CAAC;QAC1C,aAAa,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,YAAY,CAAC,yBAAyB,EAAE,UAAU,CAAC;QAC/F,aAAa,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,YAAY,CAAC,sBAAsB,EAAE,UAAU,CAAC;QACzF,iBAAiB,EAAE;KACpB;IACD,SAAS,EAAE,CAAC,uBAAuB,CAAC;IACpC,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,QAAQ;IAChB,YAAY,EACV,8zBAA8zB;IACh0B,OAAO,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IAC/B,KAAK,CAAC,IAAI;QACR,0FAA0F;QAC1F,eAAe,EAAE,CAAC;QAClB,4BAA4B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACnD,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Bound read previews and search pages, disclosing each applied clamp.
|
|
3
|
+
* @module mcp-server/tools/clamp-read-limit
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
/** Returns the effective limit and records one clamp, labelled only by tool. */
|
|
7
|
+
export declare function clampReadLimit(requested: number, maximum: number, field: 'preview_limit' | 'limit', toolName: 'eurostat_query_dataset' | 'eurostat_download_dataset' | 'eurostat_search_datasets' | 'eurostat_get_dimension_values', ctx: Pick<Context, 'log'>): {
|
|
8
|
+
value: number;
|
|
9
|
+
notice?: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=clamp-read-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp-read-limit.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/clamp-read-limit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAStD,gFAAgF;AAChF,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,eAAe,GAAG,OAAO,EAChC,QAAQ,EACJ,wBAAwB,GACxB,2BAA2B,GAC3B,0BAA0B,GAC1B,+BAA+B,EACnC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,GACxB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAQpC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createCounter } from '@cyanheads/mcp-ts-core/utils';
|
|
2
|
+
const clamps = createCounter('eurostat.limit_clamps', 'Read limits clamped to their supported maximum', '{clamps}');
|
|
3
|
+
/** Returns the effective limit and records one clamp, labelled only by tool. */
|
|
4
|
+
export function clampReadLimit(requested, maximum, field, toolName, ctx) {
|
|
5
|
+
if (requested <= maximum)
|
|
6
|
+
return { value: requested };
|
|
7
|
+
ctx.log.info('Read limit clamped', { tool: toolName, field, requested, applied: maximum });
|
|
8
|
+
clamps.add(1, { tool: toolName });
|
|
9
|
+
return {
|
|
10
|
+
value: maximum,
|
|
11
|
+
notice: `${field} requested ${requested}; applied ${maximum}, the supported maximum.`,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=clamp-read-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp-read-limit.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/clamp-read-limit.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,MAAM,GAAG,aAAa,CAC1B,uBAAuB,EACvB,gDAAgD,EAChD,UAAU,CACX,CAAC;AAEF,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAC5B,SAAiB,EACjB,OAAe,EACf,KAAgC,EAChC,QAImC,EACnC,GAAyB;IAEzB,IAAI,SAAS,IAAI,OAAO;QAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACtD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3F,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClC,OAAO;QACL,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,GAAG,KAAK,cAAc,SAAS,aAAa,OAAO,0BAA0B;KACtF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eurostat-browse-themes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-browse-themes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAiB,MAAM,+BAA+B,CAAC;AAIhF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"eurostat-browse-themes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-browse-themes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAiB,MAAM,+BAA+B,CAAC;AAIhF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuO/B,CAAC"}
|
|
@@ -14,7 +14,7 @@ export const eurostatBrowseThemes = tool('eurostat_browse_themes', {
|
|
|
14
14
|
theme_code: z
|
|
15
15
|
.string()
|
|
16
16
|
.optional()
|
|
17
|
-
.describe('Folder code to expand (e.g., "economy", "reg"). Omit to list the top-level theme folders.'),
|
|
17
|
+
.describe('Folder code to expand (e.g., "economy", "reg"). Exact codes take precedence, then case-insensitive matching applies. Omit to list the top-level theme folders.'),
|
|
18
18
|
}),
|
|
19
19
|
output: z.object({
|
|
20
20
|
items: z
|
|
@@ -122,11 +122,12 @@ export const eurostatBrowseThemes = tool('eurostat_browse_themes', {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
if (data?.reason === 'not_a_folder') {
|
|
125
|
+
const canonicalThemeCode = data.themeCode;
|
|
125
126
|
throw ctx.fail('not_a_folder', err.message, {
|
|
126
|
-
themeCode,
|
|
127
|
+
themeCode: canonicalThemeCode,
|
|
127
128
|
entryType: data.entryType,
|
|
128
129
|
recovery: {
|
|
129
|
-
hint: `Pass "${
|
|
130
|
+
hint: `Pass "${canonicalThemeCode}" as dataset_code to eurostat_get_dataset_info to inspect its dimensions, then eurostat_query_dataset to retrieve data.`,
|
|
130
131
|
},
|
|
131
132
|
});
|
|
132
133
|
}
|
|
@@ -140,11 +141,11 @@ export const eurostatBrowseThemes = tool('eurostat_browse_themes', {
|
|
|
140
141
|
}
|
|
141
142
|
throw err;
|
|
142
143
|
}
|
|
143
|
-
const { comextListMissing, catalogueLoadedAt, ...listing } = browsed;
|
|
144
|
+
const { comextListMissing, catalogueLoadedAt, themeCode: canonicalThemeCode, ...listing } = browsed;
|
|
144
145
|
ctx.log.info('Theme browse complete', { themeCode, itemCount: listing.items.length });
|
|
145
146
|
ctx.enrich({
|
|
146
147
|
itemCount: listing.items.length,
|
|
147
|
-
...(
|
|
148
|
+
...(canonicalThemeCode && { themeCode: canonicalThemeCode }),
|
|
148
149
|
...(comextListMissing && { comextListMissing }),
|
|
149
150
|
...(catalogueLoadedAt && { catalogueLoadedAt }),
|
|
150
151
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eurostat-browse-themes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-browse-themes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAiB,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC;AAC1G,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,wBAAwB,EAAE;IACjE,KAAK,EAAE,iCAAiC;IACxC,WAAW,EACT,yzBAAyzB;IAC3zB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,
|
|
1
|
+
{"version":3,"file":"eurostat-browse-themes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-browse-themes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAA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,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -30,5 +30,7 @@ export declare const eurostatDataframeQuery: import("@cyanheads/mcp-ts-core").To
|
|
|
30
30
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
31
31
|
readonly when: "The SQL names a table that is not staged on this canvas, or that has expired.";
|
|
32
32
|
readonly recovery: "Call eurostat_dataframe_describe for the staged table names, or re-run the tool that staged them (eurostat_query_dataset, eurostat_download_dataset, or eurostat_get_dimension_values with canvas_id).";
|
|
33
|
-
}],
|
|
33
|
+
}], {
|
|
34
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}>;
|
|
34
36
|
//# sourceMappingURL=eurostat-dataframe-query.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eurostat-dataframe-query.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-dataframe-query.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"eurostat-dataframe-query.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-dataframe-query.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA0CjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+GjC,CAAC"}
|
|
@@ -7,9 +7,39 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
|
7
7
|
import { CanvasIdSchema } from '@cyanheads/mcp-ts-core/canvas';
|
|
8
8
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
9
9
|
import { acquireCanvas, getCanvas, isCanvasFailure } from '../../../services/canvas-accessor.js';
|
|
10
|
+
const QueryOutputSchema = z.object({
|
|
11
|
+
canvasId: z.string().describe('Canvas identifier the query ran against.'),
|
|
12
|
+
columns: z.array(z.string()).describe('Column names in projection order.'),
|
|
13
|
+
rows: z
|
|
14
|
+
.array(z.record(z.string(), z.unknown()))
|
|
15
|
+
.describe('Complete result rows, keyed by column name, bounded by the canvas row limit. Nested cells render as JSON; 64-bit integers arrive as strings so they survive intact. Cast to DOUBLE in SQL if a number is wanted.'),
|
|
16
|
+
rowCount: z
|
|
17
|
+
.number()
|
|
18
|
+
.describe('Complete rows returned after the canvas row limit. Advance SQL OFFSET by this actual count.'),
|
|
19
|
+
truncated: z
|
|
20
|
+
.boolean()
|
|
21
|
+
.describe('True when the canvas row limit omitted rows. Follow notice for SQL paging.'),
|
|
22
|
+
});
|
|
23
|
+
/** JSON cells preserve nested values, string quoting and escaped line breaks. */
|
|
24
|
+
function renderRow(columns, row) {
|
|
25
|
+
return columns.map((column) => `${column}=${JSON.stringify(row[column])}`).join(' | ');
|
|
26
|
+
}
|
|
27
|
+
/** Render every complete row without changing cell values. */
|
|
28
|
+
function renderText(result) {
|
|
29
|
+
return [
|
|
30
|
+
`# Query result (canvas \`${result.canvasId}\`)`,
|
|
31
|
+
`**Rows:** ${result.rowCount} | **Truncated:** ${result.truncated}`,
|
|
32
|
+
`**Columns:** ${result.columns.join(', ')}\n`,
|
|
33
|
+
...result.rows.map((row) => renderRow(result.columns, row)),
|
|
34
|
+
].join('\n');
|
|
35
|
+
}
|
|
36
|
+
/** Paging depends on a fixed deterministic SELECT over unchanged staged tables. */
|
|
37
|
+
function cutNotice(rows) {
|
|
38
|
+
return `Returned ${rows.toLocaleString('en-US')} complete rows; the canvas row limit cut this result. Page with the same deterministic SELECT and a total ORDER BY (add tie-breakers for tied keys), using LIMIT/OFFSET and advancing OFFSET by the actual returned rowCount, not the requested LIMIT. If the first page had no ORDER BY, restart sorted at OFFSET 0. Volatile expressions and changing or expired tables do not support stable paging.`;
|
|
39
|
+
}
|
|
10
40
|
export const eurostatDataframeQuery = tool('eurostat_dataframe_query', {
|
|
11
41
|
title: 'Query Eurostat Dataframes',
|
|
12
|
-
description: 'Run a read-only SQL SELECT against tables staged on a Eurostat dataframe canvas
|
|
42
|
+
description: 'Run a read-only SQL SELECT against tables staged on a Eurostat dataframe canvas, reaching observations beyond an inline preview and aggregating or joining tables without re-fetching Eurostat. Call eurostat_dataframe_describe first for table and column names. Only a single SELECT runs: statement chaining, non-SELECT verbs, and functions reading files or external data are rejected. Columns are flat: dimension codes, obs_value, obs_flag / obs_flag_label, and conf_status / conf_status_label. Tables eurostat_query_dataset staged also carry dimension _label companions; DS-* tables also carry obs_value_text for published text values. Join observation tables on dimension codes and time. A staged dimension value list has code and label columns; join it to an observation dimension code to add labels. Returns every complete row the canvas supplies, bounded only by the canvas row limit; nested cells render as lossless JSON. A row-limit cut sets truncated and adds a notice: page the same deterministic SELECT over unchanged tables with a total ORDER BY and LIMIT/OFFSET, advancing by actual rowCount. Restart an unordered first page sorted at offset zero; tied keys need tie-breakers. Volatile SQL and changing or expired tables cannot provide stable paging.',
|
|
13
43
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
14
44
|
input: z.object({
|
|
15
45
|
canvas_id: CanvasIdSchema.describe('Canvas identifier returned as canvasId by eurostat_query_dataset, eurostat_download_dataset, or eurostat_get_dimension_values. Identifies the workspace holding the staged tables.'),
|
|
@@ -18,19 +48,13 @@ export const eurostatDataframeQuery = tool('eurostat_dataframe_query', {
|
|
|
18
48
|
.min(1)
|
|
19
49
|
.describe("A single read-only SELECT statement. Reference tables by the names eurostat_dataframe_describe reports. Example: SELECT geo, geo_label, AVG(obs_value) AS mean FROM df_a1b2c3d4 WHERE time >= '2020' GROUP BY geo, geo_label ORDER BY mean DESC."),
|
|
20
50
|
}),
|
|
21
|
-
output:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
.describe('
|
|
27
|
-
|
|
28
|
-
.number()
|
|
29
|
-
.describe('Rows materialized into this response. Equals the full result size unless truncated is true.'),
|
|
30
|
-
truncated: z
|
|
31
|
-
.boolean()
|
|
32
|
-
.describe('True when the result exceeded the canvas row limit and was cut short. Add a LIMIT, an aggregate, or a narrower WHERE clause to see the rest.'),
|
|
33
|
-
}),
|
|
51
|
+
output: QueryOutputSchema,
|
|
52
|
+
enrichment: {
|
|
53
|
+
notice: z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('Whole-row cut disclosure and deterministic SQL paging guidance. Omitted when no rows were omitted.'),
|
|
57
|
+
},
|
|
34
58
|
errors: [
|
|
35
59
|
{
|
|
36
60
|
reason: 'canvas_disabled',
|
|
@@ -81,30 +105,22 @@ export const eurostatDataframeQuery = tool('eurostat_dataframe_query', {
|
|
|
81
105
|
* reasons with a vaguer message.
|
|
82
106
|
*/
|
|
83
107
|
const result = await instance.query(input.sql, { signal: ctx.signal }).catch(asDeclared);
|
|
84
|
-
|
|
85
|
-
canvasId: instance.canvasId,
|
|
86
|
-
rowCount: result.rowCount,
|
|
87
|
-
truncated: result.truncated === true,
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
108
|
+
const output = {
|
|
90
109
|
canvasId: instance.canvasId,
|
|
91
110
|
columns: result.columns,
|
|
92
111
|
rows: result.rows,
|
|
93
|
-
rowCount: result.
|
|
112
|
+
rowCount: result.rows.length,
|
|
94
113
|
truncated: result.truncated === true,
|
|
95
114
|
};
|
|
115
|
+
if (output.truncated)
|
|
116
|
+
ctx.enrich.notice(cutNotice(output.rowCount));
|
|
117
|
+
ctx.log.info('Canvas query complete', {
|
|
118
|
+
canvasId: instance.canvasId,
|
|
119
|
+
rowCount: output.rowCount,
|
|
120
|
+
truncated: output.truncated,
|
|
121
|
+
});
|
|
122
|
+
return output;
|
|
96
123
|
},
|
|
97
|
-
format: (result) => {
|
|
98
|
-
const lines = [
|
|
99
|
-
`# Query result (canvas \`${result.canvasId}\`)`,
|
|
100
|
-
`**Rows:** ${result.rowCount} | **Truncated:** ${result.truncated}${result.truncated ? ' — add a LIMIT, an aggregate, or a narrower WHERE clause' : ''}`,
|
|
101
|
-
`**Columns:** ${result.columns.join(', ')}\n`,
|
|
102
|
-
];
|
|
103
|
-
// Every row renders, so content[] carries the same set structuredContent does.
|
|
104
|
-
for (const row of result.rows) {
|
|
105
|
-
lines.push(result.columns.map((col) => `${col}=${row[col] === null ? 'NULL' : row[col]}`).join(' | '));
|
|
106
|
-
}
|
|
107
|
-
return [{ type: 'text', text: lines.join('\n') }];
|
|
108
|
-
},
|
|
124
|
+
format: (result) => [{ type: 'text', text: renderText(result) }],
|
|
109
125
|
});
|
|
110
126
|
//# sourceMappingURL=eurostat-dataframe-query.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eurostat-dataframe-query.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-dataframe-query.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE1F,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"eurostat-dataframe-query.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-dataframe-query.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;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YACvB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;YAC5B,SAAS,EAAE,MAAM,CAAC,SAAS,KAAK,IAAI;SACrC,CAAC;QACF,IAAI,MAAM,CAAC,SAAS;YAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACpC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;CACjE,CAAC,CAAC"}
|
|
@@ -5,6 +5,100 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
7
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
8
|
+
/** Selects the advertised limit policy before registration. */
|
|
9
|
+
export declare const createEurostatDownloadDataset: (clampLimits: boolean) => import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
10
|
+
dataset_code: z.ZodString;
|
|
11
|
+
filters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
12
|
+
since_period: z.ZodOptional<z.ZodString>;
|
|
13
|
+
until_period: z.ZodOptional<z.ZodString>;
|
|
14
|
+
preview_limit: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
canvas_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
17
|
+
datasetCode: z.ZodString;
|
|
18
|
+
dimensionsUsed: z.ZodArray<z.ZodString>;
|
|
19
|
+
rowCount: z.ZodNumber;
|
|
20
|
+
missingCount: z.ZodNumber;
|
|
21
|
+
periodRange: z.ZodObject<{
|
|
22
|
+
start: z.ZodOptional<z.ZodString>;
|
|
23
|
+
end: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
bytesRead: z.ZodNumber;
|
|
26
|
+
compressed: z.ZodBoolean;
|
|
27
|
+
budgetExceeded: z.ZodBoolean;
|
|
28
|
+
observations: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
|
|
29
|
+
canvasId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
tableName: z.ZodOptional<z.ZodString>;
|
|
31
|
+
stagedRowCount: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strip>, readonly [{
|
|
33
|
+
readonly reason: "byte_budget_exceeded";
|
|
34
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
35
|
+
readonly when: "The decoded TSV byte budget was exhausted before a complete header and usable observation could be read.";
|
|
36
|
+
readonly recovery: "Add dimension filters or narrow since_period/until_period to reduce the transfer, or raise EUROSTAT_BULK_MAX_BYTES.";
|
|
37
|
+
readonly thrownBy: "service";
|
|
38
|
+
}, {
|
|
39
|
+
readonly reason: "not_found";
|
|
40
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
41
|
+
readonly when: "The dataset code is not available for dissemination (HTTP 404, SDMX faultcode 100).";
|
|
42
|
+
readonly recovery: "Use eurostat_search_datasets or eurostat_browse_themes to find a valid dataset code.";
|
|
43
|
+
readonly thrownBy: "service";
|
|
44
|
+
}, {
|
|
45
|
+
readonly reason: "invalid_dimension";
|
|
46
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
47
|
+
readonly when: "A filter names a dimension the dataset does not have, or a value or period range Eurostat rejects (SDMX faultcode 150).";
|
|
48
|
+
readonly recovery: "Check dimension codes with eurostat_get_dataset_info and their values with eurostat_get_dimension_values, and keep the period range inside the dataset coverage.";
|
|
49
|
+
readonly thrownBy: "service";
|
|
50
|
+
}, {
|
|
51
|
+
readonly reason: "filter_arity";
|
|
52
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
53
|
+
readonly when: "Eurostat rejected the positional dimension key because it carried the wrong number of positions (SDMX faultcode 140, INVALID_QUERY_NB_FILTERS), meaning the dataset structure has changed since the metadata call.";
|
|
54
|
+
readonly recovery: "Retry without filters to download the whole dataset, or re-read the dimensions with eurostat_get_dataset_info.";
|
|
55
|
+
readonly thrownBy: "service";
|
|
56
|
+
}, {
|
|
57
|
+
readonly reason: "invalid_period";
|
|
58
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
59
|
+
readonly when: "since_period or until_period is not a period literal, or names a month, quarter, semester, trimester, week or day that does not exist, or since_period starts after until_period ends. Checked before any request — the bulk endpoint would otherwise roll an out-of-range period into a neighbouring one, and answer an inverted range with the whole series — and SDMX faultcode 140 TIME_PERIOD_FILTER_SPEC_INVALID maps here too.";
|
|
60
|
+
readonly recovery: "Write since_period/until_period as YYYY, YYYY-MM, YYYY-MM-DD, YYYY-Qn (1–4), YYYY-Sn (1–2), YYYY-Tn (1–3), YYYY-Mnn (01–12), YYYY-Wnn (a week the year has, up to 53) or YYYY-Dnnn (a day the year has, up to 366), for example \"2020\", \"2020-01\" or \"2020-Q1\", with since_period starting no later than until_period ends.";
|
|
61
|
+
}, {
|
|
62
|
+
readonly reason: "async_queued";
|
|
63
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
64
|
+
readonly when: "Eurostat answered HTTP 200 with a SOAP syncResponse queue ticket (status SUBMITTED) instead of data, because the extraction was too costly to serve synchronously.";
|
|
65
|
+
readonly retryable: false;
|
|
66
|
+
readonly recovery: "Add dimension filters or a period range so Eurostat serves the extraction inline; the queued result cannot be collected here.";
|
|
67
|
+
readonly thrownBy: "service";
|
|
68
|
+
}, {
|
|
69
|
+
readonly reason: "no_results";
|
|
70
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
71
|
+
readonly when: "The download completed but carried no populated observation cells. Nothing is staged, and no canvas is created or touched.";
|
|
72
|
+
readonly recovery: "Verify the filter values with eurostat_get_dimension_values and keep since_period/until_period inside the series' coverage — a combination that exists in no cell and a range that misses the series both download as an empty table.";
|
|
73
|
+
}, {
|
|
74
|
+
readonly reason: "extraction_too_big";
|
|
75
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
76
|
+
readonly when: "Eurostat refused the extraction as too large (SDMX faultcode 413, HTTP 413): past its 5,000,000-row extraction limit, or an unfiltered download of a large DS-* Comext collection, which Eurostat serves only filtered. Covers every dataset, on either host.";
|
|
77
|
+
readonly retryable: false;
|
|
78
|
+
readonly recovery: "Add dimension filters or a narrower since_period/until_period range to shrink the extraction; the same request fails the same way on every retry.";
|
|
79
|
+
readonly thrownBy: "service";
|
|
80
|
+
}, {
|
|
81
|
+
readonly reason: "upstream_fault";
|
|
82
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
83
|
+
readonly when: "The SDMX data endpoint returned a fault this server does not model, or a body that is not a TSV table; or the data endpoint — or, for a filtered download, the structure endpoint — answered HTTP 5xx or could not be reached on every retry, which the error marks retryable.";
|
|
84
|
+
readonly recovery: "Retry in a few minutes, or narrow the request with dimension filters.";
|
|
85
|
+
readonly thrownBy: "service";
|
|
86
|
+
}, {
|
|
87
|
+
readonly reason: "canvas_not_found";
|
|
88
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
89
|
+
readonly when: "A canvas_id was supplied for staging but is unknown or its lifetime has elapsed.";
|
|
90
|
+
readonly recovery: "Omit canvas_id so the download starts a fresh canvas and returns its canvasId.";
|
|
91
|
+
}], {
|
|
92
|
+
readonly totalCount: z.ZodNumber;
|
|
93
|
+
readonly appliedQuery: z.ZodObject<{
|
|
94
|
+
filters: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
95
|
+
sincePeriod: z.ZodOptional<z.ZodString>;
|
|
96
|
+
untilPeriod: z.ZodOptional<z.ZodString>;
|
|
97
|
+
url: z.ZodString;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
readonly notice: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}>;
|
|
101
|
+
/** Default-on read-limit policy; startup selects the deployment policy explicitly. */
|
|
8
102
|
export declare const eurostatDownloadDataset: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
9
103
|
dataset_code: z.ZodString;
|
|
10
104
|
filters: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
@@ -29,6 +123,12 @@ export declare const eurostatDownloadDataset: import("@cyanheads/mcp-ts-core").T
|
|
|
29
123
|
tableName: z.ZodOptional<z.ZodString>;
|
|
30
124
|
stagedRowCount: z.ZodOptional<z.ZodNumber>;
|
|
31
125
|
}, z.core.$strip>, readonly [{
|
|
126
|
+
readonly reason: "byte_budget_exceeded";
|
|
127
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
128
|
+
readonly when: "The decoded TSV byte budget was exhausted before a complete header and usable observation could be read.";
|
|
129
|
+
readonly recovery: "Add dimension filters or narrow since_period/until_period to reduce the transfer, or raise EUROSTAT_BULK_MAX_BYTES.";
|
|
130
|
+
readonly thrownBy: "service";
|
|
131
|
+
}, {
|
|
32
132
|
readonly reason: "not_found";
|
|
33
133
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
34
134
|
readonly when: "The dataset code is not available for dissemination (HTTP 404, SDMX faultcode 100).";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eurostat-download-dataset.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-download-dataset.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAiB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"eurostat-download-dataset.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/eurostat-download-dataset.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAiB,MAAM,+BAA+B,CAAC;AA6ChF,+DAA+D;AAC/D,eAAO,MAAM,6BAA6B,gBAAiB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+e9D,CAAC;AAEL,sFAAsF;AACtF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
|