@cyanheads/reliefweb-mcp-server 0.1.1
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 +391 -0
- package/Dockerfile +98 -0
- package/LICENSE +201 -0
- package/README.md +320 -0
- package/changelog/0.1.x/0.1.0.md +24 -0
- package/changelog/0.1.x/0.1.1.md +29 -0
- package/changelog/template.md +119 -0
- package/dist/config/server-config.d.ts +14 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +19 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/crisis-briefing.prompt.d.ts +14 -0
- package/dist/mcp-server/prompts/definitions/crisis-briefing.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/crisis-briefing.prompt.js +62 -0
- package/dist/mcp-server/prompts/definitions/crisis-briefing.prompt.js.map +1 -0
- package/dist/mcp-server/resources/definitions/country.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/country.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/country.resource.js +30 -0
- package/dist/mcp-server/resources/definitions/country.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/disaster.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/disaster.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/disaster.resource.js +30 -0
- package/dist/mcp-server/resources/definitions/disaster.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/report.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/report.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/report.resource.js +30 -0
- package/dist/mcp-server/resources/definitions/report.resource.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-country.tool.d.ts +35 -0
- package/dist/mcp-server/tools/definitions/get-country.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-country.tool.js +106 -0
- package/dist/mcp-server/tools/definitions/get-country.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-disaster.tool.d.ts +42 -0
- package/dist/mcp-server/tools/definitions/get-disaster.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-disaster.tool.js +127 -0
- package/dist/mcp-server/tools/definitions/get-disaster.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-report.tool.d.ts +30 -0
- package/dist/mcp-server/tools/definitions/get-report.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-report.tool.js +92 -0
- package/dist/mcp-server/tools/definitions/get-report.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-countries.tool.d.ts +20 -0
- package/dist/mcp-server/tools/definitions/list-countries.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-countries.tool.js +83 -0
- package/dist/mcp-server/tools/definitions/list-countries.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-sources.tool.d.ts +22 -0
- package/dist/mcp-server/tools/definitions/list-sources.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-sources.tool.js +82 -0
- package/dist/mcp-server/tools/definitions/list-sources.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-disasters.tool.d.ts +35 -0
- package/dist/mcp-server/tools/definitions/search-disasters.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-disasters.tool.js +163 -0
- package/dist/mcp-server/tools/definitions/search-disasters.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-jobs.tool.d.ts +32 -0
- package/dist/mcp-server/tools/definitions/search-jobs.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-jobs.tool.js +148 -0
- package/dist/mcp-server/tools/definitions/search-jobs.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-reports.tool.d.ts +40 -0
- package/dist/mcp-server/tools/definitions/search-reports.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-reports.tool.js +191 -0
- package/dist/mcp-server/tools/definitions/search-reports.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-training.tool.d.ts +35 -0
- package/dist/mcp-server/tools/definitions/search-training.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-training.tool.js +166 -0
- package/dist/mcp-server/tools/definitions/search-training.tool.js.map +1 -0
- package/dist/services/reliefweb/reliefweb-service.d.ts +103 -0
- package/dist/services/reliefweb/reliefweb-service.d.ts.map +1 -0
- package/dist/services/reliefweb/reliefweb-service.js +546 -0
- package/dist/services/reliefweb/reliefweb-service.js.map +1 -0
- package/dist/services/reliefweb/types.d.ts +345 -0
- package/dist/services/reliefweb/types.d.ts.map +1 -0
- package/dist/services/reliefweb/types.js +7 -0
- package/dist/services/reliefweb/types.js.map +1 -0
- package/package.json +78 -0
- package/server.json +111 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
# FORMAT REFERENCE — do not edit. Copy this file to
|
|
3
|
+
# `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
|
|
4
|
+
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
|
+
# with a concrete date.
|
|
6
|
+
|
|
7
|
+
# Required. One-line GitHub Release-style headline. 350 character cap.
|
|
8
|
+
# Default short and scannable. Don't pad, don't stitch unrelated changes with
|
|
9
|
+
# semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
|
|
10
|
+
# inside the value as a key separator and fails GitHub's strict parser.
|
|
11
|
+
summary: ""
|
|
12
|
+
|
|
13
|
+
# Set `true` when consumers must change code to upgrade: API removals,
|
|
14
|
+
# signature changes, config renames, behavior changes that break existing
|
|
15
|
+
# usage. Flagged as `Breaking` in the rollup.
|
|
16
|
+
breaking: false
|
|
17
|
+
|
|
18
|
+
# Set `true` if this release contains any security fix. Pairs with the
|
|
19
|
+
# `## Security` section below. Flagged as `Security` in the rollup so
|
|
20
|
+
# users can triage upgrade urgency at a glance.
|
|
21
|
+
security: false
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# <version> — YYYY-MM-DD
|
|
25
|
+
|
|
26
|
+
<!--
|
|
27
|
+
AUTHORING GUIDE — applies to the new per-version file you create from this
|
|
28
|
+
template.
|
|
29
|
+
|
|
30
|
+
Audience: someone scanning release notes to decide what affects them. Lead
|
|
31
|
+
each bullet with the symbol or concept name in **bold** so they can skip
|
|
32
|
+
what's irrelevant and zoom in on what's not.
|
|
33
|
+
|
|
34
|
+
Tone: terse, fact-dense, not verbose. Default to one sentence per bullet —
|
|
35
|
+
name the symbol, state what changed, stop. Use a second sentence only when
|
|
36
|
+
it carries weight. If a bullet feels long, it is.
|
|
37
|
+
|
|
38
|
+
Cut: mechanism walkthroughs (those belong in JSDoc, AGENTS.md, or the
|
|
39
|
+
relevant skill), ceremonial framings ("This release introduces…",
|
|
40
|
+
backwards-compat paragraphs), file-by-file test enumerations, internal
|
|
41
|
+
implementation notes. Prefer code/symbol names over English re-explanations.
|
|
42
|
+
|
|
43
|
+
Narrative intro: skip by default. Add one short sentence only when the
|
|
44
|
+
release theme genuinely needs framing the bullets can't carry.
|
|
45
|
+
|
|
46
|
+
Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
|
|
47
|
+
Fixed, Security. Include only sections with entries; delete the rest
|
|
48
|
+
(including the commented-out scaffolding below). Don't ship empty headers.
|
|
49
|
+
|
|
50
|
+
Include: every distinct fact a reader needs to adopt or audit the release —
|
|
51
|
+
new exports, signatures, lint rule IDs, env vars, breaking changes, version
|
|
52
|
+
bumps on shipped skills. Nothing more.
|
|
53
|
+
|
|
54
|
+
Links: link issues, PRs, docs, or skills where they help a reader jump to
|
|
55
|
+
context. Once per item per entry — don't re-link the same issue in summary,
|
|
56
|
+
narrative, and bullet. Skip links for inline symbol names; code spans speak
|
|
57
|
+
for themselves.
|
|
58
|
+
|
|
59
|
+
Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
|
|
60
|
+
inside its own UI, not in npm reads or local editors.
|
|
61
|
+
|
|
62
|
+
[#38](https://github.com/cyanheads/mcp-ts-core/issues/38) ← issue
|
|
63
|
+
[#42](https://github.com/cyanheads/mcp-ts-core/pull/42) ← PR
|
|
64
|
+
|
|
65
|
+
Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
|
|
66
|
+
Never speculate on a future number — `#42` for an upcoming PR silently
|
|
67
|
+
resolves to whatever real item already owns 42, and timeline previews pull
|
|
68
|
+
in that unrelated item's metadata.
|
|
69
|
+
|
|
70
|
+
TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
|
|
71
|
+
via `gh release create --notes-from-tag`. The tag is a derivative of this
|
|
72
|
+
changelog entry — a condensed, scannable version, not a copy. Format:
|
|
73
|
+
|
|
74
|
+
<theme — omit version number, GitHub prepends it>
|
|
75
|
+
← blank line
|
|
76
|
+
<1-2 sentence context: what this release does>
|
|
77
|
+
← blank line
|
|
78
|
+
Dependency bumps: ← section header
|
|
79
|
+
← blank line
|
|
80
|
+
- `@cyanheads/mcp-ts-core` ^0.9.1 → ^0.9.6 ← bullet
|
|
81
|
+
← blank line
|
|
82
|
+
Changed: ← only sections with entries
|
|
83
|
+
← blank line
|
|
84
|
+
- `format()` output includes `query` in text mode
|
|
85
|
+
← blank line
|
|
86
|
+
Added:
|
|
87
|
+
← blank line
|
|
88
|
+
- `manifest.json` scaffolded for MCPB bundle support
|
|
89
|
+
- Install badges (Claude Desktop, Cursor, VS Code)
|
|
90
|
+
← blank line
|
|
91
|
+
<N> tests pass; `bun run devcheck` clean. ← footer
|
|
92
|
+
|
|
93
|
+
Never a flat comma-separated string. Always structured markdown with
|
|
94
|
+
sections. The tag must scan well as a rendered GitHub Release page.
|
|
95
|
+
-->
|
|
96
|
+
|
|
97
|
+
## Added
|
|
98
|
+
|
|
99
|
+
-
|
|
100
|
+
|
|
101
|
+
## Changed
|
|
102
|
+
|
|
103
|
+
-
|
|
104
|
+
|
|
105
|
+
<!-- ## Deprecated
|
|
106
|
+
|
|
107
|
+
- -->
|
|
108
|
+
|
|
109
|
+
<!-- ## Removed
|
|
110
|
+
|
|
111
|
+
- -->
|
|
112
|
+
|
|
113
|
+
## Fixed
|
|
114
|
+
|
|
115
|
+
-
|
|
116
|
+
|
|
117
|
+
<!-- ## Security
|
|
118
|
+
|
|
119
|
+
- -->
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration for reliefweb-mcp-server.
|
|
3
|
+
* Reads RELIEFWEB_APP_NAME from the environment and fails fast at startup
|
|
4
|
+
* if it is missing — the ReliefWeb API enforces pre-approved appnames since Nov 2025.
|
|
5
|
+
* @module config/server-config
|
|
6
|
+
*/
|
|
7
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
declare const ServerConfigSchema: z.ZodObject<{
|
|
9
|
+
appName: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
12
|
+
export declare function getServerConfig(): ServerConfig;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB;;iBAEtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,wBAAgB,eAAe,IAAI,YAAY,CAK9C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration for reliefweb-mcp-server.
|
|
3
|
+
* Reads RELIEFWEB_APP_NAME from the environment and fails fast at startup
|
|
4
|
+
* if it is missing — the ReliefWeb API enforces pre-approved appnames since Nov 2025.
|
|
5
|
+
* @module config/server-config
|
|
6
|
+
*/
|
|
7
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
|
+
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
9
|
+
const ServerConfigSchema = z.object({
|
|
10
|
+
appName: z.string().describe('Pre-approved appname for the ReliefWeb API v2.'),
|
|
11
|
+
});
|
|
12
|
+
let _config;
|
|
13
|
+
export function getServerConfig() {
|
|
14
|
+
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
15
|
+
appName: 'RELIEFWEB_APP_NAME',
|
|
16
|
+
});
|
|
17
|
+
return _config;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=server-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;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,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;CAC/E,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,OAAO,EAAE,oBAAoB;KAC9B,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview reliefweb-mcp-server MCP server entry point.
|
|
4
|
+
* @module index
|
|
5
|
+
*/
|
|
6
|
+
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
// Prompts
|
|
8
|
+
import { reliefwebCrisisBriefing } from './mcp-server/prompts/definitions/crisis-briefing.prompt.js';
|
|
9
|
+
// Resources
|
|
10
|
+
import { countryResource } from './mcp-server/resources/definitions/country.resource.js';
|
|
11
|
+
import { disasterResource } from './mcp-server/resources/definitions/disaster.resource.js';
|
|
12
|
+
import { reportResource } from './mcp-server/resources/definitions/report.resource.js';
|
|
13
|
+
// Tools
|
|
14
|
+
import { reliefwebGetCountry } from './mcp-server/tools/definitions/get-country.tool.js';
|
|
15
|
+
import { reliefwebGetDisaster } from './mcp-server/tools/definitions/get-disaster.tool.js';
|
|
16
|
+
import { reliefwebGetReport } from './mcp-server/tools/definitions/get-report.tool.js';
|
|
17
|
+
import { reliefwebListCountries } from './mcp-server/tools/definitions/list-countries.tool.js';
|
|
18
|
+
import { reliefwebListSources } from './mcp-server/tools/definitions/list-sources.tool.js';
|
|
19
|
+
import { reliefwebSearchDisasters } from './mcp-server/tools/definitions/search-disasters.tool.js';
|
|
20
|
+
import { reliefwebSearchJobs } from './mcp-server/tools/definitions/search-jobs.tool.js';
|
|
21
|
+
import { reliefwebSearchReports } from './mcp-server/tools/definitions/search-reports.tool.js';
|
|
22
|
+
import { reliefwebSearchTraining } from './mcp-server/tools/definitions/search-training.tool.js';
|
|
23
|
+
import { initReliefWebService } from './services/reliefweb/reliefweb-service.js';
|
|
24
|
+
await createApp({
|
|
25
|
+
tools: [
|
|
26
|
+
reliefwebSearchReports,
|
|
27
|
+
reliefwebGetReport,
|
|
28
|
+
reliefwebSearchDisasters,
|
|
29
|
+
reliefwebGetDisaster,
|
|
30
|
+
reliefwebGetCountry,
|
|
31
|
+
reliefwebListCountries,
|
|
32
|
+
reliefwebSearchJobs,
|
|
33
|
+
reliefwebSearchTraining,
|
|
34
|
+
reliefwebListSources,
|
|
35
|
+
],
|
|
36
|
+
resources: [reportResource, disasterResource, countryResource],
|
|
37
|
+
prompts: [reliefwebCrisisBriefing],
|
|
38
|
+
setup(core) {
|
|
39
|
+
initReliefWebService(core.config, core.storage);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,UAAU;AACV,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,YAAY;AACZ,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAC;AACvF,QAAQ;AACR,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,wDAAwD,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,SAAS,CAAC;IACd,KAAK,EAAE;QACL,sBAAsB;QACtB,kBAAkB;QAClB,wBAAwB;QACxB,oBAAoB;QACpB,mBAAmB;QACnB,sBAAsB;QACtB,mBAAmB;QACnB,uBAAuB;QACvB,oBAAoB;KACrB;IACD,SAAS,EAAE,CAAC,cAAc,EAAE,gBAAgB,EAAE,eAAe,CAAC;IAC9D,OAAO,EAAE,CAAC,uBAAuB,CAAC;IAClC,KAAK,CAAC,IAAI;QACR,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Structured briefing template for a country or disaster situation on ReliefWeb.
|
|
3
|
+
* @module mcp-server/prompts/definitions/crisis-briefing
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const reliefwebCrisisBriefing: import("@cyanheads/mcp-ts-core").PromptDefinition<z.ZodObject<{
|
|
7
|
+
country_or_disaster: z.ZodString;
|
|
8
|
+
focus: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
situation: "situation";
|
|
10
|
+
jobs: "jobs";
|
|
11
|
+
full: "full";
|
|
12
|
+
}>>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
//# sourceMappingURL=crisis-briefing.prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crisis-briefing.prompt.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/crisis-briefing.prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,eAAO,MAAM,uBAAuB;;;;;;;kBAgElC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Structured briefing template for a country or disaster situation on ReliefWeb.
|
|
3
|
+
* @module mcp-server/prompts/definitions/crisis-briefing
|
|
4
|
+
*/
|
|
5
|
+
import { prompt, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export const reliefwebCrisisBriefing = prompt('reliefweb_crisis_briefing', {
|
|
7
|
+
description: 'Generate a structured humanitarian briefing for a country or disaster. ' +
|
|
8
|
+
'Instructs the agent to use available ReliefWeb tools to gather recent reports, active disasters, open positions, and training opportunities, ' +
|
|
9
|
+
'then synthesize a concise situation overview. ' +
|
|
10
|
+
'Specify focus=situation for a situation-only brief, focus=jobs for open positions, or focus=full for the complete briefing.',
|
|
11
|
+
args: z.object({
|
|
12
|
+
country_or_disaster: z
|
|
13
|
+
.string()
|
|
14
|
+
.describe('Country name or ISO3 code (e.g., "Afghanistan" or "AFG"), or a disaster name/GLIDE number (e.g., "Syria earthquake" or "EQ-2023-000053-TUR").'),
|
|
15
|
+
focus: z
|
|
16
|
+
.enum(['situation', 'jobs', 'full'])
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Briefing scope. situation = situation overview and recent reports only. jobs = open positions and training only. full = complete briefing including situation, reports, disasters, jobs, and training (default).'),
|
|
19
|
+
}),
|
|
20
|
+
generate: (args) => {
|
|
21
|
+
const focus = args.focus ?? 'full';
|
|
22
|
+
const target = args.country_or_disaster;
|
|
23
|
+
const situationSection = `## Situation Overview
|
|
24
|
+
- Use reliefweb_get_country (if this is a country) or reliefweb_get_disaster (if this is a disaster) to fetch the current overview and key content links.
|
|
25
|
+
- Search for the 5 most recent Situation Reports using reliefweb_search_reports with text="${target}" and format="Situation Report".
|
|
26
|
+
- Search for active disasters with reliefweb_search_disasters filtered by country or text.
|
|
27
|
+
- Summarize the current humanitarian situation in 3–5 sentences, citing report titles and dates.
|
|
28
|
+
- List active disasters with status, GLIDE number, and primary type.
|
|
29
|
+
- List key appeals and response plans from the country/disaster profile.`;
|
|
30
|
+
const jobsSection = `## Open Positions
|
|
31
|
+
- Search for open humanitarian jobs with reliefweb_search_jobs filtered by country="${target}".
|
|
32
|
+
- Group by organization and career category.
|
|
33
|
+
- List title, organization, closing date, and URL for each position.
|
|
34
|
+
- Note total count and any recurring roles (e.g., multiple UNHCR positions).`;
|
|
35
|
+
const trainingSection = `## Training Opportunities
|
|
36
|
+
- Search for upcoming training with reliefweb_search_training filtered by country or text.
|
|
37
|
+
- List title, organizer, start date, format, and URL for each opportunity.`;
|
|
38
|
+
let sections;
|
|
39
|
+
if (focus === 'situation') {
|
|
40
|
+
sections = situationSection;
|
|
41
|
+
}
|
|
42
|
+
else if (focus === 'jobs') {
|
|
43
|
+
sections = `${jobsSection}\n\n${trainingSection}`;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
sections = `${situationSection}\n\n${jobsSection}\n\n${trainingSection}`;
|
|
47
|
+
}
|
|
48
|
+
const message = `You are preparing a humanitarian briefing for: **${target}**
|
|
49
|
+
|
|
50
|
+
Use the available ReliefWeb tools to gather current data, then produce a structured briefing with the sections below. Cite specific report titles, IDs, and dates. Do not invent data — only include what the tools return.
|
|
51
|
+
|
|
52
|
+
${sections}
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
- If the country/disaster is not found, say so and suggest checking the spelling or using reliefweb_list_countries.
|
|
56
|
+
- Use ISO3 codes (AFG, SYR, UKR) when filtering by country.
|
|
57
|
+
- Limit API calls: use field-specific searches rather than broad full-text queries to stay within the 1,000-call/day quota.
|
|
58
|
+
- All dates in ISO 8601 format.`;
|
|
59
|
+
return [{ role: 'user', content: { type: 'text', text: message } }];
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=crisis-briefing.prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crisis-briefing.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/crisis-briefing.prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MA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C;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ReliefWeb country resource — country profile by ISO3 code.
|
|
3
|
+
* @module mcp-server/resources/definitions/country
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const countryResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
7
|
+
iso3: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, undefined, undefined>;
|
|
9
|
+
//# sourceMappingURL=country.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/country.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,eAAe;;wCA4B1B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ReliefWeb country resource — country profile by ISO3 code.
|
|
3
|
+
* @module mcp-server/resources/definitions/country
|
|
4
|
+
*/
|
|
5
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getReliefWebService } from '../../../services/reliefweb/reliefweb-service.js';
|
|
8
|
+
export const countryResource = resource('reliefweb://countries/{iso3}', {
|
|
9
|
+
name: 'reliefweb-country',
|
|
10
|
+
title: 'ReliefWeb Country Profile',
|
|
11
|
+
description: 'Country profile by ISO3 code — overview, humanitarian situation summary, key content links, and active response plans. ' +
|
|
12
|
+
'Equivalent to calling reliefweb_get_country.',
|
|
13
|
+
mimeType: 'application/json',
|
|
14
|
+
params: z.object({
|
|
15
|
+
iso3: z.string().describe('ISO 3166-1 alpha-3 country code (e.g., SYR, AFG, UKR).'),
|
|
16
|
+
}),
|
|
17
|
+
async handler(params, ctx) {
|
|
18
|
+
const iso3 = params.iso3.trim().toUpperCase();
|
|
19
|
+
if (iso3.length !== 3 || !/^[A-Z]{3}$/.test(iso3)) {
|
|
20
|
+
throw notFound(`Invalid ISO3 code "${params.iso3}". Must be a 3-letter ISO 3166-1 alpha-3 code.`);
|
|
21
|
+
}
|
|
22
|
+
ctx.log.debug('reliefweb://countries/{iso3}', { iso3 });
|
|
23
|
+
const country = await getReliefWebService().getCountry(iso3, ctx);
|
|
24
|
+
if (!country) {
|
|
25
|
+
throw notFound(`No country profile found for ISO3 code "${iso3}". Use reliefweb_list_countries to browse valid codes.`, { iso3 });
|
|
26
|
+
}
|
|
27
|
+
return country;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=country.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/country.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC,8BAA8B,EAAE;IACtE,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,2BAA2B;IAClC,WAAW,EACT,yHAAyH;QACzH,8CAA8C;IAChD,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;KACpF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAClD,MAAM,QAAQ,CACZ,sBAAsB,MAAM,CAAC,IAAI,gDAAgD,CAClF,CAAC;QACJ,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,8BAA8B,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,MAAM,mBAAmB,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,QAAQ,CACZ,2CAA2C,IAAI,wDAAwD,EACvG,EAAE,IAAI,EAAE,CACT,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ReliefWeb disaster resource — disaster record by numeric ID.
|
|
3
|
+
* @module mcp-server/resources/definitions/disaster
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const disasterResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, undefined, undefined>;
|
|
9
|
+
//# sourceMappingURL=disaster.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disaster.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/disaster.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,gBAAgB;;wCA0B3B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ReliefWeb disaster resource — disaster record by numeric ID.
|
|
3
|
+
* @module mcp-server/resources/definitions/disaster
|
|
4
|
+
*/
|
|
5
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getReliefWebService } from '../../../services/reliefweb/reliefweb-service.js';
|
|
8
|
+
export const disasterResource = resource('reliefweb://disasters/{id}', {
|
|
9
|
+
name: 'reliefweb-disaster',
|
|
10
|
+
title: 'ReliefWeb Disaster',
|
|
11
|
+
description: 'Disaster record by ReliefWeb numeric ID — type, status, affected countries, GLIDE number, description, and curated content links. ' +
|
|
12
|
+
'Equivalent to calling reliefweb_get_disaster.',
|
|
13
|
+
mimeType: 'application/json',
|
|
14
|
+
params: z.object({
|
|
15
|
+
id: z.string().describe('ReliefWeb numeric disaster ID.'),
|
|
16
|
+
}),
|
|
17
|
+
async handler(params, ctx) {
|
|
18
|
+
const id = parseInt(params.id, 10);
|
|
19
|
+
if (Number.isNaN(id) || id <= 0) {
|
|
20
|
+
throw notFound(`Invalid disaster ID "${params.id}". Must be a positive integer.`);
|
|
21
|
+
}
|
|
22
|
+
ctx.log.debug('reliefweb://disasters/{id}', { id });
|
|
23
|
+
const disaster = await getReliefWebService().getDisaster(id, ctx);
|
|
24
|
+
if (!disaster) {
|
|
25
|
+
throw notFound(`No disaster found with ID ${id}. Verify the ID from reliefweb_search_disasters.`, { id });
|
|
26
|
+
}
|
|
27
|
+
return disaster;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=disaster.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disaster.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/disaster.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,4BAA4B,EAAE;IACrE,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,oIAAoI;QACpI,+CAA+C;IACjD,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;KAC1D,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;YAChC,MAAM,QAAQ,CAAC,wBAAwB,MAAM,CAAC,EAAE,gCAAgC,CAAC,CAAC;QACpF,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,MAAM,mBAAmB,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,QAAQ,CACZ,6BAA6B,EAAE,kDAAkD,EACjF,EAAE,EAAE,EAAE,CACP,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ReliefWeb report resource — full report record by numeric ID.
|
|
3
|
+
* @module mcp-server/resources/definitions/report
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const reportResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, undefined, undefined>;
|
|
9
|
+
//# sourceMappingURL=report.resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/report.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,cAAc;;wCA0BzB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ReliefWeb report resource — full report record by numeric ID.
|
|
3
|
+
* @module mcp-server/resources/definitions/report
|
|
4
|
+
*/
|
|
5
|
+
import { resource, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { notFound } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getReliefWebService } from '../../../services/reliefweb/reliefweb-service.js';
|
|
8
|
+
export const reportResource = resource('reliefweb://reports/{id}', {
|
|
9
|
+
name: 'reliefweb-report',
|
|
10
|
+
title: 'ReliefWeb Report',
|
|
11
|
+
description: 'Full report record by ReliefWeb numeric ID — metadata, body text, and file URLs. ' +
|
|
12
|
+
'Equivalent to calling reliefweb_get_report.',
|
|
13
|
+
mimeType: 'application/json',
|
|
14
|
+
params: z.object({
|
|
15
|
+
id: z.string().describe('ReliefWeb numeric report ID.'),
|
|
16
|
+
}),
|
|
17
|
+
async handler(params, ctx) {
|
|
18
|
+
const id = parseInt(params.id, 10);
|
|
19
|
+
if (Number.isNaN(id) || id <= 0) {
|
|
20
|
+
throw notFound(`Invalid report ID "${params.id}". Must be a positive integer.`);
|
|
21
|
+
}
|
|
22
|
+
ctx.log.debug('reliefweb://reports/{id}', { id });
|
|
23
|
+
const report = await getReliefWebService().getReport(id, ctx);
|
|
24
|
+
if (!report) {
|
|
25
|
+
throw notFound(`No report found with ID ${id}. Verify the ID from reliefweb_search_reports.`, { id });
|
|
26
|
+
}
|
|
27
|
+
return report;
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=report.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/report.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,0BAA0B,EAAE;IACjE,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,mFAAmF;QACnF,6CAA6C;IAC/C,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;KACxD,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;YAChC,MAAM,QAAQ,CAAC,sBAAsB,MAAM,CAAC,EAAE,gCAAgC,CAAC,CAAC;QAClF,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,mBAAmB,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,QAAQ,CACZ,2BAA2B,EAAE,gDAAgD,EAC7E,EAAE,EAAE,EAAE,CACP,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Fetch a ReliefWeb country profile by ISO3 code.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-country
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const reliefwebGetCountry: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
iso3: z.ZodString;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
id: z.ZodNumber;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
iso3: z.ZodOptional<z.ZodString>;
|
|
13
|
+
status: z.ZodOptional<z.ZodString>;
|
|
14
|
+
urlAlias: z.ZodOptional<z.ZodString>;
|
|
15
|
+
profileOverview: z.ZodOptional<z.ZodString>;
|
|
16
|
+
keyContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
+
title: z.ZodString;
|
|
18
|
+
url: z.ZodString;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
appealsResponsePlans: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
title: z.ZodString;
|
|
22
|
+
url: z.ZodString;
|
|
23
|
+
date: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>>>;
|
|
25
|
+
usefulLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
26
|
+
title: z.ZodString;
|
|
27
|
+
url: z.ZodString;
|
|
28
|
+
}, z.core.$strip>>>;
|
|
29
|
+
}, z.core.$strip>, readonly [{
|
|
30
|
+
readonly reason: "not_found";
|
|
31
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
32
|
+
readonly when: "No country profile found for the given ISO3 code.";
|
|
33
|
+
readonly recovery: "Verify the ISO3 code is a valid ISO 3166-1 alpha-3 code (e.g., SYR, AFG, UKR). Use reliefweb_list_countries to browse available country codes.";
|
|
34
|
+
}]>;
|
|
35
|
+
//# sourceMappingURL=get-country.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-country.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-country.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2G9B,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Fetch a ReliefWeb country profile by ISO3 code.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-country
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getReliefWebService } from '../../../services/reliefweb/reliefweb-service.js';
|
|
8
|
+
export const reliefwebGetCountry = tool('reliefweb_get_country', {
|
|
9
|
+
title: 'Get ReliefWeb Country Profile',
|
|
10
|
+
description: 'Fetch a country profile from ReliefWeb by ISO3 code, including overview, humanitarian situation summary, ' +
|
|
11
|
+
'key content links, active appeals and response plans, and useful external links. ' +
|
|
12
|
+
'Country profiles are curated by OCHA editors and provide the authoritative situation summary for humanitarian responders.',
|
|
13
|
+
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
|
|
14
|
+
input: z.object({
|
|
15
|
+
iso3: z
|
|
16
|
+
.string()
|
|
17
|
+
.length(3)
|
|
18
|
+
.describe("ISO 3166-1 alpha-3 country code (e.g., SYR, AFG, UKR). Used to look up the country's ReliefWeb profile."),
|
|
19
|
+
}),
|
|
20
|
+
output: z.object({
|
|
21
|
+
id: z.number().describe('ReliefWeb numeric country ID.'),
|
|
22
|
+
name: z.string().describe('Country name.'),
|
|
23
|
+
iso3: z.string().optional().describe('ISO 3166-1 alpha-3 code.'),
|
|
24
|
+
status: z.string().optional().describe('Humanitarian situation status.'),
|
|
25
|
+
urlAlias: z.string().optional().describe('Canonical ReliefWeb URL for this country page.'),
|
|
26
|
+
profileOverview: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Situation overview text from the ReliefWeb editorial team.'),
|
|
30
|
+
keyContent: z
|
|
31
|
+
.array(z
|
|
32
|
+
.object({
|
|
33
|
+
title: z.string().describe('Link title.'),
|
|
34
|
+
url: z.string().describe('Link URL.'),
|
|
35
|
+
})
|
|
36
|
+
.describe('A curated key content link.'))
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Curated key content links maintained by ReliefWeb editors.'),
|
|
39
|
+
appealsResponsePlans: z
|
|
40
|
+
.array(z
|
|
41
|
+
.object({
|
|
42
|
+
title: z.string().describe('Appeal or response plan title.'),
|
|
43
|
+
url: z.string().describe('Link URL.'),
|
|
44
|
+
date: z.string().optional().describe('Publication date.'),
|
|
45
|
+
})
|
|
46
|
+
.describe('An appeal or response plan entry.'))
|
|
47
|
+
.optional()
|
|
48
|
+
.describe('Active humanitarian appeals and response plans for this country.'),
|
|
49
|
+
usefulLinks: z
|
|
50
|
+
.array(z
|
|
51
|
+
.object({
|
|
52
|
+
title: z.string().describe('Link title.'),
|
|
53
|
+
url: z.string().describe('Link URL.'),
|
|
54
|
+
})
|
|
55
|
+
.describe('A useful external link.'))
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('Useful external links curated by ReliefWeb editors.'),
|
|
58
|
+
}),
|
|
59
|
+
errors: [
|
|
60
|
+
{
|
|
61
|
+
reason: 'not_found',
|
|
62
|
+
code: JsonRpcErrorCode.NotFound,
|
|
63
|
+
when: 'No country profile found for the given ISO3 code.',
|
|
64
|
+
recovery: 'Verify the ISO3 code is a valid ISO 3166-1 alpha-3 code (e.g., SYR, AFG, UKR). Use reliefweb_list_countries to browse available country codes.',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
async handler(input, ctx) {
|
|
68
|
+
const iso3 = input.iso3.trim().toUpperCase();
|
|
69
|
+
ctx.log.info('reliefweb_get_country', { iso3 });
|
|
70
|
+
const country = await getReliefWebService().getCountry(iso3, ctx);
|
|
71
|
+
if (!country) {
|
|
72
|
+
throw ctx.fail('not_found', `No country profile found for ISO3 code "${iso3}". Verify the code is valid or use reliefweb_list_countries.`, { ...ctx.recoveryFor('not_found') });
|
|
73
|
+
}
|
|
74
|
+
return country;
|
|
75
|
+
},
|
|
76
|
+
format: (result) => {
|
|
77
|
+
const lines = [`# ${result.name}`];
|
|
78
|
+
lines.push(`**ID:** ${result.id}`);
|
|
79
|
+
if (result.iso3)
|
|
80
|
+
lines.push(`**ISO3:** ${result.iso3}`);
|
|
81
|
+
if (result.status)
|
|
82
|
+
lines.push(`**Status:** ${result.status}`);
|
|
83
|
+
if (result.urlAlias)
|
|
84
|
+
lines.push(`**URL:** ${result.urlAlias}`);
|
|
85
|
+
if (result.profileOverview)
|
|
86
|
+
lines.push(`\n## Overview\n\n${result.profileOverview}`);
|
|
87
|
+
if (result.keyContent?.length) {
|
|
88
|
+
lines.push('\n## Key Content');
|
|
89
|
+
for (const kc of result.keyContent)
|
|
90
|
+
lines.push(`- [${kc.title}](${kc.url})`);
|
|
91
|
+
}
|
|
92
|
+
if (result.appealsResponsePlans?.length) {
|
|
93
|
+
lines.push('\n## Appeals & Response Plans');
|
|
94
|
+
for (const ap of result.appealsResponsePlans) {
|
|
95
|
+
lines.push(`- [${ap.title}](${ap.url})${ap.date ? ` (${ap.date})` : ''}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (result.usefulLinks?.length) {
|
|
99
|
+
lines.push('\n## Useful Links');
|
|
100
|
+
for (const ul of result.usefulLinks)
|
|
101
|
+
lines.push(`- [${ul.title}](${ul.url})`);
|
|
102
|
+
}
|
|
103
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=get-country.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-country.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-country.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,uBAAuB,EAAE;IAC/D,KAAK,EAAE,+BAA+B;IACtC,WAAW,EACT,2GAA2G;QAC3G,mFAAmF;QACnF,2HAA2H;IAC7H,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAC9E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,MAAM,CAAC,CAAC,CAAC;aACT,QAAQ,CACP,yGAAyG,CAC1G;KACJ,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QACxD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC1C,IAAI,EAAE,CAAC,CA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