@cyanheads/gdelt-mcp-server 0.2.4 → 0.2.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/CLAUDE.md +1 -1
- package/README.md +9 -5
- package/changelog/0.2.x/0.2.5.md +21 -0
- package/dist/mcp-server/tools/date-range.d.ts +55 -3
- package/dist/mcp-server/tools/date-range.d.ts.map +1 -1
- package/dist/mcp-server/tools/date-range.js +107 -3
- package/dist/mcp-server/tools/date-range.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.d.ts +14 -0
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.js +112 -30
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.d.ts +7 -0
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.js +73 -13
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.d.ts +4 -0
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.js +52 -8
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-articles.tool.d.ts +4 -0
- package/dist/mcp-server/tools/definitions/search-articles.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-articles.tool.js +52 -9
- package/dist/mcp-server/tools/definitions/search-articles.tool.js.map +1 -1
- package/package.json +1 -1
- package/server.json +3 -3
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** gdelt-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
4
|
+
**Version:** 0.2.5
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.10.14`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.29.0
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/gdelt-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/gdelt-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -33,12 +33,12 @@ Nine tools across two GDELT APIs — DOC API for global print/web news (last 3 m
|
|
|
33
33
|
|
|
34
34
|
| Tool | Description |
|
|
35
35
|
|:---|:---|
|
|
36
|
-
| `gdelt_search_articles` | Search the last 3 months of global news coverage (65 languages) with full-text and filter operators. Returns up to 250 articles. |
|
|
37
|
-
| `gdelt_get_coverage_timeline` | Retrieve a time series of coverage volume or average tone for a query. `volume_with_articles` mode includes top articles per spike timestep. |
|
|
36
|
+
| `gdelt_search_articles` | Search the last 3 months of global news coverage (65 languages) with full-text and filter operators. Returns up to 250 articles, and hands back the date windows to re-query when that ceiling is hit. |
|
|
37
|
+
| `gdelt_get_coverage_timeline` | Retrieve a time series of coverage volume or average tone for a query. `volume_with_articles` mode includes top articles per spike timestep, with `points` to render a timestep's full article list. |
|
|
38
38
|
| `gdelt_get_tone_distribution` | Get a tone histogram (bins ~−30 to +30) showing whether coverage is uniformly negative, bimodal, or clustered near neutral. |
|
|
39
39
|
| `gdelt_get_coverage_breakdown` | Break down coverage volume by source language or source country — a multi-series time series showing geographic propagation. Values are normalized shares of media output, not article counts. |
|
|
40
40
|
| `gdelt_search_tv` | Search US television news closed captions (2009–Oct 2024) and return per-station airtime time series. |
|
|
41
|
-
| `gdelt_get_tv_clips` | Retrieve up to 3,000 matching TV clips with transcript excerpts and Internet Archive viewing links. |
|
|
41
|
+
| `gdelt_get_tv_clips` | Retrieve up to 3,000 matching TV clips with transcript excerpts and Internet Archive viewing links, and the date windows to re-query when that ceiling is hit. |
|
|
42
42
|
| `gdelt_get_tv_context` | Get the most frequent co-occurring words and phrases from TV clips matching a query. |
|
|
43
43
|
| `gdelt_get_tv_trending` | Retrieve trending topics currently dominating US television news (updated every 15 minutes; no query required). |
|
|
44
44
|
| `gdelt_list_tv_stations` | List all TV stations with market, network, and monitoring date ranges to verify station availability before querying. |
|
|
@@ -52,6 +52,7 @@ Search the last 3 months of global news with GDELT's full query syntax.
|
|
|
52
52
|
- Proximity and repetition: `near20:"flu virus"`, `repeat3:"outbreak"`
|
|
53
53
|
- Configurable sort (relevance, date) and result count (up to 250)
|
|
54
54
|
- Returns URL, title, publication date, domain, language, source country, and social image URL
|
|
55
|
+
- 250 is a hard per-call ceiling, not a page size — GDELT exposes no cursor. Fill it and the response returns `continuationWindows`: the queried window halved, ready to re-query. The halves overlap by a second so nothing falls through the seam; de-duplicate by `url`
|
|
55
56
|
- Query is echoed in response for chaining
|
|
56
57
|
|
|
57
58
|
---
|
|
@@ -63,6 +64,7 @@ Retrieve when coverage of a topic spiked, with three modes:
|
|
|
63
64
|
- `volume` — normalized percentage of all global coverage per timestep
|
|
64
65
|
- `volume_with_articles` — volume plus top articles driving each spike; use for signal detection without a follow-up search call
|
|
65
66
|
- `tone` — average sentiment score per timestep (combine with `gdelt_get_tone_distribution` for the full picture)
|
|
67
|
+
- Every article reference is always in `structuredContent`; the text surface renders the first 3 links per timestep beside that timestep's true count, and `points: ["<date>"]` renders named timesteps in full
|
|
66
68
|
- Configurable smoothing and time range
|
|
67
69
|
|
|
68
70
|
---
|
|
@@ -82,7 +84,8 @@ Snapshot tone histogram across all articles matching a query.
|
|
|
82
84
|
Multi-series time series showing which countries or languages drove coverage.
|
|
83
85
|
|
|
84
86
|
- Break down by `language` or `country`
|
|
85
|
-
- Top 10 series by total volume; remaining series aggregated into an "Other" bucket
|
|
87
|
+
- Top 10 series by total volume; remaining series aggregated into an "Other" bucket and named in `otherSeriesLabels`
|
|
88
|
+
- Nothing is dissolved into "Other" anonymously — pass any label to `series: ["<label>"]` and that series comes back complete under `selectedSeries`, alongside the usual overview
|
|
86
89
|
- Values are normalized — the topic's share of media output, not absolute article counts. Small media markets with concentrated coverage rank above large markets with diverse output, so a high value means the topic dominated that source's coverage rather than that it published the most articles
|
|
87
90
|
- Use to trace how a story propagated geographically
|
|
88
91
|
|
|
@@ -105,6 +108,7 @@ Retrieve actual TV news clips driving a coverage signal.
|
|
|
105
108
|
|
|
106
109
|
- Up to 3,000 clips per call
|
|
107
110
|
- Each clip: show name, station, air timestamp, 15-second transcript excerpt, direct Archive.org link, and optional thumbnail
|
|
111
|
+
- 3,000 is a hard per-call ceiling, not a page size — GDELT exposes no cursor. Fill it and the response returns `continuationWindows`: the queried window halved, ready to re-query. The halves overlap by a second so nothing falls through the seam; de-duplicate by `archiveUrl`
|
|
108
112
|
- Sort by relevance, date descending, or date ascending
|
|
109
113
|
|
|
110
114
|
---
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Added: selectable series (#20) and named point expansion (#24); search_articles/get_tv_clips return continuationWindows instead of a dead-end cap notice (#21)"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.5 — 2026-07-15
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`gdelt_get_coverage_breakdown`** — optional `series: string[]` input returns each named label complete under a new `selectedSeries` output, alongside the existing top-10 overview. New optional `otherSeriesLabels` output names every series folded into "Other", ranked by volume. An unmatched label throws `unknown_series`, listing the labels actually available ([#20](https://github.com/cyanheads/gdelt-mcp-server/issues/20)).
|
|
12
|
+
- **`gdelt_get_coverage_timeline`** — optional `points: string[]` input renders a named timestep's complete article list in the text surface, echoed in the new optional `expandedPoints` output. An unmatched date throws `unknown_point`, listing the timeline's actual dates ([#24](https://github.com/cyanheads/gdelt-mcp-server/issues/24)).
|
|
13
|
+
- **`gdelt_search_articles`, `gdelt_get_tv_clips`** — new optional `continuationWindows` enrichment field returns the queried `startDatetime`/`endDatetime` window halved once `maxRecords` is at its ceiling (250 / 3,000), ready to re-query. Halves overlap by one second so a record timestamped exactly on the seam is never silently dropped — de-duplicate by `url` / `archiveUrl` on reassembly. Shared window-partition helpers (`resolveEffectiveWindow`, `splitWindow`, `planWindowContinuation`) added to `src/mcp-server/tools/date-range.ts` ([#21](https://github.com/cyanheads/gdelt-mcp-server/issues/21)).
|
|
14
|
+
|
|
15
|
+
## Changed
|
|
16
|
+
|
|
17
|
+
- **`gdelt_get_coverage_timeline`** — capped article rendering now states how many links it showed next to the true count (`"8 articles, 3 shown"`), instead of an unqualified count; a timestep whose articles all fit claims nothing withheld ([#24](https://github.com/cyanheads/gdelt-mcp-server/issues/24)).
|
|
18
|
+
|
|
19
|
+
## Fixed
|
|
20
|
+
|
|
21
|
+
- **`gdelt_search_articles`, `gdelt_get_tv_clips`** — the cap-hit notice no longer tells the caller to raise `maxRecords` when it is already at its ceiling; it now states the ceiling is GDELT's own and points to `continuationWindows` ([#21](https://github.com/cyanheads/gdelt-mcp-server/issues/21)).
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Shared date-range
|
|
3
|
-
*
|
|
4
|
-
* and the
|
|
2
|
+
* @fileoverview Shared date-range handling for the GDELT tools that accept an explicit
|
|
3
|
+
* startDatetime/endDatetime window — the YYYYMMDDHHMMSS field pattern, the both-or-neither
|
|
4
|
+
* pairing predicate, and the window partitioning the record-cap tools hand back as a
|
|
5
|
+
* continuation contract.
|
|
5
6
|
* @module mcp-server/tools/date-range
|
|
6
7
|
*/
|
|
7
8
|
/**
|
|
@@ -11,6 +12,57 @@
|
|
|
11
12
|
* Schema as `pattern`, letting a caller see the constraint before it calls.
|
|
12
13
|
*/
|
|
13
14
|
export declare const GDELT_DATETIME_PATTERN: RegExp;
|
|
15
|
+
/** A GDELT query window, both boundaries in the 14-digit YYYYMMDDHHMMSS wire format. */
|
|
16
|
+
export type GdeltWindow = {
|
|
17
|
+
startDatetime: string;
|
|
18
|
+
endDatetime: string;
|
|
19
|
+
};
|
|
20
|
+
/** Format a Date as GDELT's 14-digit YYYYMMDDHHMMSS wire format (UTC). */
|
|
21
|
+
export declare function toGdeltDatetime(date: Date): string;
|
|
22
|
+
/**
|
|
23
|
+
* The window a call actually ran against, in GDELT's wire format.
|
|
24
|
+
*
|
|
25
|
+
* Mirrors `applyTimeRange()`'s precedence: an explicit boundary pair wins, a timespan
|
|
26
|
+
* is resolved against now, and a call that pinned neither gets `undefined` rather than
|
|
27
|
+
* a guessed window — GDELT's own default is not something this server can observe.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveEffectiveWindow(args: {
|
|
30
|
+
timespan?: string | undefined;
|
|
31
|
+
startDatetime?: string | undefined;
|
|
32
|
+
endDatetime?: string | undefined;
|
|
33
|
+
}): GdeltWindow | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Split a window into two halves whose union covers it exactly, or `undefined` when it
|
|
36
|
+
* is already too narrow to divide.
|
|
37
|
+
*
|
|
38
|
+
* The second half deliberately **overlaps** the first by one second rather than resuming
|
|
39
|
+
* at the shared midpoint. GDELT documents both boundaries as exclusive — STARTDATETIME
|
|
40
|
+
* considers "only articles published *after* this date/time stamp" and ENDDATETIME "only
|
|
41
|
+
* articles published *before*" it (DOC 2.0 and TV 2.0 API docs alike) — so halves that
|
|
42
|
+
* merely touch at the midpoint would drop every record timestamped exactly there, silently.
|
|
43
|
+
*
|
|
44
|
+
* Reaching back one second closes that seam: under the documented exclusive reading the
|
|
45
|
+
* two halves tile the original window with no gap and no repeat, and if the boundaries
|
|
46
|
+
* turn out to behave inclusively instead, the overlap costs at most two seconds of
|
|
47
|
+
* duplicates — which a caller can see and de-duplicate. Gap-free either way.
|
|
48
|
+
*/
|
|
49
|
+
export declare function splitWindow(window: GdeltWindow): [GdeltWindow, GdeltWindow] | undefined;
|
|
50
|
+
/** The next-call windows and the prose explaining them, for a record cap at its ceiling. */
|
|
51
|
+
export type WindowContinuation = {
|
|
52
|
+
windows?: [GdeltWindow, GdeltWindow];
|
|
53
|
+
guidance: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* How a caller retrieves records left behind once `maxRecords` is already at its ceiling.
|
|
57
|
+
*
|
|
58
|
+
* GDELT exposes no offset or cursor, so narrowing the time window is the only lever, and
|
|
59
|
+
* each outcome is stated rather than implied: halves to re-query when the window divides,
|
|
60
|
+
* how to pin a window when the call never set one, and — when the window is already too
|
|
61
|
+
* narrow to divide — that the remaining records are simply unreachable.
|
|
62
|
+
*
|
|
63
|
+
* Callers own the record-noun prose; this covers only the window reasoning both tools share.
|
|
64
|
+
*/
|
|
65
|
+
export declare function planWindowContinuation(window: GdeltWindow | undefined): WindowContinuation;
|
|
14
66
|
/**
|
|
15
67
|
* True when exactly one of the two boundaries is present.
|
|
16
68
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/date-range.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/date-range.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,QAAa,CAAC;AAEjD,wFAAwF;AACxF,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAaF,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,GAAG,WAAW,GAAG,SAAS,CAc1B;AASD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,SAAS,CAcvF;AAED,4FAA4F;AAC5F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,kBAAkB,CA4B1F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAEzF"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Shared date-range
|
|
3
|
-
*
|
|
4
|
-
* and the
|
|
2
|
+
* @fileoverview Shared date-range handling for the GDELT tools that accept an explicit
|
|
3
|
+
* startDatetime/endDatetime window — the YYYYMMDDHHMMSS field pattern, the both-or-neither
|
|
4
|
+
* pairing predicate, and the window partitioning the record-cap tools hand back as a
|
|
5
|
+
* continuation contract.
|
|
5
6
|
* @module mcp-server/tools/date-range
|
|
6
7
|
*/
|
|
8
|
+
import { resolveTimespan } from '../../services/gdelt/gdelt-fetch.js';
|
|
7
9
|
/**
|
|
8
10
|
* GDELT's datetime wire format: exactly 14 digits, YYYYMMDDHHMMSS, no separators.
|
|
9
11
|
*
|
|
@@ -11,6 +13,108 @@
|
|
|
11
13
|
* Schema as `pattern`, letting a caller see the constraint before it calls.
|
|
12
14
|
*/
|
|
13
15
|
export const GDELT_DATETIME_PATTERN = /^\d{14}$/;
|
|
16
|
+
/** GDELT's datetime resolution — the narrowest window a caller can express. */
|
|
17
|
+
const GDELT_RESOLUTION_MS = 1000;
|
|
18
|
+
/** Parse a 14-digit YYYYMMDDHHMMSS string as UTC. Invalid calendar values yield an Invalid Date. */
|
|
19
|
+
function parseGdeltDatetime(value) {
|
|
20
|
+
return new Date(`${value.slice(0, 4)}-${value.slice(4, 6)}-${value.slice(6, 8)}` +
|
|
21
|
+
`T${value.slice(8, 10)}:${value.slice(10, 12)}:${value.slice(12, 14)}Z`);
|
|
22
|
+
}
|
|
23
|
+
/** Format a Date as GDELT's 14-digit YYYYMMDDHHMMSS wire format (UTC). */
|
|
24
|
+
export function toGdeltDatetime(date) {
|
|
25
|
+
return date.toISOString().slice(0, 19).replace(/[-:T]/g, '');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The window a call actually ran against, in GDELT's wire format.
|
|
29
|
+
*
|
|
30
|
+
* Mirrors `applyTimeRange()`'s precedence: an explicit boundary pair wins, a timespan
|
|
31
|
+
* is resolved against now, and a call that pinned neither gets `undefined` rather than
|
|
32
|
+
* a guessed window — GDELT's own default is not something this server can observe.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveEffectiveWindow(args) {
|
|
35
|
+
if (args.startDatetime && args.endDatetime) {
|
|
36
|
+
return { startDatetime: args.startDatetime, endDatetime: args.endDatetime };
|
|
37
|
+
}
|
|
38
|
+
if (args.timespan) {
|
|
39
|
+
const range = resolveTimespan(args.timespan);
|
|
40
|
+
if (range) {
|
|
41
|
+
return {
|
|
42
|
+
startDatetime: toGdeltDatetime(range.start),
|
|
43
|
+
endDatetime: toGdeltDatetime(range.end),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Smallest span that still divides into two strictly-narrower halves. The second half
|
|
51
|
+
* reaches back a second to cover the seam, so it costs `span - floor(span/2) + 1`
|
|
52
|
+
* seconds — only under four does that stop shrinking.
|
|
53
|
+
*/
|
|
54
|
+
const MIN_SPLITTABLE_MS = 4 * GDELT_RESOLUTION_MS;
|
|
55
|
+
/**
|
|
56
|
+
* Split a window into two halves whose union covers it exactly, or `undefined` when it
|
|
57
|
+
* is already too narrow to divide.
|
|
58
|
+
*
|
|
59
|
+
* The second half deliberately **overlaps** the first by one second rather than resuming
|
|
60
|
+
* at the shared midpoint. GDELT documents both boundaries as exclusive — STARTDATETIME
|
|
61
|
+
* considers "only articles published *after* this date/time stamp" and ENDDATETIME "only
|
|
62
|
+
* articles published *before*" it (DOC 2.0 and TV 2.0 API docs alike) — so halves that
|
|
63
|
+
* merely touch at the midpoint would drop every record timestamped exactly there, silently.
|
|
64
|
+
*
|
|
65
|
+
* Reaching back one second closes that seam: under the documented exclusive reading the
|
|
66
|
+
* two halves tile the original window with no gap and no repeat, and if the boundaries
|
|
67
|
+
* turn out to behave inclusively instead, the overlap costs at most two seconds of
|
|
68
|
+
* duplicates — which a caller can see and de-duplicate. Gap-free either way.
|
|
69
|
+
*/
|
|
70
|
+
export function splitWindow(window) {
|
|
71
|
+
const start = parseGdeltDatetime(window.startDatetime);
|
|
72
|
+
const spanMs = parseGdeltDatetime(window.endDatetime).getTime() - start.getTime();
|
|
73
|
+
if (!Number.isFinite(spanMs) || spanMs < MIN_SPLITTABLE_MS)
|
|
74
|
+
return;
|
|
75
|
+
const midpointMs = start.getTime() + Math.floor(spanMs / 2 / GDELT_RESOLUTION_MS) * GDELT_RESOLUTION_MS;
|
|
76
|
+
return [
|
|
77
|
+
{ startDatetime: window.startDatetime, endDatetime: toGdeltDatetime(new Date(midpointMs)) },
|
|
78
|
+
{
|
|
79
|
+
startDatetime: toGdeltDatetime(new Date(midpointMs - GDELT_RESOLUTION_MS)),
|
|
80
|
+
endDatetime: window.endDatetime,
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* How a caller retrieves records left behind once `maxRecords` is already at its ceiling.
|
|
86
|
+
*
|
|
87
|
+
* GDELT exposes no offset or cursor, so narrowing the time window is the only lever, and
|
|
88
|
+
* each outcome is stated rather than implied: halves to re-query when the window divides,
|
|
89
|
+
* how to pin a window when the call never set one, and — when the window is already too
|
|
90
|
+
* narrow to divide — that the remaining records are simply unreachable.
|
|
91
|
+
*
|
|
92
|
+
* Callers own the record-noun prose; this covers only the window reasoning both tools share.
|
|
93
|
+
*/
|
|
94
|
+
export function planWindowContinuation(window) {
|
|
95
|
+
if (!window) {
|
|
96
|
+
return {
|
|
97
|
+
guidance: 'GDELT exposes no offset or cursor, so narrowing the time window is the only way to reach the rest: ' +
|
|
98
|
+
'pin one with startDatetime/endDatetime (or a timespan), then re-run this query against successively narrower halves of it.',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const windows = splitWindow(window);
|
|
102
|
+
if (!windows) {
|
|
103
|
+
return {
|
|
104
|
+
guidance: `The window ${window.startDatetime}–${window.endDatetime} is already too narrow to divide at GDELT's ` +
|
|
105
|
+
'one-second resolution, so the records past this cap are not retrievable through this API.',
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const [first, second] = windows;
|
|
109
|
+
return {
|
|
110
|
+
windows,
|
|
111
|
+
guidance: 'GDELT exposes no offset or cursor. Re-run this query unchanged against each half of the current window — ' +
|
|
112
|
+
`${first.startDatetime}–${first.endDatetime}, then ${second.startDatetime}–${second.endDatetime} ` +
|
|
113
|
+
'(both echoed in continuationWindows) — and split a half again if it also hits the cap. ' +
|
|
114
|
+
'The halves overlap by one second so nothing falls through the seam, so a record on that second can ' +
|
|
115
|
+
'appear in both: de-duplicate on re-assembly.',
|
|
116
|
+
};
|
|
117
|
+
}
|
|
14
118
|
/**
|
|
15
119
|
* True when exactly one of the two boundaries is present.
|
|
16
120
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-range.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/date-range.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"date-range.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/date-range.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAQjD,+EAA+E;AAC/E,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,oGAAoG;AACpG,SAAS,kBAAkB,CAAC,KAAa;IACvC,OAAO,IAAI,IAAI,CACb,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QAC9D,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAC1E,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAItC;IACC,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3C,OAAO,EAAE,aAAa,EAAE,IAAI,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;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACpE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,QAAQ,EACN,qGAAqG;gBACrG,4HAA4H;SAC/H,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,QAAQ,EACN,cAAc,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,WAAW,8CAA8C;gBACtG,2FAA2F;SAC9F,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;IAChC,OAAO;QACL,OAAO;QACP,QAAQ,EACN,2GAA2G;YAC3G,GAAG,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,WAAW,UAAU,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,WAAW,GAAG;YAClG,yFAAyF;YACzF,qGAAqG;YACrG,8CAA8C;KACjD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,aAAsB,EAAE,WAAoB;IAC9E,OAAO,OAAO,CAAC,aAAa,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -14,6 +14,7 @@ export declare const gdeltGetCoverageBreakdown: import("@cyanheads/mcp-ts-core")
|
|
|
14
14
|
timespan: z.ZodOptional<z.ZodString>;
|
|
15
15
|
startDatetime: z.ZodOptional<z.ZodString>;
|
|
16
16
|
endDatetime: z.ZodOptional<z.ZodString>;
|
|
17
|
+
series: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
18
|
}, z.core.$strip>, z.ZodObject<{
|
|
18
19
|
dateResolution: z.ZodEnum<{
|
|
19
20
|
hour: "hour";
|
|
@@ -30,11 +31,24 @@ export declare const gdeltGetCoverageBreakdown: import("@cyanheads/mcp-ts-core")
|
|
|
30
31
|
date: z.ZodString;
|
|
31
32
|
value: z.ZodNumber;
|
|
32
33
|
}, z.core.$strip>>>;
|
|
34
|
+
otherSeriesLabels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
selectedSeries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
36
|
+
label: z.ZodString;
|
|
37
|
+
data: z.ZodArray<z.ZodObject<{
|
|
38
|
+
date: z.ZodString;
|
|
39
|
+
value: z.ZodNumber;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
}, z.core.$strip>>>;
|
|
33
42
|
}, z.core.$strip>, readonly [{
|
|
34
43
|
readonly reason: "no_breakdown_data";
|
|
35
44
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
36
45
|
readonly when: "No breakdown data returned for the query.";
|
|
37
46
|
readonly recovery: "Broaden the query, extend the timespan, or verify the query operators are correct.";
|
|
47
|
+
}, {
|
|
48
|
+
readonly reason: "unknown_series";
|
|
49
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
50
|
+
readonly when: "A label passed in the series input matches no series in this breakdown.";
|
|
51
|
+
readonly recovery: "Read the labels listed in the error and retry series with exact matches from that list.";
|
|
38
52
|
}, {
|
|
39
53
|
readonly reason: "invalid_date_range";
|
|
40
54
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-coverage-breakdown.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-breakdown.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-coverage-breakdown.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-breakdown.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAkDjE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsUpC,CAAC"}
|
|
@@ -10,13 +10,50 @@ import { GDELT_DATETIME_PATTERN, isUnpairedDateRange } from '../date-range.js';
|
|
|
10
10
|
import { inferDateResolution } from '../date-resolution.js';
|
|
11
11
|
/** Maximum number of series to include before aggregating the rest into "Other". */
|
|
12
12
|
const MAX_SERIES = 10;
|
|
13
|
+
/**
|
|
14
|
+
* One language or country coverage series. Shared by the ranked `topSeries` overview and
|
|
15
|
+
* the `selectedSeries` arm so a label retrieved by name carries the identical shape it
|
|
16
|
+
* would have had inside the top 10.
|
|
17
|
+
*/
|
|
18
|
+
const breakdownSeriesSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
label: z.string().describe('Series label (language name or country name).'),
|
|
21
|
+
data: z
|
|
22
|
+
.array(z
|
|
23
|
+
.object({
|
|
24
|
+
date: z.string().describe('Timestep in ISO 8601 format.'),
|
|
25
|
+
value: z
|
|
26
|
+
.number()
|
|
27
|
+
.describe("Normalized coverage volume at this timestep — the topic's share of this " +
|
|
28
|
+
"source's media output, not an absolute article count."),
|
|
29
|
+
})
|
|
30
|
+
.describe('A single data point for this series.'))
|
|
31
|
+
.describe('Time-ordered data points for this series.'),
|
|
32
|
+
})
|
|
33
|
+
.describe('A single language or country coverage series.');
|
|
34
|
+
/** Render one series in full — header, total, peak, and every data point. */
|
|
35
|
+
function renderSeries(series) {
|
|
36
|
+
const total = series.data.reduce((sum, d) => sum + d.value, 0);
|
|
37
|
+
const peak = series.data.reduce((max, d) => (d.value > max.value ? d : max), series.data[0] ?? { date: '', value: 0 });
|
|
38
|
+
const lines = [
|
|
39
|
+
`\n### ${series.label} (total: ${total.toFixed(2)})`,
|
|
40
|
+
`Data points: ${series.data.length}`,
|
|
41
|
+
];
|
|
42
|
+
if (peak.date)
|
|
43
|
+
lines.push(`Peak: ${peak.value.toFixed(3)} at ${peak.date}`);
|
|
44
|
+
for (const d of series.data)
|
|
45
|
+
lines.push(`- ${d.date}: ${d.value.toFixed(3)}`);
|
|
46
|
+
return lines;
|
|
47
|
+
}
|
|
13
48
|
export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
14
49
|
title: 'Get GDELT Coverage Breakdown',
|
|
15
50
|
description: 'Break down news coverage volume over time by source language or source country, returning a ' +
|
|
16
51
|
'multi-series time series (one series per language or country). ' +
|
|
17
52
|
'Shows which countries or languages drove early vs. late coverage — useful for tracing how a ' +
|
|
18
53
|
'story propagated geographically or across language communities. ' +
|
|
19
|
-
'Returns up to 10 series by total volume
|
|
54
|
+
'Returns up to 10 series by total volume and aggregates the rest into an "Other" bucket, naming ' +
|
|
55
|
+
'every series it folded in there under otherSeriesLabels — pass any of those labels back as the ' +
|
|
56
|
+
'series input to get that series complete, ranked or not. ' +
|
|
20
57
|
"Values are normalized: each point is the topic's share of media output, not an absolute article count. " +
|
|
21
58
|
'Small media markets with concentrated coverage therefore rank above large markets with diverse output — ' +
|
|
22
59
|
"a high value means the topic dominated that source's coverage, not that it published the most articles. " +
|
|
@@ -30,6 +67,12 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
30
67
|
when: 'No breakdown data returned for the query.',
|
|
31
68
|
recovery: 'Broaden the query, extend the timespan, or verify the query operators are correct.',
|
|
32
69
|
},
|
|
70
|
+
{
|
|
71
|
+
reason: 'unknown_series',
|
|
72
|
+
code: JsonRpcErrorCode.NotFound,
|
|
73
|
+
when: 'A label passed in the series input matches no series in this breakdown.',
|
|
74
|
+
recovery: 'Read the labels listed in the error and retry series with exact matches from that list.',
|
|
75
|
+
},
|
|
33
76
|
{
|
|
34
77
|
reason: 'invalid_date_range',
|
|
35
78
|
code: JsonRpcErrorCode.ValidationError,
|
|
@@ -77,27 +120,18 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
77
120
|
.optional()
|
|
78
121
|
.describe('End datetime in GDELT format YYYYMMDDHHMMSS — exactly 14 digits, no separators ' +
|
|
79
122
|
'(e.g. 20240131235959). Must pair with startDatetime; supplying only one of the two is rejected.'),
|
|
123
|
+
series: z
|
|
124
|
+
.array(z.string())
|
|
125
|
+
.optional()
|
|
126
|
+
.describe('Exact series labels to additionally return in full, e.g. ["Portuguese", "Vietnamese"]. ' +
|
|
127
|
+
'Take them verbatim from otherSeriesLabels (the series folded into "Other") or topSeries[].label ' +
|
|
128
|
+
'in a response, or from the label list an unknown_series error prints. Each one comes back complete ' +
|
|
129
|
+
'under selectedSeries, on top of the usual top-10 overview; a label that matches nothing is rejected ' +
|
|
130
|
+
'rather than silently skipped. Omit to get the overview alone.'),
|
|
80
131
|
}),
|
|
81
132
|
output: z.object({
|
|
82
133
|
dateResolution: z.enum(['hour', 'day']).describe('Temporal resolution of data points.'),
|
|
83
|
-
topSeries: z
|
|
84
|
-
.array(z
|
|
85
|
-
.object({
|
|
86
|
-
label: z.string().describe('Series label (language name or country name).'),
|
|
87
|
-
data: z
|
|
88
|
-
.array(z
|
|
89
|
-
.object({
|
|
90
|
-
date: z.string().describe('Timestep in ISO 8601 format.'),
|
|
91
|
-
value: z
|
|
92
|
-
.number()
|
|
93
|
-
.describe("Normalized coverage volume at this timestep — the topic's share of this " +
|
|
94
|
-
"source's media output, not an absolute article count."),
|
|
95
|
-
})
|
|
96
|
-
.describe('A single data point for this series.'))
|
|
97
|
-
.describe('Time-ordered data points for this series.'),
|
|
98
|
-
})
|
|
99
|
-
.describe('A single language or country coverage series.'))
|
|
100
|
-
.describe('Top 10 series by total coverage volume.'),
|
|
134
|
+
topSeries: z.array(breakdownSeriesSchema).describe('Top 10 series by total coverage volume.'),
|
|
101
135
|
otherAggregated: z
|
|
102
136
|
.array(z
|
|
103
137
|
.object({
|
|
@@ -110,6 +144,17 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
110
144
|
.describe('A single aggregated data point for the "Other" bucket.'))
|
|
111
145
|
.optional()
|
|
112
146
|
.describe('Combined time series for all series beyond the top 10. Omitted when all series fit.'),
|
|
147
|
+
otherSeriesLabels: z
|
|
148
|
+
.array(z.string())
|
|
149
|
+
.optional()
|
|
150
|
+
.describe('Label of every series folded into otherAggregated, ranked by total volume — the identities the ' +
|
|
151
|
+
'"Other" bucket would otherwise dissolve. Pass any of them to the series input to retrieve that ' +
|
|
152
|
+
"series' complete data. Omitted when all series fit in the top 10."),
|
|
153
|
+
selectedSeries: z
|
|
154
|
+
.array(breakdownSeriesSchema)
|
|
155
|
+
.optional()
|
|
156
|
+
.describe('Complete, untruncated time series for each label requested via the series input, in the order ' +
|
|
157
|
+
'requested. Omitted when series was not supplied.'),
|
|
113
158
|
}),
|
|
114
159
|
// Agent-facing context — query echo, breakdown dimension, total series count, and notice on empty results.
|
|
115
160
|
// Reaches structuredContent and content[] automatically; never in the domain return.
|
|
@@ -169,6 +214,7 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
169
214
|
const topSeries = sorted.slice(0, MAX_SERIES).map(({ total: _, ...s }) => s);
|
|
170
215
|
const remainingSeries = sorted.slice(MAX_SERIES);
|
|
171
216
|
let otherAggregated;
|
|
217
|
+
let otherSeriesLabels;
|
|
172
218
|
if (remainingSeries.length > 0) {
|
|
173
219
|
const dateMap = new Map();
|
|
174
220
|
for (const s of remainingSeries) {
|
|
@@ -179,6 +225,31 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
179
225
|
otherAggregated = Array.from(dateMap.entries())
|
|
180
226
|
.sort(([a], [b]) => a.localeCompare(b))
|
|
181
227
|
.map(([date, value]) => ({ date, value }));
|
|
228
|
+
otherSeriesLabels = remainingSeries.map((s) => s.label);
|
|
229
|
+
}
|
|
230
|
+
// Label selection re-filters the same complete upstream set the ranking sliced, so a
|
|
231
|
+
// series named on a follow-up call reconstructs statelessly from query + dimension + label.
|
|
232
|
+
const selectedSeries = [];
|
|
233
|
+
if (input.series?.length) {
|
|
234
|
+
const byLabel = new Map(allSeries.map((s) => [s.label, s]));
|
|
235
|
+
const unknown = [];
|
|
236
|
+
for (const label of input.series) {
|
|
237
|
+
const match = byLabel.get(label);
|
|
238
|
+
if (match)
|
|
239
|
+
selectedSeries.push(match);
|
|
240
|
+
else
|
|
241
|
+
unknown.push(label);
|
|
242
|
+
}
|
|
243
|
+
if (unknown.length > 0) {
|
|
244
|
+
const named = unknown.map((label) => `"${label}"`).join(', ');
|
|
245
|
+
throw ctx.fail('unknown_series', `No ${input.breakdownBy} series named ${named}`, {
|
|
246
|
+
unknownLabels: unknown,
|
|
247
|
+
recovery: {
|
|
248
|
+
hint: `This breakdown has no ${input.breakdownBy} series named ${named}. Labels are exact and ` +
|
|
249
|
+
`case-sensitive. Available for "${input.query}": ${sorted.map((s) => s.label).join(', ')}.`,
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
}
|
|
182
253
|
}
|
|
183
254
|
const allDates = topSeries.flatMap((s) => s.data.map((d) => d.date));
|
|
184
255
|
const dateResolution = inferDateResolution(allDates);
|
|
@@ -192,13 +263,21 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
192
263
|
ctx.log.info('gdelt_get_coverage_breakdown completed', {
|
|
193
264
|
totalSeries: allSeries.length,
|
|
194
265
|
topSeriesCount: topSeries.length,
|
|
266
|
+
selectedSeriesCount: selectedSeries.length,
|
|
195
267
|
});
|
|
196
268
|
return {
|
|
197
269
|
dateResolution,
|
|
198
270
|
topSeries,
|
|
199
271
|
...(otherAggregated ? { otherAggregated } : {}),
|
|
272
|
+
...(otherSeriesLabels ? { otherSeriesLabels } : {}),
|
|
273
|
+
...(selectedSeries.length > 0 ? { selectedSeries } : {}),
|
|
200
274
|
};
|
|
201
275
|
},
|
|
276
|
+
/**
|
|
277
|
+
* Every arm renders on its own field presence, never as an `if`/`else if` chain — the
|
|
278
|
+
* format-parity linter populates all optional fields at once in its synthetic sample,
|
|
279
|
+
* so a mutually-exclusive branch would leave the untaken arm unverified.
|
|
280
|
+
*/
|
|
202
281
|
format: (result) => {
|
|
203
282
|
const lines = [
|
|
204
283
|
`## GDELT Coverage Breakdown`,
|
|
@@ -207,17 +286,8 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
207
286
|
`not an article count. Small media markets with concentrated coverage rank above large ` +
|
|
208
287
|
`markets with diverse output.`,
|
|
209
288
|
];
|
|
210
|
-
for (const s of result.topSeries)
|
|
211
|
-
|
|
212
|
-
lines.push(`\n### ${s.label} (total: ${total.toFixed(2)})`);
|
|
213
|
-
lines.push(`Data points: ${s.data.length}`);
|
|
214
|
-
const peak = s.data.reduce((max, d) => (d.value > max.value ? d : max), s.data[0] ?? { date: '', value: 0 });
|
|
215
|
-
if (peak.date)
|
|
216
|
-
lines.push(`Peak: ${peak.value.toFixed(3)} at ${peak.date}`);
|
|
217
|
-
for (const d of s.data) {
|
|
218
|
-
lines.push(`- ${d.date}: ${d.value.toFixed(3)}`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
289
|
+
for (const s of result.topSeries)
|
|
290
|
+
lines.push(...renderSeries(s));
|
|
221
291
|
if (result.otherAggregated) {
|
|
222
292
|
const otherTotal = result.otherAggregated.reduce((sum, d) => sum + d.value, 0);
|
|
223
293
|
const otherPeak = result.otherAggregated.reduce((max, d) => (d.value > max.value ? d : max), result.otherAggregated[0] ?? { date: '', value: 0 });
|
|
@@ -229,6 +299,18 @@ export const gdeltGetCoverageBreakdown = tool('gdelt_get_coverage_breakdown', {
|
|
|
229
299
|
lines.push(`- ${d.date}: ${d.value.toFixed(3)}`);
|
|
230
300
|
}
|
|
231
301
|
}
|
|
302
|
+
if (result.otherSeriesLabels?.length) {
|
|
303
|
+
lines.push(`\n### Series folded into "Other" (${result.otherSeriesLabels.length})`);
|
|
304
|
+
lines.push(`Ranked by total volume. Re-call with series: ["<label>"] to get any of them in full.`);
|
|
305
|
+
for (const label of result.otherSeriesLabels)
|
|
306
|
+
lines.push(`- ${label}`);
|
|
307
|
+
}
|
|
308
|
+
if (result.selectedSeries?.length) {
|
|
309
|
+
lines.push(`\n## Selected Series (${result.selectedSeries.length})`);
|
|
310
|
+
lines.push(`Complete series for the labels requested via the series input.`);
|
|
311
|
+
for (const s of result.selectedSeries)
|
|
312
|
+
lines.push(...renderSeries(s));
|
|
313
|
+
}
|
|
232
314
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
233
315
|
},
|
|
234
316
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-coverage-breakdown.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-breakdown.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,oFAAoF;AACpF,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,8BAA8B,EAAE;IAC5E,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,8FAA8F;QAC9F,iEAAiE;QACjE,8FAA8F;QAC9F,kEAAkE;QAClE,mGAAmG;QACnG,yGAAyG;QACzG,0GAA0G;QAC1G,0GAA0G;QAC1G,yFAAyF;QACzF,mDAAmD;IACrD,WAAW,EAAE,EAAE,YAAY,EAAE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CAAC,CAAC;YAC3F,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;gBACvC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"get-coverage-breakdown.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-breakdown.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,oFAAoF;AACpF,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,CAAC;KAC5B,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IAC3E,IAAI,EAAE,CAAC;SACJ,KAAK,CACJ,CAAC;SACE,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QACzD,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,CACP,0EAA0E;YACxE,uDAAuD,CAC1D;KACJ,CAAC;SACD,Q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,iBAAiB,EAAE,MAAM,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,qCAAqC,MAAM,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC;YACpF,KAAK,CAAC,IAAI,CACR,sFAAsF,CACvF,CAAC;YACF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,iBAAiB;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QACzE,CAAC;QAED,IAAI,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,yBAAyB,MAAM,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;YACrE,KAAK,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;YAC7E,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,cAAc;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -16,6 +16,7 @@ export declare const gdeltGetCoverageTimeline: import("@cyanheads/mcp-ts-core").
|
|
|
16
16
|
startDatetime: z.ZodOptional<z.ZodString>;
|
|
17
17
|
endDatetime: z.ZodOptional<z.ZodString>;
|
|
18
18
|
smoothing: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
points: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
20
|
}, z.core.$strip>, z.ZodObject<{
|
|
20
21
|
dateResolution: z.ZodEnum<{
|
|
21
22
|
hour: "hour";
|
|
@@ -32,11 +33,17 @@ export declare const gdeltGetCoverageTimeline: import("@cyanheads/mcp-ts-core").
|
|
|
32
33
|
}, z.core.$strip>>>;
|
|
33
34
|
}, z.core.$strip>>;
|
|
34
35
|
}, z.core.$strip>>;
|
|
36
|
+
expandedPoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
37
|
}, z.core.$strip>, readonly [{
|
|
36
38
|
readonly reason: "no_timeline_data";
|
|
37
39
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
38
40
|
readonly when: "No timeline data returned for the query and time range.";
|
|
39
41
|
readonly recovery: "Broaden the query, extend the timespan, or verify query operators are correct.";
|
|
42
|
+
}, {
|
|
43
|
+
readonly reason: "unknown_point";
|
|
44
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
45
|
+
readonly when: "A date passed in the points input matches no timestep in this timeline.";
|
|
46
|
+
readonly recovery: "Read the timestep dates listed in the error and retry points with exact matches from that list.";
|
|
40
47
|
}, {
|
|
41
48
|
readonly reason: "invalid_date_range";
|
|
42
49
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-coverage-timeline.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-timeline.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-coverage-timeline.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-timeline.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAkBjE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8TnC,CAAC"}
|
|
@@ -9,12 +9,15 @@ import { getGdeltDocService } from '../../../services/gdelt/gdelt-doc-service.js
|
|
|
9
9
|
import { GDELT_DATETIME_PATTERN, isUnpairedDateRange } from '../date-range.js';
|
|
10
10
|
import { inferDateResolution } from '../date-resolution.js';
|
|
11
11
|
/**
|
|
12
|
-
* Article links rendered per timestep in volume_with_articles mode
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
12
|
+
* Article links rendered per timestep in volume_with_articles mode, for timesteps the
|
|
13
|
+
* caller did not name in `points`. Every data point's date and value is rendered; only
|
|
14
|
+
* the per-point article list stays capped by default. GDELT returns up to 10 articles per
|
|
15
|
+
* timestep across as many as ~288 timesteps, so rendering them all unconditionally would
|
|
16
|
+
* put ~450 KB of links in content[] and swamp the timeline itself.
|
|
17
|
+
*
|
|
18
|
+
* The complete set always rides in structuredContent, each point renders its true article
|
|
19
|
+
* count next to how many links it showed, and `points` lifts the cap for named timesteps —
|
|
20
|
+
* so the gap is both visible and retrievable rather than a silent truncation.
|
|
18
21
|
*/
|
|
19
22
|
const ARTICLES_PER_POINT = 3;
|
|
20
23
|
export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
@@ -26,6 +29,8 @@ export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
|
26
29
|
'avoiding a follow-up gdelt_search_articles call. ' +
|
|
27
30
|
'Use mode "tone" for average sentiment score per timestep (negative = hostile/fearful, positive = celebratory). ' +
|
|
28
31
|
'Date resolution is automatically chosen based on timespan: hours for short windows, days for longer ones. ' +
|
|
32
|
+
'In volume_with_articles mode the text surface shows the first 3 article links per timestep next to that ' +
|
|
33
|
+
"timestep's true article count; name a timestep's date in points to render its full list. " +
|
|
29
34
|
'Note: DOC API covers only the last 3 months.',
|
|
30
35
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
31
36
|
errors: [
|
|
@@ -35,6 +40,12 @@ export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
|
35
40
|
when: 'No timeline data returned for the query and time range.',
|
|
36
41
|
recovery: 'Broaden the query, extend the timespan, or verify query operators are correct.',
|
|
37
42
|
},
|
|
43
|
+
{
|
|
44
|
+
reason: 'unknown_point',
|
|
45
|
+
code: JsonRpcErrorCode.NotFound,
|
|
46
|
+
when: 'A date passed in the points input matches no timestep in this timeline.',
|
|
47
|
+
recovery: 'Read the timestep dates listed in the error and retry points with exact matches from that list.',
|
|
48
|
+
},
|
|
38
49
|
{
|
|
39
50
|
reason: 'invalid_date_range',
|
|
40
51
|
code: JsonRpcErrorCode.ValidationError,
|
|
@@ -92,6 +103,14 @@ export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
|
92
103
|
.optional()
|
|
93
104
|
.describe('Smoothing window in timesteps (0 = none, 1–5 = moving average width). ' +
|
|
94
105
|
'Reduces noise for spotty topics.'),
|
|
106
|
+
points: z
|
|
107
|
+
.array(z.string())
|
|
108
|
+
.optional()
|
|
109
|
+
.describe('Timestep dates whose complete article list should be rendered in the text surface, e.g. ' +
|
|
110
|
+
'["2024-01-05T12:00:00Z"]. Take them verbatim from series[].data[].date in a prior response, or ' +
|
|
111
|
+
'from the list an unknown_point error prints. Only affects volume_with_articles rendering — every ' +
|
|
112
|
+
'timestep already carries its full article list in structuredContent regardless. Timesteps not named ' +
|
|
113
|
+
'here show their first 3 links; a date matching no timestep is rejected rather than silently ignored.'),
|
|
95
114
|
}),
|
|
96
115
|
output: z.object({
|
|
97
116
|
dateResolution: z
|
|
@@ -124,6 +143,12 @@ export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
|
124
143
|
})
|
|
125
144
|
.describe('A single time series with a label and data points.'))
|
|
126
145
|
.describe('One or more time series (typically one for volume/tone, one per label for breakdowns).'),
|
|
146
|
+
expandedPoints: z
|
|
147
|
+
.array(z.string())
|
|
148
|
+
.optional()
|
|
149
|
+
.describe('Timestep dates whose full article list is rendered in the text surface instead of the first 3, ' +
|
|
150
|
+
'echoing the points input. Omitted when points was not supplied. Purely a rendering concern — ' +
|
|
151
|
+
'structuredContent carries every article for every timestep either way.'),
|
|
127
152
|
}),
|
|
128
153
|
// Agent-facing context — query echo, mode used, date span covered, and notice on empty results.
|
|
129
154
|
// Reaches structuredContent and content[] automatically; never in the domain return.
|
|
@@ -176,6 +201,22 @@ export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
|
176
201
|
const allDates = series.flatMap((s) => s.data.map((d) => d.date));
|
|
177
202
|
const dateResolution = inferDateResolution(allDates);
|
|
178
203
|
const totalPoints = series.reduce((sum, s) => sum + s.data.length, 0);
|
|
204
|
+
// A points value that matches no timestep would expand nothing and say nothing —
|
|
205
|
+
// the same silent withholding the selector exists to remove. Reject it instead.
|
|
206
|
+
if (input.points?.length) {
|
|
207
|
+
const available = new Set(allDates);
|
|
208
|
+
const unknown = input.points.filter((date) => !available.has(date));
|
|
209
|
+
if (unknown.length > 0) {
|
|
210
|
+
const named = unknown.map((date) => `"${date}"`).join(', ');
|
|
211
|
+
throw ctx.fail('unknown_point', `No timestep at ${named}`, {
|
|
212
|
+
unknownPoints: unknown,
|
|
213
|
+
recovery: {
|
|
214
|
+
hint: `This timeline has no timestep at ${named}. Dates are exact, at ${dateResolution} resolution. ` +
|
|
215
|
+
`Available: ${[...available].join(', ')}.`,
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
179
220
|
ctx.enrich.echo(input.query);
|
|
180
221
|
ctx.enrich.total(totalPoints);
|
|
181
222
|
ctx.enrich({
|
|
@@ -187,13 +228,31 @@ export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
|
187
228
|
seriesCount: series.length,
|
|
188
229
|
pointCount: series[0]?.data.length ?? 0,
|
|
189
230
|
});
|
|
190
|
-
return {
|
|
231
|
+
return {
|
|
232
|
+
dateResolution,
|
|
233
|
+
series,
|
|
234
|
+
...(input.points?.length ? { expandedPoints: input.points } : {}),
|
|
235
|
+
};
|
|
191
236
|
},
|
|
237
|
+
/**
|
|
238
|
+
* Renders each field on its own presence, never as an `if`/`else if` chain — the
|
|
239
|
+
* format-parity linter populates every optional field at once in its synthetic sample,
|
|
240
|
+
* so a mutually-exclusive branch would leave the untaken one unverified.
|
|
241
|
+
*/
|
|
192
242
|
format: (result) => {
|
|
243
|
+
const expanded = new Set(result.expandedPoints ?? []);
|
|
193
244
|
const lines = [
|
|
194
245
|
`## GDELT Coverage Timeline`,
|
|
195
246
|
`**Date Resolution:** ${result.dateResolution}`,
|
|
196
247
|
];
|
|
248
|
+
const capped = result.series.some((s) => s.data.some((d) => (d.articles?.length ?? 0) > ARTICLES_PER_POINT && !expanded.has(d.date)));
|
|
249
|
+
if (capped) {
|
|
250
|
+
lines.push(`**Article links:** first ${ARTICLES_PER_POINT} per timestep, with each timestep's true total ` +
|
|
251
|
+
`beside it. Re-call with points: ["<date>"] to render a timestep's full list.`);
|
|
252
|
+
}
|
|
253
|
+
if (result.expandedPoints?.length) {
|
|
254
|
+
lines.push(`**Fully expanded timesteps:** ${result.expandedPoints.join(', ')}`);
|
|
255
|
+
}
|
|
197
256
|
for (const s of result.series) {
|
|
198
257
|
lines.push(`\n### ${s.label}`);
|
|
199
258
|
const peakPoint = s.data.reduce((max, d) => (Math.abs(d.value) > Math.abs(max.value) ? d : max), s.data[0] ?? { date: '', value: 0, articles: undefined });
|
|
@@ -202,13 +261,14 @@ export const gdeltGetCoverageTimeline = tool('gdelt_get_coverage_timeline', {
|
|
|
202
261
|
lines.push(`**Peak:** ${peakPoint.value.toFixed(3)} at ${peakPoint.date}`);
|
|
203
262
|
}
|
|
204
263
|
for (const d of s.data) {
|
|
205
|
-
const
|
|
264
|
+
const shown = expanded.has(d.date) ? d.articles : d.articles?.slice(0, ARTICLES_PER_POINT);
|
|
265
|
+
const withheld = (d.articles?.length ?? 0) - (shown?.length ?? 0);
|
|
266
|
+
const articlesNote = d.articles?.length
|
|
267
|
+
? ` (${d.articles.length} articles${withheld > 0 ? `, ${shown?.length} shown` : ''})`
|
|
268
|
+
: '';
|
|
206
269
|
lines.push(`- ${d.date}: ${d.value.toFixed(3)}${articlesNote}`);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
lines.push(` - [${a.title}](${a.url})`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
270
|
+
for (const a of shown ?? [])
|
|
271
|
+
lines.push(` - [${a.title}](${a.url})`);
|
|
212
272
|
}
|
|
213
273
|
}
|
|
214
274
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-coverage-timeline.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-timeline.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"get-coverage-timeline.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-coverage-timeline.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,k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IAAI,KAAK,IAAI,EAAE;oBAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -51,5 +51,9 @@ export declare const gdeltGetTvClips: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
51
51
|
readonly effectiveQuery: z.ZodString;
|
|
52
52
|
readonly totalCount: z.ZodNumber;
|
|
53
53
|
readonly notice: z.ZodOptional<z.ZodString>;
|
|
54
|
+
readonly continuationWindows: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
55
|
+
startDatetime: z.ZodString;
|
|
56
|
+
endDatetime: z.ZodString;
|
|
57
|
+
}, z.core.$strip>>>;
|
|
54
58
|
}>;
|
|
55
59
|
//# sourceMappingURL=get-tv-clips.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-tv-clips.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-tv-clips.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-tv-clips.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-tv-clips.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAiBjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoP1B,CAAC"}
|
|
@@ -7,13 +7,21 @@ import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
|
7
7
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
8
8
|
import { formatDateShort, resolveTimespan } from '../../../services/gdelt/gdelt-fetch.js';
|
|
9
9
|
import { getGdeltTvService } from '../../../services/gdelt/gdelt-tv-service.js';
|
|
10
|
-
import { GDELT_DATETIME_PATTERN, isUnpairedDateRange } from '../date-range.js';
|
|
10
|
+
import { GDELT_DATETIME_PATTERN, isUnpairedDateRange, planWindowContinuation, resolveEffectiveWindow, } from '../date-range.js';
|
|
11
|
+
/**
|
|
12
|
+
* Hard ceiling GDELT's TV API serves in one clip request, and the `maxRecords` schema
|
|
13
|
+
* maximum. Past it there is no offset or cursor — the cap-hit disclosure switches from
|
|
14
|
+
* "raise maxRecords" to partitioning the date window.
|
|
15
|
+
*/
|
|
16
|
+
const MAX_RECORDS_CEILING = 3000;
|
|
11
17
|
export const gdeltGetTvClips = tool('gdelt_get_tv_clips', {
|
|
12
18
|
title: 'Get GDELT TV Clips',
|
|
13
19
|
description: "Retrieve the top matching TV news clips (up to 3,000) for a query from the Internet Archive's " +
|
|
14
20
|
'Television News Archive. Each clip includes show name, station, air timestamp, a 15-second ' +
|
|
15
21
|
'transcript excerpt, and a direct link to view the full one-minute clip. ' +
|
|
16
22
|
'Use after gdelt_search_tv to read the actual transcript content driving a coverage spike. ' +
|
|
23
|
+
'3,000 is a hard per-call ceiling and GDELT offers no cursor: when a query fills it, split the run ' +
|
|
24
|
+
'into narrower startDatetime/endDatetime windows — the response hands back the exact windows to use. ' +
|
|
17
25
|
'Archive coverage spans 2009–October 2024.',
|
|
18
26
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
19
27
|
errors: [
|
|
@@ -78,9 +86,11 @@ export const gdeltGetTvClips = tool('gdelt_get_tv_clips', {
|
|
|
78
86
|
.number()
|
|
79
87
|
.int()
|
|
80
88
|
.min(1)
|
|
81
|
-
.max(
|
|
89
|
+
.max(MAX_RECORDS_CEILING)
|
|
82
90
|
.default(50)
|
|
83
|
-
.describe(
|
|
91
|
+
.describe("Maximum number of clips to return (1–3000). 3000 is GDELT's hard per-call ceiling, not a page " +
|
|
92
|
+
'size — there is no cursor past it, so a query that fills 3000 must be split into narrower ' +
|
|
93
|
+
'startDatetime/endDatetime windows instead.'),
|
|
84
94
|
sort: z
|
|
85
95
|
.enum(['relevance', 'dateDesc', 'dateAsc'])
|
|
86
96
|
.default('relevance')
|
|
@@ -103,15 +113,40 @@ export const gdeltGetTvClips = tool('gdelt_get_tv_clips', {
|
|
|
103
113
|
.describe('A single TV news clip with transcript excerpt and archive link.'))
|
|
104
114
|
.describe('Matching TV clips sorted per the sort parameter.'),
|
|
105
115
|
}),
|
|
106
|
-
// Agent-facing context — query echo, clip count, and
|
|
107
|
-
// Reaches structuredContent and content[] automatically; never
|
|
116
|
+
// Agent-facing context — query echo, clip count, and the cap-hit disclosure with its
|
|
117
|
+
// continuation windows. Reaches structuredContent and content[] automatically; never
|
|
118
|
+
// in the domain return.
|
|
108
119
|
enrichment: {
|
|
109
120
|
effectiveQuery: z.string().describe('Echoed query string for use in follow-up calls.'),
|
|
110
121
|
totalCount: z.number().describe('Number of clips returned.'),
|
|
111
122
|
notice: z
|
|
112
123
|
.string()
|
|
113
124
|
.optional()
|
|
114
|
-
.describe('
|
|
125
|
+
.describe('Disclosure that the maxRecords cap was reached and more clips may exist, naming the route to ' +
|
|
126
|
+
'them — a higher maxRecords below the 3000 ceiling, or a narrower date window at it. ' +
|
|
127
|
+
'Absent when the full result set fit under the cap.'),
|
|
128
|
+
continuationWindows: z
|
|
129
|
+
.array(z
|
|
130
|
+
.object({
|
|
131
|
+
startDatetime: z
|
|
132
|
+
.string()
|
|
133
|
+
.describe('Start of this window in GDELT format YYYYMMDDHHMMSS.'),
|
|
134
|
+
endDatetime: z.string().describe('End of this window in GDELT format YYYYMMDDHHMMSS.'),
|
|
135
|
+
})
|
|
136
|
+
.describe('One window to re-query with the same query string.'))
|
|
137
|
+
.optional()
|
|
138
|
+
.describe('The queried window halved, to re-run this query against one pair at a time when maxRecords is at ' +
|
|
139
|
+
'its 3000 ceiling. The halves overlap by one second so no clip falls through the seam; a clip aired ' +
|
|
140
|
+
'on that second can come back in both, so de-duplicate by archiveUrl. Absent unless the ceiling was ' +
|
|
141
|
+
'reached with a window that is both known and wide enough to divide.'),
|
|
142
|
+
},
|
|
143
|
+
enrichmentTrailer: {
|
|
144
|
+
continuationWindows: {
|
|
145
|
+
render: (windows = []) => [
|
|
146
|
+
'**Continuation windows:**',
|
|
147
|
+
...windows.map((w) => `- startDatetime: ${w.startDatetime}, endDatetime: ${w.endDatetime}`),
|
|
148
|
+
].join('\n'),
|
|
149
|
+
},
|
|
115
150
|
},
|
|
116
151
|
async handler(input, ctx) {
|
|
117
152
|
if (isUnpairedDateRange(input.startDatetime, input.endDatetime)) {
|
|
@@ -146,8 +181,17 @@ export const gdeltGetTvClips = tool('gdelt_get_tv_clips', {
|
|
|
146
181
|
ctx.enrich.echo(input.query);
|
|
147
182
|
ctx.enrich.total(clips.length);
|
|
148
183
|
if (clips.length >= input.maxRecords) {
|
|
149
|
-
|
|
150
|
-
`
|
|
184
|
+
if (input.maxRecords < MAX_RECORDS_CEILING) {
|
|
185
|
+
ctx.enrich.notice(`Returned ${clips.length} clips (maxRecords cap reached — there may be more). ` +
|
|
186
|
+
`Increase maxRecords up to ${MAX_RECORDS_CEILING} to retrieve more.`);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
const continuation = planWindowContinuation(resolveEffectiveWindow(input));
|
|
190
|
+
if (continuation.windows)
|
|
191
|
+
ctx.enrich({ continuationWindows: continuation.windows });
|
|
192
|
+
ctx.enrich.notice(`Returned ${clips.length} clips — maxRecords is already at its ${MAX_RECORDS_CEILING} ceiling, ` +
|
|
193
|
+
`so more clips almost certainly matched. ${continuation.guidance}`);
|
|
194
|
+
}
|
|
151
195
|
}
|
|
152
196
|
ctx.log.info('gdelt_get_tv_clips completed', { count: clips.length });
|
|
153
197
|
return { clips };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-tv-clips.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-tv-clips.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"get-tv-clips.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-tv-clips.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,oBAAoB,EAAE;IACxD,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,gGAAgG;QAChG,6FAA6F;QAC7F,0EAA0E;QAC1E,4FAA4F;QAC5F,oGAAoG;QACpG,sGAAsG;QACtG,2CAA2C;IAC7C,WAAW,EAAE,EAAE,YAAY,EA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I,MAAM,CAAC,KAAK,EAAE,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7C,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;YAC7C,IAAI,CAAC,CAAC,SAAS;gBAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -52,5 +52,9 @@ export declare const gdeltSearchArticles: import("@cyanheads/mcp-ts-core").ToolD
|
|
|
52
52
|
readonly totalCount: z.ZodNumber;
|
|
53
53
|
readonly timespan: z.ZodOptional<z.ZodString>;
|
|
54
54
|
readonly notice: z.ZodOptional<z.ZodString>;
|
|
55
|
+
readonly continuationWindows: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
56
|
+
startDatetime: z.ZodString;
|
|
57
|
+
endDatetime: z.ZodString;
|
|
58
|
+
}, z.core.$strip>>>;
|
|
55
59
|
}>;
|
|
56
60
|
//# sourceMappingURL=search-articles.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-articles.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-articles.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"search-articles.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-articles.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAgBjE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2O9B,CAAC"}
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
7
7
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
8
8
|
import { getGdeltDocService } from '../../../services/gdelt/gdelt-doc-service.js';
|
|
9
|
-
import { GDELT_DATETIME_PATTERN, isUnpairedDateRange } from '../date-range.js';
|
|
9
|
+
import { GDELT_DATETIME_PATTERN, isUnpairedDateRange, planWindowContinuation, resolveEffectiveWindow, } from '../date-range.js';
|
|
10
|
+
/**
|
|
11
|
+
* Hard ceiling GDELT's DOC API serves in one article request, and the `maxRecords`
|
|
12
|
+
* schema maximum. Past it there is no offset or cursor — the cap-hit disclosure
|
|
13
|
+
* switches from "raise maxRecords" to partitioning the date window.
|
|
14
|
+
*/
|
|
15
|
+
const MAX_RECORDS_CEILING = 250;
|
|
10
16
|
export const gdeltSearchArticles = tool('gdelt_search_articles', {
|
|
11
17
|
title: 'Search GDELT Articles',
|
|
12
18
|
description: 'Search the last 3 months of global news coverage (65+ languages) using the GDELT DOC API. ' +
|
|
@@ -14,6 +20,8 @@ export const gdeltSearchArticles = tool('gdelt_search_articles', {
|
|
|
14
20
|
'Query supports full GDELT syntax: phrases ("bird flu"), boolean OR ((flu OR pandemic)), source country (sourcecountry:china), ' +
|
|
15
21
|
'source language (sourcelang:spanish), domain (domain:who.int), GKG theme (theme:DISEASE_OUTBREAK), ' +
|
|
16
22
|
'tone filter (tone<-5 for negative), proximity (near20:"flu virus"), and repeat (repeat3:"outbreak"). ' +
|
|
23
|
+
'250 is a hard per-call ceiling and GDELT offers no cursor: when a query fills it, split the run into ' +
|
|
24
|
+
'narrower startDatetime/endDatetime windows — the response hands back the exact windows to use. ' +
|
|
17
25
|
'Note: this API covers only the most recent 3 months — use gdelt_search_tv for historical TV transcripts back to 2009.',
|
|
18
26
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
19
27
|
errors: [
|
|
@@ -73,9 +81,11 @@ export const gdeltSearchArticles = tool('gdelt_search_articles', {
|
|
|
73
81
|
.number()
|
|
74
82
|
.int()
|
|
75
83
|
.min(1)
|
|
76
|
-
.max(
|
|
84
|
+
.max(MAX_RECORDS_CEILING)
|
|
77
85
|
.default(75)
|
|
78
|
-
.describe(
|
|
86
|
+
.describe("Maximum number of articles to return (1–250). 250 is GDELT's hard per-call ceiling, not a " +
|
|
87
|
+
'page size — there is no cursor past it, so a query that fills 250 must be split into narrower ' +
|
|
88
|
+
'startDatetime/endDatetime windows instead.'),
|
|
79
89
|
sort: z
|
|
80
90
|
.enum(['date', 'relevance', 'social'])
|
|
81
91
|
.default('relevance')
|
|
@@ -103,9 +113,9 @@ export const gdeltSearchArticles = tool('gdelt_search_articles', {
|
|
|
103
113
|
.describe('A single news article with metadata.'))
|
|
104
114
|
.describe('Matching articles sorted per the sort parameter.'),
|
|
105
115
|
}),
|
|
106
|
-
// Agent-facing context — query echo, total count, optional timespan echo, and
|
|
107
|
-
//
|
|
108
|
-
// domain return.
|
|
116
|
+
// Agent-facing context — query echo, total count, optional timespan echo, and the
|
|
117
|
+
// cap-hit disclosure with its continuation windows. Reaches structuredContent and
|
|
118
|
+
// content[] automatically; never in the domain return.
|
|
109
119
|
enrichment: {
|
|
110
120
|
effectiveQuery: z.string().describe('Echoed query string for use in follow-up calls.'),
|
|
111
121
|
totalCount: z.number().describe('Number of articles returned in this response.'),
|
|
@@ -113,7 +123,31 @@ export const gdeltSearchArticles = tool('gdelt_search_articles', {
|
|
|
113
123
|
notice: z
|
|
114
124
|
.string()
|
|
115
125
|
.optional()
|
|
116
|
-
.describe('
|
|
126
|
+
.describe('Disclosure that the maxRecords cap was reached and more articles may exist, naming the route ' +
|
|
127
|
+
'to them — a higher maxRecords below the 250 ceiling, or a narrower date window at it. ' +
|
|
128
|
+
'Absent when the full result set fit under the cap.'),
|
|
129
|
+
continuationWindows: z
|
|
130
|
+
.array(z
|
|
131
|
+
.object({
|
|
132
|
+
startDatetime: z
|
|
133
|
+
.string()
|
|
134
|
+
.describe('Start of this window in GDELT format YYYYMMDDHHMMSS.'),
|
|
135
|
+
endDatetime: z.string().describe('End of this window in GDELT format YYYYMMDDHHMMSS.'),
|
|
136
|
+
})
|
|
137
|
+
.describe('One window to re-query with the same query string.'))
|
|
138
|
+
.optional()
|
|
139
|
+
.describe('The queried window halved, to re-run this query against one pair at a time when maxRecords is at ' +
|
|
140
|
+
'its 250 ceiling. The halves overlap by one second so no article falls through the seam; an article ' +
|
|
141
|
+
'published on that second can come back in both, so de-duplicate by url. Absent unless the ceiling ' +
|
|
142
|
+
'was reached with a window that is both known and wide enough to divide.'),
|
|
143
|
+
},
|
|
144
|
+
enrichmentTrailer: {
|
|
145
|
+
continuationWindows: {
|
|
146
|
+
render: (windows = []) => [
|
|
147
|
+
'**Continuation windows:**',
|
|
148
|
+
...windows.map((w) => `- startDatetime: ${w.startDatetime}, endDatetime: ${w.endDatetime}`),
|
|
149
|
+
].join('\n'),
|
|
150
|
+
},
|
|
117
151
|
},
|
|
118
152
|
async handler(input, ctx) {
|
|
119
153
|
if (isUnpairedDateRange(input.startDatetime, input.endDatetime)) {
|
|
@@ -141,8 +175,17 @@ export const gdeltSearchArticles = tool('gdelt_search_articles', {
|
|
|
141
175
|
if (input.timespan)
|
|
142
176
|
ctx.enrich({ timespan: input.timespan });
|
|
143
177
|
if (result.articles.length >= input.maxRecords) {
|
|
144
|
-
|
|
145
|
-
`
|
|
178
|
+
if (input.maxRecords < MAX_RECORDS_CEILING) {
|
|
179
|
+
ctx.enrich.notice(`Returned ${result.articles.length} articles (maxRecords cap reached — there may be more). ` +
|
|
180
|
+
`Increase maxRecords up to ${MAX_RECORDS_CEILING} to retrieve more.`);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
const continuation = planWindowContinuation(resolveEffectiveWindow(input));
|
|
184
|
+
if (continuation.windows)
|
|
185
|
+
ctx.enrich({ continuationWindows: continuation.windows });
|
|
186
|
+
ctx.enrich.notice(`Returned ${result.articles.length} articles — maxRecords is already at its ${MAX_RECORDS_CEILING} ceiling, ` +
|
|
187
|
+
`so more articles almost certainly matched. ${continuation.guidance}`);
|
|
188
|
+
}
|
|
146
189
|
}
|
|
147
190
|
ctx.log.info('gdelt_search_articles completed', { count: result.articles.length });
|
|
148
191
|
return { articles: result.articles };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-articles.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-articles.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"search-articles.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-articles.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,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AK,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YAChC,KAAK,CAAC,IAAI,CACR,eAAe,CAAC,CAAC,MAAM,mBAAmB,CAAC,CAAC,aAAa,oBAAoB,CAAC,CAAC,QAAQ,EAAE,CAC1F,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtC,IAAI,CAAC,CAAC,WAAW;gBAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/gdelt-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Search and analyze global news coverage and US television transcripts via the GDELT Project's real-time APIs via MCP. STDIO or Streamable HTTP.",
|
|
5
5
|
"mcpName": "io.github.cyanheads/gdelt-mcp-server",
|
|
6
6
|
"type": "module",
|
package/server.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/cyanheads/gdelt-mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.5",
|
|
10
10
|
"remotes": [
|
|
11
11
|
{
|
|
12
12
|
"type": "streamable-http",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
20
20
|
"identifier": "@cyanheads/gdelt-mcp-server",
|
|
21
21
|
"runtimeHint": "node",
|
|
22
|
-
"version": "0.2.
|
|
22
|
+
"version": "0.2.5",
|
|
23
23
|
"packageArguments": [
|
|
24
24
|
{
|
|
25
25
|
"type": "positional",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
49
49
|
"identifier": "@cyanheads/gdelt-mcp-server",
|
|
50
50
|
"runtimeHint": "node",
|
|
51
|
-
"version": "0.2.
|
|
51
|
+
"version": "0.2.5",
|
|
52
52
|
"packageArguments": [
|
|
53
53
|
{
|
|
54
54
|
"type": "positional",
|