show_world_intel
Retrieve global macro data and active disaster alerts for risk assessment. Combines World Bank indicators with GDACS alerts—no API keys needed.
Instructions
Global intelligence drill-down: World Bank macro (GDP growth, inflation, unemployment per country) + GDACS active disasters (Orange/Red alerts). No API keys required. Use after get_brief when you need more detail on global risks — e.g. 'which countries are in recession', 'any active crises affecting my holdings', 'compare inflation across major economies'. Shows all currently active alerts, Orange+ by default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| countries | No | ISO 2-letter country codes for macro data | |
| min_alert_level | No | Minimum disaster alert level | Orange |
Implementation Reference
- apps/mcp/src/tools/macro.ts:77-105 (handler)MCP tool handler for 'show_world_intel'. Registers via server.tool() with Zod schema for countries (default: US,CN,JP,KR,DE,IN,GB) and min_alert_level (default: Orange). Handler calls fetchGlobalMacro() and fetchDisasters() in parallel and returns combined result with generated_at timestamp.
server.tool( 'show_world_intel', "Global intelligence drill-down: World Bank macro (GDP growth, inflation, unemployment per country) + GDACS active disasters (Orange/Red alerts). No API keys required. Use after get_brief when you need more detail on global risks — e.g. 'which countries are in recession', 'any active crises affecting my holdings', 'compare inflation across major economies'. Shows all currently active alerts, Orange+ by default.", { countries: z .array(z.string()) .default(['US', 'CN', 'JP', 'KR', 'DE', 'IN', 'GB']) .describe('ISO 2-letter country codes for macro data'), min_alert_level: z .enum(['Green', 'Orange', 'Red']) .default('Orange') .describe('Minimum disaster alert level'), }, async ({ countries, min_alert_level }) => { try { const [macro, disasters] = await Promise.all([ fetchGlobalMacro(countries), fetchDisasters({ minAlertLevel: min_alert_level as AlertLevel }), ]); return ok({ generated_at: new Date().toISOString(), global_macro: { source: 'World Bank', data: macro }, disasters: { source: 'GDACS', count: disasters.length, events: disasters }, }); } catch (e) { return err(e instanceof Error ? e.message : 'Failed to fetch world intelligence'); } }, ); - apps/mcp/src/index.ts:24-29 (registration)Registration of the macro tools (including show_world_intel) on the MCP server via registerMacroTools(server).
registerMacroTools(server); registerAdminTools(server); registerPrompts(server); const transport = new StdioServerTransport(); await server.connect(transport); - apps/mcp/src/tools/macro.ts:80-89 (schema)Input schema for 'show_world_intel': countries (array of strings, default 7 major economies) and min_alert_level (enum Green/Orange/Red, default Orange).
{ countries: z .array(z.string()) .default(['US', 'CN', 'JP', 'KR', 'DE', 'IN', 'GB']) .describe('ISO 2-letter country codes for macro data'), min_alert_level: z .enum(['Green', 'Orange', 'Red']) .default('Orange') .describe('Minimum disaster alert level'), }, - fetchGlobalMacro helper: fetches GDP growth, inflation, and unemployment from World Bank API for given country codes, returns array of CountryMacro objects.
export const fetchGlobalMacro = async ( countries: string[] = [...DEFAULT_COUNTRIES], ): Promise<CountryMacro[]> => { const [gdpPoints, inflPoints, unempPoints] = await Promise.all([ fetchIndicator(INDICATORS.gdp_growth, countries), fetchIndicator(INDICATORS.inflation, countries), fetchIndicator(INDICATORS.unemployment, countries), ]); const gdp = latestByCountry(gdpPoints); const infl = latestByCountry(inflPoints); const unemp = latestByCountry(unempPoints); const countryNames = new Map<string, string>(); for (const p of [...gdpPoints, ...inflPoints, ...unempPoints]) { countryNames.set(p.countryCode, p.country); } return countries.map((code) => ({ country: countryNames.get(code) ?? code, countryCode: code, gdp_growth: gdp.get(code)?.value ?? null, gdp_growth_year: gdp.get(code)?.year ?? null, inflation: infl.get(code)?.value ?? null, inflation_year: infl.get(code)?.year ?? null, unemployment: unemp.get(code)?.value ?? null, unemployment_year: unemp.get(code)?.year ?? null, })); }; - packages/gdacs/src/index.ts:67-83 (helper)fetchDisasters helper: fetches GDACS RSS feed, parses disaster events, filters by minimum alert level (Green/Orange/Red).
export const fetchDisasters = async ({ minAlertLevel = 'Orange', }: { minAlertLevel?: AlertLevel; } = {}): Promise<DisasterEvent[]> => { const res = await fetch(RSS_URL); if (!res.ok) throw new Error(`GDACS fetch error ${res.status}`); const xml = await res.text(); const minRank = ALERT_RANK[minAlertLevel]; const items = xml.split('<item>').slice(1); return items .map((chunk) => parseItem(chunk.split('</item>')[0])) .filter((e): e is DisasterEvent => e !== null) .filter((e) => ALERT_RANK[e.alertLevel] >= minRank); };