160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.
Python ai-toolsai-watchanthropicclaudecybersecuritydashboardgeofencinggeopoliticalgeospatialintelligencemarketsmcpmigrationmilitarymodel-context-protocolnuclearosintreal-timespace-weatherthreat-intelligence
Phase 26: split the server monolith into domain tool modules with an import-time parity guarantee
Phoenix Agent (Marcs-Mac-Studio)7da5e47056f2
diff --git a/src/world_intel_mcp/runtime.py b/src/world_intel_mcp/runtime.pynew file mode 100644index 0000000..2999c97--- /dev/null+++ b/src/world_intel_mcp/runtime.py@@ -0,0 +1,46 @@+"""Shared process-wide infrastructure for the MCP server.++Extracted from server.py in the Phase 26 modularization so that the+domain tool modules under ``tools/`` and the server shell can share one+cache, one circuit breaker, one AOI store, and one fetcher without a+circular import. Import-time side effects are deliberate and unchanged+from the original server.py module body: constructing this module opens+the cache database (honoring ``WORLD_INTEL_CACHE_DB``) exactly the way+the server always has, which is what the registry tests' temp-cache+override relies on.+"""++import logging++from .analysis import aoi+from .cache import Cache+from .circuit_breaker import CircuitBreaker+from .fetcher import Fetcher++logger = logging.getLogger("world-intel-mcp")++cache = Cache()+breaker = CircuitBreaker(failure_threshold=3, cooldown_seconds=300)+# Same physical SQLite file the Cache above resolved to (fallback path+# included); see analysis/aoi.py's module docstring for why AOIs live in+# a dedicated table there rather than as Cache entries.+_aoi_store = aoi.AOIStore(cache.db_path)+aoi_store = _aoi_store++# Vector store — optional, degrades gracefully if Qdrant unavailable.+_vector_store = None+try:+ from .vector_store import VectorStore, vector_dependencies_available++ if vector_dependencies_available():+ _vector_store = VectorStore(enabled=True)+ else:+ logger.info(+ "Vector store unavailable (qdrant_client / fastembed not installed)"+ )+except Exception as exc:+ logger.info("Vector store unavailable: %s", exc)++vector_store = _vector_store++fetcher = Fetcher(cache=cache, breaker=breaker, vector_store=_vector_store)diff --git a/src/world_intel_mcp/server.py b/src/world_intel_mcp/server.pyindex 0332f0e..e620d38 100644--- a/src/world_intel_mcp/server.py+++ b/src/world_intel_mcp/server.py@@ -57,6 +57,11 @@ Phase 23: Geofence hardening + change detection (+2 = 122 tools). AOI bounding bintel_aoi_changes diffs each sweep against a stored per-AOI snapshot toreport what entered and left the fence, with an explicit baseline first runand failed domains excluded from the diff rather than read as departures.+Phase 26: the 2,900-line registry/dispatch monolith split into domain modules+ under tools/ (12 modules, aggregated with an import-time+ TOOLS/HANDLERS parity guarantee) and shared infrastructure in+ runtime.py. Pure move: 128 tools, byte-identical definitions,+ identical dispatch semantics."""import asyncio@@ -69,49 +74,6 @@ from mcp.server import Serverfrom mcp.server.stdio import stdio_serverfrom mcp.types import Tool, TextContent-from .analysis import aoi-from .cache import Cache-from .circuit_breaker import CircuitBreaker-from .fetcher import Fetcher-from .sources import (- markets,- economic,- seismology,- wildfire,- conflict,- military,- infrastructure,- maritime,- climate,- news,- intelligence,- prediction,- displacement,- aviation,- cyber,- space_weather,- ai_watch,- health,- sanctions,- elections,- shipping,- social,- nuclear,- service_status,- geospatial,- hacker_news,- github_trending,- arxiv_papers,- usa_spending,- environmental,- usni_fleet,- central_banks,- weather,- launches,- volcano,- cyclones,-)-logging.basicConfig(level=os.environ.get("WORLD_INTEL_LOG_LEVEL", "INFO"),format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",@@ -119,1900 +81,27 @@ logging.basicConfig(logger = logging.getLogger("world-intel-mcp")server = Server("world-intel-mcp")-cache = Cache()-breaker = CircuitBreaker(failure_threshold=3, cooldown_seconds=300)-# Same physical SQLite file the Cache above resolved to (fallback path-# included); see analysis/aoi.py's module docstring for why AOIs live in-# a dedicated table there rather than as Cache entries.-_aoi_store = aoi.AOIStore(cache.db_path)--# Vector store — optional, degrades gracefully if Qdrant unavailable.-_vector_store = None-try:- from .vector_store import VectorStore, vector_dependencies_available- if vector_dependencies_available():- _vector_store = VectorStore(enabled=True)- else:- logger.info(- "Vector store unavailable (qdrant_client / fastembed not installed)"- )-except Exception as exc:- logger.info("Vector store unavailable: %s", exc)+# Shared infrastructure lives in runtime.py (Phase 26 split); the local+# aliases remain as the module's public face — external readers (and the+# registry tests) reach the live cache and vector store as server.cache,+# server._vector_store, etc.+from . import runtime as _runtime # noqa: E402+from . import tools as _tools_pkg # noqa: E402-fetcher = Fetcher(cache=cache, breaker=breaker, vector_store=_vector_store)+cache = _runtime.cache+breaker = _runtime.breaker+_aoi_store = _runtime.aoi_store+_vector_store = _runtime.vector_store+fetcher = _runtime.fetcher# ----------------------------------------------------------------------------# Tool definitions+# Tool registry — aggregated from the domain modules under tools/+# (Phase 26 split; per-module TOOLS/HANDLERS parity is enforced at+# import time by tools.aggregate).# ----------------------------------------------------------------------------TOOLS: list[Tool] = [- # --- Markets (7 tools) ---- Tool(- name="intel_market_quotes",- description="Get real-time stock market index quotes (S&P 500, Dow, Nasdaq, FTSE, Nikkei, etc.). Optional: symbols (list of ticker symbols).",- inputSchema={- "type": "object",- "properties": {- "symbols": {- "type": "array",- "items": {"type": "string"},- "description": "Ticker symbols (default: major indices)",- },- },- },- ),- Tool(- name="intel_crypto_quotes",- description="Get top cryptocurrency prices, market caps, and 7-day sparklines from CoinGecko. Optional: limit (int, default 20).",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Number of coins (default 20)",- "default": 20,- },- },- },- ),- Tool(- name="intel_stablecoin_status",- description="Check stablecoin peg health (USDT, USDC, DAI, FDUSD). Flags depegs >0.5%.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_etf_flows",- description="Get Bitcoin spot ETF prices and volumes (IBIT, FBTC, GBTC, ARKB, BITB).",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_sector_heatmap",- description="Get US equity sector performance heatmap (11 SPDR sector ETFs).",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_macro_signals",- description="Get 7 key macro signals: Fear & Greed, mempool fees, DXY, VIX, gold, 10Y Treasury, BTC dominance.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_commodity_quotes",- description="Get commodity futures quotes: gold, silver, crude oil (WTI & Brent), natural gas, corn, wheat, soybeans from Yahoo Finance.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Economic (6 tools) ---- Tool(- name="intel_gas_prices",- description="Get today's US retail gasoline and diesel prices ($/gallon) from AAA — daily national averages for regular, mid-grade, premium, diesel, E85. Includes day-over-day, week, month, year deltas plus per-state prices. No API key required.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_residential_natgas",- description="Get US residential natural gas prices ($/thousand cubic feet) — monthly average. Requires EIA_API_KEY.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_electricity_rates",- description="Get US electricity retail rates (cents/kWh) by sector (residential, commercial, industrial). Optionally filter by state. Requires EIA_API_KEY.",- inputSchema={- "type": "object",- "properties": {- "state": {- "type": "string",- "description": "2-letter US state code (e.g., 'CA', 'TX'). Defaults to nationwide.",- },- },- },- ),- Tool(- name="intel_energy_prices",- description="Get crude oil (Brent, WTI) and natural gas futures prices from EIA. Requires EIA_API_KEY.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_fred_series",- description="Get Federal Reserve economic data series (GDP, UNRATE, CPIAUCSL, DFF, T10YIE, etc.). Requires FRED_API_KEY.",- inputSchema={- "type": "object",- "properties": {- "series_id": {- "type": "string",- "description": "FRED series ID (e.g., 'UNRATE')",- },- "limit": {- "type": "integer",- "description": "Number of observations",- "default": 30,- },- },- "required": ["series_id"],- },- ),- Tool(- name="intel_world_bank_indicators",- description="Get World Bank development indicators (GDP, inflation, unemployment) for a country.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "ISO country code (default: USA)",- "default": "USA",- },- "indicators": {- "type": "array",- "items": {"type": "string"},- "description": "World Bank indicator codes",- },- },- },- ),- # --- Natural (2 tools) ---- Tool(- name="intel_earthquakes",- description="Get recent earthquakes from USGS. No API key needed.",- inputSchema={- "type": "object",- "properties": {- "min_magnitude": {- "type": "number",- "description": "Minimum magnitude (default 4.5)",- "default": 4.5,- },- "hours": {- "type": "integer",- "description": "Lookback hours (default 24)",- "default": 24,- },- "limit": {- "type": "integer",- "description": "Max results (default 50)",- "default": 50,- },- },- },- ),- Tool(- name="intel_wildfires",- description="Get active wildfires from NASA FIRMS (9 global regions). Requires NASA_FIRMS_API_KEY.",- inputSchema={- "type": "object",- "properties": {- "region": {- "type": "string",- "description": "Specific region (north_america, europe, etc.) or omit for all 9",- "enum": [- "north_america",- "south_america",- "europe",- "africa",- "middle_east",- "south_asia",- "east_asia",- "southeast_asia",- "oceania",- ],- },- },- },- ),- # --- Conflict (3 tools) ---- Tool(- name="intel_acled_events",- description="Get armed conflict events from ACLED. Optional: country (name), days (default 7), limit (default 100). Requires ACLED_ACCESS_TOKEN.",- inputSchema={- "type": "object",- "properties": {- "country": {"type": "string", "description": "Country name filter"},- "days": {- "type": "integer",- "description": "Lookback days (default 7)",- "default": 7,- },- "limit": {- "type": "integer",- "description": "Max results (default 100)",- "default": 100,- },- },- },- ),- Tool(- name="intel_ucdp_events",- description="Get state-based violence events from UCDP GED. No API key needed. Optional: days (default 30).",- inputSchema={- "type": "object",- "properties": {- "days": {- "type": "integer",- "description": "Lookback days (default 30)",- "default": 30,- },- "limit": {- "type": "integer",- "description": "Max results (default 100)",- "default": 100,- },- },- },- ),- Tool(- name="intel_humanitarian_summary",- description="Get humanitarian crisis datasets from HDX. No API key needed. Optional: country code.",- inputSchema={- "type": "object",- "properties": {- "country": {"type": "string", "description": "ISO country code filter"},- },- },- ),- # --- Military (3 tools) ---- Tool(- name="intel_military_flights",- description="Track military aircraft via OpenSky Network (ICAO hex + callsign filtering). Optional: bbox (lamin,lomin,lamax,lomax).",- inputSchema={- "type": "object",- "properties": {- "bbox": {- "type": "string",- "description": "Bounding box: lamin,lomin,lamax,lomax",- },- },- },- ),- Tool(- name="intel_theater_posture",- description="Get military aircraft presence across 5 theaters: European, Indo-Pacific, Middle East, Arctic, Korean Peninsula.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_aircraft_details",- description="Get aircraft details from hexdb.io by ICAO24 hex code (free, no API key).",- inputSchema={- "type": "object",- "properties": {- "icao24": {"type": "string", "description": "ICAO24 hex code"},- },- "required": ["icao24"],- },- ),- # --- Infrastructure (2 tools) ---- Tool(- name="intel_internet_outages",- description="Get internet outages from Cloudflare Radar (last 7 days). Optional: CLOUDFLARE_API_TOKEN for higher limits.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_cable_health",- description="Assess undersea cable corridor health from NGA navigational warnings. 6 corridors scored 0-3.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Maritime (1 tool) ---- Tool(- name="intel_nav_warnings",- description="Get active navigational warnings from NGA Maritime Safety. Optional: navarea (I-XVI).",- inputSchema={- "type": "object",- "properties": {- "navarea": {- "type": "string",- "description": "NAVAREA number (e.g., IV, XII)",- },- },- },- ),- # --- Climate (1 tool) ---- Tool(- name="intel_climate_anomalies",- description="Detect temperature and precipitation anomalies across 15 global climate zones (vs. prior year baseline).",- inputSchema={- "type": "object",- "properties": {- "zones": {- "type": "array",- "items": {"type": "string"},- "description": "Zone keys to check (default: all 15)",- },- },- },- ),- # --- Prediction (1 tool) ---- Tool(- name="intel_prediction_markets",- description="Get active prediction markets from Polymarket (questions, YES probabilities, volumes, sentiment).",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Number of markets (default 20)",- "default": 20,- },- },- },- ),- # --- Displacement (1 tool) ---- Tool(- name="intel_displacement_summary",- description="Get UNHCR refugee/displacement statistics by country of origin. No API key needed.",- inputSchema={- "type": "object",- "properties": {- "year": {- "type": "integer",- "description": "Reporting year (default: last year)",- },- },- },- ),- # --- Aviation (1 tool) ---- Tool(- name="intel_airport_delays",- description="Get current US airport delays from FAA (20 major airports). No API key needed.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Cyber (1 tool) ---- Tool(- name="intel_cyber_threats",- description="Get aggregated cyber threat intelligence from 4 feeds (Feodo, CISA KEV, SANS, URLhaus). No API key needed.",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Max threats (default 50)",- "default": 50,- },- },- },- ),- # --- News (3 tools) ---- Tool(- name="intel_news_feed",- description="Get aggregated intelligence news from 119 RSS feeds across 24 categories. Covers geopolitics, security, tech, finance, military, science, think tanks, regional, energy, space, nuclear, climate, maritime, arctic, and more.",- inputSchema={- "type": "object",- "properties": {- "category": {- "type": "string",- "description": "Category filter (24 categories available)",- "enum": [- "geopolitics",- "security",- "technology",- "finance",- "military",- "science",- "think_tanks",- "middle_east",- "asia_pacific",- "africa",- "latin_america",- "multilingual",- "energy",- "government",- "crisis",- "europe",- "south_asia",- "health",- "central_asia",- "arctic",- "maritime",- "space",- "nuclear",- "climate",- ],- },- "limit": {- "type": "integer",- "description": "Max items (default 50)",- "default": 50,- },- },- },- ),- Tool(- name="intel_trending_keywords",- description="Detect trending keywords from recent news headlines. Keyword spike detection across 20+ feeds.",- inputSchema={- "type": "object",- "properties": {- "min_count": {- "type": "integer",- "description": "Minimum occurrences (default 3)",- "default": 3,- },- },- },- ),- Tool(- name="intel_gdelt_search",- description="Search GDELT 2.0 for global news articles or volume timelines. No API key needed.",- inputSchema={- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "Search query (default: 'conflict')",- "default": "conflict",- },- "mode": {- "type": "string",- "description": "artlist (articles) or timelinevol (volume timeline)",- "enum": ["artlist", "timelinevol"],- "default": "artlist",- },- "limit": {- "type": "integer",- "description": "Max records (default 50)",- "default": 50,- },- },- },- ),- # --- Intelligence (13 tools) ---- Tool(- name="intel_country_brief",- description="Generate a country intelligence brief using Ollama LLM + World Bank + ACLED data. Falls back to data-only if LLM unavailable.",- inputSchema={- "type": "object",- "properties": {- "country_code": {- "type": "string",- "description": "ISO country code (default: US)",- "default": "US",- },- },- },- ),- Tool(- name="intel_country_dossier",- description="Comprehensive country intelligence dossier: economy (GDP/inflation), stock market, elections, sanctions, news mentions, hotspots, and conflict zones. Aggregates 6 sources in parallel.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "ISO-2 or ISO-3 country code (e.g. US, USA, UA, UKR)",- "default": "US",- },- },- },- ),- Tool(- name="intel_risk_scores",- description="Get country risk scores computed from ACLED conflict data vs historical baselines. Requires ACLED_ACCESS_TOKEN.",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Top N countries (default 20)",- "default": 20,- },- },- },- ),- Tool(- name="intel_instability_index",- description="Compute Country Instability Index v2 (0-100) from 4 weighted domains: unrest, conflict, security, information. Applies country-specific multipliers and UCDP floors.",- inputSchema={- "type": "object",- "properties": {- "country_code": {- "type": "string",- "description": "ISO alpha-3 code (e.g., UKR). Omit for top-10 focus countries.",- },- },- },- ),- Tool(- name="intel_signal_convergence",- description="Detect geographic convergence of multi-domain signals (earthquakes, conflict, military) in hotspot regions.",- inputSchema={- "type": "object",- "properties": {- "lat": {- "type": "number",- "description": "Center latitude (omit for 5 global hotspots)",- },- "lon": {"type": "number", "description": "Center longitude"},- "radius_deg": {- "type": "number",- "description": "Radius in degrees (default 5.0)",- "default": 5.0,- },- },- },- ),- Tool(- name="intel_focal_points",- description="Detect focal points where multiple intelligence signals converge on the same entity (country, organization, leader). Cross-references news, military, protests, and infrastructure signals.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_signal_summary",- description="Aggregate all intelligence signals by country with convergence scoring. Combines conflict, displacement, earthquakes, fires, outages, military, and protests.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "Country name filter (optional)",- },- },- },- ),- Tool(- name="intel_temporal_anomalies",- description="Detect temporal anomalies — activity levels that deviate from historical baselines using Welford's algorithm. Reports z-score deviations like 'Military flights 3.2x normal for Thursday'.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_unrest_events",- description="Get social unrest events (protests + riots) from ACLED with Haversine deduplication. Optional: country (name), days (default 7), limit (default 100).",- inputSchema={- "type": "object",- "properties": {- "country": {"type": "string", "description": "Country name filter"},- "days": {- "type": "integer",- "description": "Lookback days (default 7)",- "default": 7,- },- "limit": {- "type": "integer",- "description": "Max results (default 100)",- "default": 100,- },- },- },- ),- Tool(- name="intel_hotspot_escalation",- description="Dynamic escalation scores for 22 intel hotspots from baseline risk, military activity, and conflict signals (ACLED events near each hotspot). Each hotspot scored 0-100, renormalized over the signals actually measured. News-mention and geo-convergence components are not currently wired up and are reported as null (see unavailable_components), not a fabricated zero.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_military_surge",- description="Detect military surge anomalies — foreign aircraft concentration above baselines in 8 sensitive regions (Persian Gulf, Taiwan Strait, Baltic Sea, etc.).",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_vessel_snapshot",- description="Naval activity snapshot at 9 strategic waterways (Hormuz, Malacca, Suez, etc.) from NGA navigational warnings. Each waterway scored clear/advisory/elevated/critical.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_cascade_analysis",- description="Simulate infrastructure cascade — 'what if cable corridor X is disrupted?' Impact scoring across dependent countries. Optional: corridor name (default: simulate at-risk corridors).",- inputSchema={- "type": "object",- "properties": {- "corridor": {- "type": "string",- "description": "Cable corridor to simulate (e.g., red_sea, transpacific, asia_europe)",- "enum": [- "transatlantic_north",- "transatlantic_south",- "asia_europe",- "red_sea",- "transpacific",- "mediterranean",- ],- },- },- },- ),- # --- Space Weather (1 tool) ---- Tool(- name="intel_space_weather",- description="Get solar activity: Kp geomagnetic index, X-ray flare class, solar wind, and SWPC alerts from NOAA.",- inputSchema={"type": "object", "properties": {}},- ),- # --- AI Watch (1 tool) ---- Tool(- name="intel_ai_releases",- description="Track AI/AGI developments from arXiv, HuggingFace, and AI news feeds. Lab mention trending.",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Max items (default 50)",- "default": 50,- },- },- },- ),- # --- Health (1 tool) ---- Tool(- name="intel_disease_outbreaks",- description="Aggregate disease outbreak alerts from WHO DON, ProMED, and CIDRAP. Flags high-concern pathogens (Ebola, H5N1, mpox, etc.).",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Max items (default 50)",- "default": 50,- },- },- },- ),- # --- Sanctions (1 tool) ---- Tool(- name="intel_sanctions_search",- description="Search the US Treasury OFAC Specially Designated Nationals (SDN) sanctions list. Substring match on name, country, program.",- inputSchema={- "type": "object",- "properties": {- "query": {"type": "string", "description": "Name substring to search"},- "country": {"type": "string", "description": "Country filter"},- "program": {- "type": "string",- "description": "Sanctions program filter",- },- "limit": {- "type": "integer",- "description": "Max results (default 50)",- "default": 50,- },- },- },- ),- # --- Elections (1 tool) ---- Tool(- name="intel_election_calendar",- description="Get upcoming global election calendar with proximity-based instability risk scoring. Covers 2025-2029.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "ISO-3 code or country name filter",- },- },- },- ),- # --- Shipping (1 tool) ---- Tool(- name="intel_shipping_index",- description="Compute shipping stress index from dry bulk ETFs (BDRY, SBLK, EGLE, ZIM). Stress score 0-100.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Social (1 tool) ---- Tool(- name="intel_social_signals",- description="Monitor geopolitical discussion velocity on Reddit (r/worldnews, r/geopolitics). Engagement metrics and trending posts.",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Max posts per subreddit (default 25)",- "default": 25,- },- },- },- ),- # --- Nuclear (1 tool) ---- Tool(- name="intel_nuclear_monitor",- description="Monitor seismic activity near 5 known nuclear test sites (Punggye-ri, Lop Nur, Novaya Zemlya, Nevada NTS, Semipalatinsk). Concern scoring based on depth, magnitude, distance.",- inputSchema={- "type": "object",- "properties": {- "hours": {- "type": "integer",- "description": "Lookback hours (default 72)",- "default": 72,- },- },- },- ),- # --- Alert Digest (1 tool) ---- Tool(- name="intel_alert_digest",- description="Cross-domain alert aggregation from 7 intelligence sources: space weather, instability, military surge, cable health, hotspot escalation, internet outages, shipping stress. Threshold-based prioritized alerts.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Weekly Trends (1 tool) ---- Tool(- name="intel_weekly_trends",- description="Analyze weekly trends from temporal baselines. Reports volatility (coefficient of variation) and current anomalies across all tracked metrics.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Service Status (1 tool) ---- Tool(- name="intel_service_status",- description="Monitor cloud service provider status (AWS, Azure, GCP, Cloudflare, GitHub). Shows active incidents and recent outages. Optional: provider (aws/azure/gcp/cloudflare/github).",- inputSchema={- "type": "object",- "properties": {- "provider": {- "type": "string",- "description": "Filter by provider (aws, azure, gcp, cloudflare, github)",- },- },- },- ),- # --- Geospatial Datasets (4 tools) ---- Tool(- name="intel_military_bases",- description="Query 120+ military bases worldwide from 9 operators (USA, Russia, China, UK, France, NATO, India, Turkey, Israel, Iran, UAE). Filterable by operator, host country, base type, branch.",- inputSchema={- "type": "object",- "properties": {- "operator": {- "type": "string",- "description": "Filter by operating country (USA, RUS, CHN, GBR, FRA, NATO, IND, TUR, ISR, IRN, ARE)",- },- "country": {- "type": "string",- "description": "Filter by host country name or ISO-3 code",- },- "base_type": {- "type": "string",- "description": "Filter by type: air_base, naval_base, army_base, marine_base, training, space_base, missile_defense, expeditionary",- },- "branch": {- "type": "string",- "description": "Filter by branch (USAF, US Navy, PLA Navy, RAF, etc.)",- },- },- },- ),- Tool(- name="intel_strategic_ports",- description="Query 40+ strategic ports worldwide: container mega-ports, oil/LNG terminals, naval bases, bulk ports. Filterable by type and country.",- inputSchema={- "type": "object",- "properties": {- "port_type": {- "type": "string",- "description": "Filter by type: container, oil, lng, naval, bulk, mixed",- },- "country": {- "type": "string",- "description": "Filter by country name or ISO-3 code",- },- },- },- ),- Tool(- name="intel_pipelines",- description="Query 25+ strategic oil, gas, and hydrogen pipelines with routes, capacity, and status. Includes Nord Stream, Druzhba, Power of Siberia, BTC, TAPS, etc.",- inputSchema={- "type": "object",- "properties": {- "pipeline_type": {- "type": "string",- "description": "Filter by type: oil, gas, hydrogen",- },- "status": {- "type": "string",- "description": "Filter by status: active, destroyed, proposed, stalled, reduced, cancelled, construction, intermittent, terminated",- },- },- },- ),- Tool(- name="intel_nuclear_facilities",- description="Query 25+ nuclear power plants, enrichment sites, research reactors, and reprocessing facilities worldwide. Includes Zaporizhzhia, Natanz, Fordow, Yongbyon, etc.",- inputSchema={- "type": "object",- "properties": {- "facility_type": {- "type": "string",- "description": "Filter by type: power, enrichment, research, reprocessing, decommissioned",- },- "country": {- "type": "string",- "description": "Filter by country name or ISO-3 code",- },- "status": {- "type": "string",- "description": "Filter by status: operational, construction, shutdown, occupied, commissioning, decommissioning, exclusion_zone",- },- },- },- ),- # --- NLP Intelligence (4 tools) ---- Tool(- name="intel_extract_entities",- description="Extract named entities (countries, leaders, organizations, companies, CVEs, APT groups) from text or recent news headlines.",- inputSchema={- "type": "object",- "properties": {- "text": {- "type": "string",- "description": "Text to analyze. If omitted, analyzes recent news headlines.",- },- },- },- ),- Tool(- name="intel_classify_event",- description="Classify text into threat categories (military, terrorism, cyber, political, economic, health, climate, nuclear, etc.) with severity scoring (1-10).",- inputSchema={- "type": "object",- "properties": {- "text": {- "type": "string",- "description": "Event text or headline to classify.",- },- },- "required": ["text"],- },- ),- Tool(- name="intel_news_clusters",- description="Cluster recent news articles by topic similarity using Jaccard coefficient. Groups related stories and extracts top keywords per cluster.",- inputSchema={- "type": "object",- "properties": {- "category": {- "type": "string",- "description": "RSS feed category filter (geopolitics, security, military, etc.)",- },- "limit": {- "type": "integer",- "description": "Max news items to cluster (default: 100)",- },- "threshold": {- "type": "number",- "description": "Similarity threshold 0.0-1.0 (default: 0.25)",- },- },- },- ),- Tool(- name="intel_keyword_spikes",- description="Detect trending keyword spikes against historical baselines using Welford's algorithm. Extracts CVE identifiers and APT group mentions.",- inputSchema={- "type": "object",- "properties": {- "min_count": {- "type": "integer",- "description": "Minimum keyword frequency to consider (default: 3)",- },- "z_threshold": {- "type": "number",- "description": "Z-score threshold for spike detection (default: 2.0)",- },- },- },- ),- # --- Strategic Synthesis (4 tools) ---- Tool(- name="intel_strategic_posture",- description="Composite global risk assessment from 9 intelligence domains: military, political, conflict, infrastructure, economic, cyber, health, climate, space. Weighted composite score 0-100 with per-domain breakdown and top threats.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_world_brief",- description="Structured daily intelligence summary: risk overview, focal areas, top story clusters, temporal anomalies, and trending threats. Comprehensive situational awareness in one call.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_fleet_report",- description="Naval fleet activity report aggregating theater posture (5 theaters), vessel snapshot (9 waterways), military surge detections, and naval base count. Readiness scoring.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_population_exposure",- description="Estimate population at risk near active events (earthquakes, wildfires, conflict). Finds major cities within radius and sums exposed population.",- inputSchema={- "type": "object",- "properties": {- "radius_km": {- "type": "number",- "description": "Search radius in km (default: 200)",- "default": 200,- },- "event_types": {- "type": "array",- "items": {- "type": "string",- "enum": ["earthquake", "wildfire", "conflict"],- },- "description": "Event types to include (default: all three)",- },- },- },- ),- # --- Extended Geospatial (5 tools) ---- Tool(- name="intel_undersea_cables",- description="Query 30+ undersea fiber-optic cable routes with landing points, owners, capacity (Tbps), and length (km). Filterable by status, country, owner, min capacity.",- inputSchema={- "type": "object",- "properties": {- "status": {- "type": "string",- "description": "Filter by status: active, planned, construction, decommissioned",- },- "country": {- "type": "string",- "description": "Filter by country in landing points",- },- "owner": {- "type": "string",- "description": "Filter by cable owner (Google, Meta, Microsoft, etc.)",- },- "min_capacity_tbps": {- "type": "number",- "description": "Minimum cable capacity in Tbps",- },- },- },- ),- Tool(- name="intel_ai_datacenters",- description="Query 48+ AI datacenter clusters worldwide with power capacity (MW), operators, and locations. Covers hyperscalers and sovereign AI.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "Filter by country name or ISO-3 code",- },- "operator": {- "type": "string",- "description": "Filter by operator (AWS, Google, Microsoft, Meta, etc.)",- },- "min_power_mw": {- "type": "integer",- "description": "Minimum power capacity in MW",- },- "region": {- "type": "string",- "description": "Filter by region (North America, Europe, Asia-Pacific, etc.)",- },- },- },- ),- Tool(- name="intel_spaceports",- description="Query 27+ launch facilities and spaceports worldwide. Filterable by country, status, type (orbital/suborbital), and operator.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "Filter by country name or ISO-3 code",- },- "status": {- "type": "string",- "description": "Filter by status: active, limited, planned, decommissioned",- },- "spaceport_type": {- "type": "string",- "description": "Filter by type: orbital, suborbital",- },- "operator": {- "type": "string",- "description": "Filter by operator (SpaceX, NASA, CNSA, Roscosmos, etc.)",- },- },- },- ),- Tool(- name="intel_critical_minerals",- description="Query 28+ critical mineral deposits worldwide: lithium, cobalt, rare earths, nickel, copper, graphite, manganese, PGM, tungsten, uranium, tin, gallium, germanium.",- inputSchema={- "type": "object",- "properties": {- "mineral": {- "type": "string",- "description": "Filter by mineral (lithium, cobalt, rare_earths, nickel, copper, graphite, manganese, platinum_group, tungsten, uranium, tin, gallium, germanium)",- },- "country": {- "type": "string",- "description": "Filter by country name or ISO-3 code",- },- "mineral_type": {- "type": "string",- "description": "Filter by type: battery, electronic, structural, energy, industrial, strategic",- },- "operator": {"type": "string", "description": "Filter by operator"},- },- },- ),- Tool(- name="intel_stock_exchanges",- description="Query 80+ stock exchanges across 4 tiers (mega >$3T, major, emerging, frontier) with market cap, index tickers, currencies, timezones.",- inputSchema={- "type": "object",- "properties": {- "tier": {- "type": "string",- "description": "Filter by tier: mega, major, emerging, frontier",- },- "country": {- "type": "string",- "description": "Filter by country name or ISO-3 code",- },- "currency": {- "type": "string",- "description": "Filter by currency (USD, EUR, GBP, JPY, CNY, etc.)",- },- },- },- ),- # --- Markets Extended (1 tool) ---- Tool(- name="intel_country_stocks",- description="Get real-time stock index quote for any country by ISO-3 code. Maps country to its primary exchange index ticker and fetches via Yahoo Finance.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "ISO-3 country code (USA, GBR, JPN, CHN, DEU, etc.)",- "default": "USA",- },- },- },- ),- # --- Military Extended (1 tool) ---- Tool(- name="intel_aircraft_batch",- description="Batch lookup of aircraft details by ICAO24 hex codes (max 20). Returns registration, type, operator from hexdb.io.",- inputSchema={- "type": "object",- "properties": {- "icao24_list": {- "type": "array",- "items": {"type": "string"},- "description": "List of ICAO24 hex addresses (max 20)",- },- },- "required": ["icao24_list"],- },- ),- # --- Tech & Science (3 tools) ---- Tool(- name="intel_hacker_news",- description="Get top stories from Hacker News (Firebase API). Returns title, score, URL, author, comment count. Optional: limit (default 30).",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Number of stories (default 30, max 100)",- "default": 30,- },- },- },- ),- Tool(- name="intel_trending_repos",- description="Get trending GitHub repositories (recently created, most starred). Optional: language filter, time window, limit.",- inputSchema={- "type": "object",- "properties": {- "language": {- "type": "string",- "description": "Programming language filter (python, rust, typescript, etc.)",- },- "since_days": {- "type": "integer",- "description": "Look back N days for new repos (default 7)",- "default": 7,- },- "limit": {- "type": "integer",- "description": "Number of repos (default 25)",- "default": 25,- },- },- },- ),- Tool(- name="intel_arxiv_papers",- description="Search recent arXiv papers in AI/ML (cs.AI, cs.LG, cs.CL). Optional custom query. Returns title, authors, abstract, categories, PDF link.",- inputSchema={- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "arXiv search query (default: cs.AI OR cs.LG OR cs.CL)",- },- "limit": {- "type": "integer",- "description": "Number of papers (default 25)",- "default": 25,- },- },- },- ),- # --- Government (1 tool) ---- Tool(- name="intel_usa_spending",- description="Federal agency spending data from USAspending.gov. Shows top agencies by budget for current fiscal year. Optional: agency filter.",- inputSchema={- "type": "object",- "properties": {- "agency": {- "type": "string",- "description": "Filter by agency name substring",- },- "limit": {- "type": "integer",- "description": "Number of agencies (default 25)",- "default": 25,- },- },- },- ),- # --- USNI Fleet (1 tool) ---- Tool(- name="intel_usni_fleet",- description="US Navy fleet disposition from USNI News Fleet Tracker. Extracts ships, hull numbers, carrier strike groups, regional deployment, and force totals from the latest weekly report.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Environmental (2 tools) ---- Tool(- name="intel_environmental_events",- description="Natural events from NASA EONET: wildfires, severe storms, volcanoes, floods, icebergs, drought. Includes geolocation and source links.",- inputSchema={- "type": "object",- "properties": {- "days": {- "type": "integer",- "description": "Look back N days (default 30)",- "default": 30,- },- "category": {- "type": "string",- "description": "Filter by category: wildfires, severeStorms, volcanoes, floods, earthquakes, drought, seaLakeIce",- },- "limit": {- "type": "integer",- "description": "Max events (default 50)",- "default": 50,- },- },- },- ),- Tool(- name="intel_disaster_alerts",- description="Global disaster alerts from GDACS (UN): earthquakes, floods, cyclones, droughts, wildfires. Severity levels (green/orange/red) with affected populations.",- inputSchema={- "type": "object",- "properties": {- "alert_level": {- "type": "string",- "description": "Filter by level: green, orange, red",- },- "event_type": {- "type": "string",- "description": "Filter by type: EQ, FL, TC, DR, WF, VO",- },- "limit": {- "type": "integer",- "description": "Max alerts (default 30)",- "default": 30,- },- },- },- ),- # --- BTC Technicals (1 tool) ---- Tool(- name="intel_btc_technicals",- description="Bitcoin technical indicators: SMA-50, SMA-200, Mayer Multiple, golden/death cross, distance from ATH, 7d/30d changes.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Central Banks (1 tool) ---- Tool(- name="intel_central_bank_rates",- description="Policy rates for 15 major central banks: Fed, ECB, BoE, BoJ, PBoC, RBI, RBA, BoC, SNB, BCB, BoK, CBRT, SARB, Banxico, BI. Live FRED data when API key set, curated fallback otherwise.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Trade Routes (1 tool) ---- Tool(- name="intel_trade_routes",- description="19 critical maritime chokepoints and trade routes with oil flow (mbd), daily vessel transits, trade value share. Optional: route_type (chokepoint/canal/route), country (ISO-3).",- inputSchema={- "type": "object",- "properties": {- "route_type": {- "type": "string",- "description": "Filter: chokepoint, canal, route",- },- "country": {- "type": "string",- "description": "Filter by ISO-3 country code",- },- },- },- ),- # --- Cloud Regions (1 tool) ---- Tool(- name="intel_cloud_regions",- description="28 major cloud provider regions (AWS, Azure, GCP) with coordinates, zone counts, and launch dates. Optional: provider, country.",- inputSchema={- "type": "object",- "properties": {- "provider": {- "type": "string",- "description": "Filter: AWS, Azure, GCP",- },- "country": {- "type": "string",- "description": "Filter by region name substring",- },- },- },- ),- # --- Financial Centers (1 tool) ---- Tool(- name="intel_financial_centers",- description="GFCI top 20 global financial centers with rankings, ratings, specializations, and exchange info. Optional: country (ISO-3), min_rank.",- inputSchema={- "type": "object",- "properties": {- "country": {- "type": "string",- "description": "Filter by ISO-3 country code",- },- "min_rank": {- "type": "integer",- "description": "Only include centers ranked this or better",- },- },- },- ),- # --- Traffic (2 tools) ---- Tool(- name="intel_traffic_flow",- description="Real-time traffic congestion for 20 major world cities via TomTom API. Congestion percentage, speeds, global average. Requires TOMTOM_API_KEY.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_traffic_incidents",- description="Major traffic incidents across 5 strategic regions (US East/West, Europe, Middle East, East Asia) via TomTom API. Requires TOMTOM_API_KEY.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Aviation domestic (1 tool) ---- Tool(- name="intel_aviation_domestic",- description="Global air traffic snapshot from OpenSky Network: total airborne aircraft, regional breakdown, busiest origin countries, and sampled positions for mapping.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Webcams (1 tool) ---- Tool(- name="intel_webcams",- description="Public webcam locations and live previews worldwide from Windy Webcams API. Filter by category (traffic, weather, landscape). Requires WINDY_API_KEY.",- inputSchema={- "type": "object",- "properties": {- "category": {- "type": "string",- "description": "Webcam category (traffic, weather, landscape, etc.)",- "default": "traffic",- },- "limit": {- "type": "integer",- "description": "Max cameras to return (default 50)",- "default": 50,- },- },- },- ),- # --- Forex (3 tools) ---- Tool(- name="intel_forex_rates",- description="Get latest foreign exchange rates from ECB via Frankfurter API. Optional: base currency (default USD), target symbols list.",- inputSchema={- "type": "object",- "properties": {- "base": {- "type": "string",- "description": "Base currency code (default: USD)",- "default": "USD",- },- "symbols": {- "type": "array",- "items": {"type": "string"},- "description": "Target currency codes (e.g., ['EUR', 'GBP', 'JPY'])",- },- },- },- ),- Tool(- name="intel_forex_timeseries",- description="Get historical FX rate timeseries with trend analysis. Optional: base, symbol, days.",- inputSchema={- "type": "object",- "properties": {- "base": {- "type": "string",- "description": "Base currency (default: USD)",- "default": "USD",- },- "symbol": {- "type": "string",- "description": "Target currency (default: EUR)",- "default": "EUR",- },- "days": {- "type": "integer",- "description": "Number of days of history (default: 30)",- "default": 30,- },- },- },- ),- Tool(- name="intel_major_crosses",- description="Get all 8 major FX currency pairs (EUR/USD, USD/JPY, GBP/USD, etc.) with cross rates and DXY proxy.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Bonds & Yields (2 tools) ---- Tool(- name="intel_yield_curve",- description="Get US Treasury yield curve (2Y-30Y maturities), 2s10s and 3m10y spreads, and inversion detection. Uses FRED or Yahoo Finance fallback.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_bond_indices",- description="Get major bond ETF prices and performance: AGG (total bond), TLT (20Y+ Treasury), HYG (high yield), LQD (investment grade), TIP (TIPS).",- inputSchema={"type": "object", "properties": {}},- ),- # --- Earnings (2 tools) ---- Tool(- name="intel_earnings_calendar",- description="Get upcoming earnings announcements for top 20 mega-cap stocks (AAPL, MSFT, GOOGL, etc.) with EPS estimates and days until report.",- inputSchema={- "type": "object",- "properties": {- "days_ahead": {- "type": "integer",- "description": "Days to look ahead for 'this_week' filter (default: 7)",- "default": 7,- },- },- },- ),- Tool(- name="intel_earnings_surprise",- description="Get recent earnings surprises for a specific stock — past quarter actual vs estimate, surprise %, and forward estimates.",- inputSchema={- "type": "object",- "properties": {- "symbol": {- "type": "string",- "description": "Stock ticker symbol (e.g., 'AAPL')",- },- },- "required": ["symbol"],- },- ),- # --- SEC Filings (3 tools) ---- Tool(- name="intel_sec_filings",- description="Search SEC EDGAR filings via full-text search. Filter by form type (10-K, 10-Q, 8-K) and date range.",- inputSchema={- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "Search query (company name, keyword, etc.)",- },- "form_type": {- "type": "string",- "description": "Comma-separated form types (e.g., '10-K,10-Q,8-K')",- },- "date_range": {- "type": "string",- "description": "Date range as 'YYYY-MM-DD,YYYY-MM-DD' (default: last 30 days)",- },- "limit": {- "type": "integer",- "description": "Max results (default: 25, max: 100)",- "default": 25,- },- },- },- ),- Tool(- name="intel_company_filings",- description="Get recent SEC filings for a company by ticker symbol (10-K, 10-Q, 8-K). Resolves ticker to CIK automatically.",- inputSchema={- "type": "object",- "properties": {- "ticker": {- "type": "string",- "description": "Stock ticker symbol (e.g., 'AAPL')",- },- "form_types": {- "type": "array",- "items": {"type": "string"},- "description": "Form types to include (default: ['10-K', '10-Q', '8-K'])",- },- "limit": {- "type": "integer",- "description": "Max filings (default: 10)",- "default": 10,- },- },- "required": ["ticker"],- },- ),- Tool(- name="intel_recent_8k",- description="Get most recent 8-K filings (material corporate events: M&A, executive changes, earnings releases) across all companies.",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Max filings (default: 25, max: 100)",- "default": 25,- },- },- },- ),- # --- Company Enrichment (1 tool) ---- Tool(- name="intel_company_profile",- description="Get comprehensive company profile: stock quote, financials, sector/industry, recent news, SEC filings, and GitHub repos (for tech companies). Accepts ticker or company name.",- inputSchema={- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "Ticker symbol (e.g., 'AAPL') or company name",- },- },- "required": ["query"],- },- ),- # --- Macro Composite (1 tool) ---- Tool(- name="intel_macro_composite",- description="Get weighted macro market composite score (0-100) synthesizing Fear & Greed, VIX, sector breadth, DXY, BTC technicals, and 10Y yield into an actionable verdict (RISK_ON / CONSTRUCTIVE / NEUTRAL / CAUTIOUS / STRONG_CAUTION).",- inputSchema={"type": "object", "properties": {}},- ),- # --- Vector Search (3 tools) ---- Tool(- name="intel_semantic_search",- description="Semantic search across all stored intelligence data using natural language. Searches historical data accumulated from all 101+ tools. Filters: domain (e.g., 'markets', 'conflict'), category (e.g., 'Financial Markets', 'Cyber Threats'), hours (last N hours). Returns ranked results by relevance.",- inputSchema={- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "Natural language search query (e.g., 'military activity near Taiwan', 'oil price disruptions')",- },- "limit": {- "type": "integer",- "description": "Max results (default 20)",- "default": 20,- },- "domain": {- "type": "string",- "description": "Filter by source domain (e.g., 'markets', 'conflict', 'military')",- },- "category": {- "type": "string",- "description": "Filter by category (e.g., 'Financial Markets', 'Conflict & Security', 'Cyber Threats')",- },- "hours": {- "type": "number",- "description": "Only results from last N hours",- },- },- "required": ["query"],- },- ),- Tool(- name="intel_similar_events",- description="Find historically similar intelligence events or data. Given a text description, finds the most similar stored entries across all domains. Useful for pattern matching and precedent analysis.",- inputSchema={- "type": "object",- "properties": {- "text": {- "type": "string",- "description": "Reference text to find similar events for",- },- "domain": {- "type": "string",- "description": "Source domain of the reference text",- },- "limit": {- "type": "integer",- "description": "Max results (default 10)",- "default": 10,- },- "hours": {- "type": "number",- "description": "Only results from last N hours",- },- },- "required": ["text"],- },- ),- Tool(- name="intel_timeline",- description="Get chronological timeline of stored intelligence data. Returns recent entries sorted by time. Filter by domain or category to focus on specific intelligence areas.",- inputSchema={- "type": "object",- "properties": {- "domain": {- "type": "string",- "description": "Filter by source domain",- },- "category": {- "type": "string",- "description": "Filter by category",- },- "hours": {- "type": "number",- "description": "Time window in hours (default 24)",- "default": 24,- },- "limit": {- "type": "integer",- "description": "Max entries (default 50)",- "default": 50,- },- },- },- ),- Tool(- name="intel_vector_stats",- description="Get vector store statistics: total points, collection status, embedding model info. Shows how much intelligence data has been accumulated.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_collect",- description="Trigger an immediate collection cycle to populate the vector store. Fetches all intelligence sources and stores them. Optional: sources (comma-separated domain groups like 'markets,conflict,cyber').",- inputSchema={- "type": "object",- "properties": {- "sources": {- "type": "string",- "description": "Comma-separated domain groups (e.g., 'markets,conflict,cyber'). Default: all sources.",- },- },- },- ),- Tool(- name="intel_cross_correlate",- description="Cross-domain intelligence correlation. Given a topic, finds related signals across ALL intelligence domains (military, financial, cyber, conflict, etc.) and groups them by category. Shows how events ripple across domains — e.g., how a military buildup correlates with market movements and news coverage.",- inputSchema={- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "Topic to correlate across domains (e.g., 'Taiwan strait tensions', 'oil supply disruption')",- },- "hours": {- "type": "number",- "description": "Time window in hours (default 24)",- "default": 24,- },- "limit_per_domain": {- "type": "integer",- "description": "Max signals per domain category (default 5)",- "default": 5,- },- },- "required": ["query"],- },- ),- Tool(- name="intel_domain_summary",- description="Summary of all intelligence data stored in the vector database. Shows per-category data point counts, unique sources, latest/earliest timestamps, and total events tracked. Answers: what intelligence do we have and how recent is it?",- inputSchema={- "type": "object",- "properties": {- "hours": {- "type": "number",- "description": "Time window in hours (default 24)",- "default": 24,- },- },- },- ),- Tool(- name="intel_trend_detection",- description="Detect activity trends by comparing recent intelligence activity against a baseline. Identifies SURGE (>50% increase), ELEVATED (>20%), DECLINING (<-20%), and DROP (<-50%) patterns. Useful for early warning when a domain suddenly spikes or goes quiet.",- inputSchema={- "type": "object",- "properties": {- "category": {- "type": "string",- "description": "Focus on one category (e.g., 'Conflict & Security'). Default: all categories.",- },- "recent_hours": {- "type": "number",- "description": "Recent window to measure (default 6 hours)",- "default": 6,- },- "baseline_hours": {- "type": "number",- "description": "Baseline window for comparison (default 48 hours)",- "default": 48,- },- },- },- ),- # --- Daily Digest (1 tool) ---- Tool(- name="intel_daily_digest",- description="Cited markdown morning brief: top current events by domain (earthquakes, military, conflict, wildfires, cyber, health, air/traffic), recent headlines, and, when the optional vector store is installed, recent activity trends and a 24h timeline. Every listed item carries a [n] citation into a numbered sources list. Degrades honestly via data_gaps when the vector store or a domain fetch is unavailable, instead of showing an empty section as a quiet day.",- inputSchema={"type": "object", "properties": {}},- ),- # --- AOI Geofences (5 tools) ---- Tool(- name="intel_aoi_define",- description="Define a named area of interest (AOI/geofence): a point plus a radius in kilometers, persisted for intel_aoi_brief, intel_aoi_escalation, intel_aoi_list, and intel_aoi_delete. Required: name, lat (-90..90), lon (-180..180), radius_km (1..2000). Rejects a duplicate name (case-insensitive) politely, echoing the existing definition instead of overwriting it.",- inputSchema={- "type": "object",- "properties": {- "name": {- "type": "string",- "description": "Unique AOI name (case-insensitive)",- },- "lat": {- "type": "number",- "description": "Center latitude, -90..90",- },- "lon": {- "type": "number",- "description": "Center longitude, -180..180",- },- "radius_km": {- "type": "number",- "description": "Radius in kilometers, 1..2000",- },- },- "required": ["name", "lat", "lon", "radius_km"],- },- ),- Tool(- name="intel_aoi_list",- description="List all user-defined areas of interest (AOIs/geofences).",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_aoi_delete",- description="Delete a user-defined area of interest by name.",- inputSchema={- "type": "object",- "properties": {- "name": {"type": "string", "description": "AOI name to delete"},- },- "required": ["name"],- },- ),- Tool(- name="intel_aoi_brief",- description="Cited brief for a user-defined AOI: earthquakes, military flights (bbox-derived), wildfires (region-mapped), ACLED conflict events, sampled aviation traffic, nearby static infrastructure (bases, ports, pipelines, nuclear, cables, datacenters, spaceports) with distances in km, and news headline mentions of the AOI name. Every item carries a [n] citation into a numbered sources list; data_gaps names every domain that could not be scoped to the AOI rather than omitting it silently. Required: name (must already be defined via intel_aoi_define).",- inputSchema={- "type": "object",- "properties": {- "name": {"type": "string", "description": "AOI name"},- },- "required": ["name"],- },- ),- Tool(- name="intel_aoi_escalation",- description="Run the hotspot escalation scoring (baseline, military, conflict, social-unrest components; 0-100) on a user-defined AOI instead of only the 22 built-in intel hotspots. News-mention and geo-convergence components are not wired up and report null, same as intel_hotspot_escalation. Required: name (must already be defined via intel_aoi_define).",- inputSchema={- "type": "object",- "properties": {- "name": {"type": "string", "description": "AOI name"},- },- "required": ["name"],- },- ),- Tool(- name="intel_aoi_update",- description="Update a user-defined AOI in place: rename it and/or change its center or radius, without losing its identity. Required: name. Optional: new_name, lat, lon, radius_km (same validation as intel_aoi_define; at least one must be provided). A rename keeps the AOI's change-detection history; changing center or radius drops it, because the old baseline described a different area.",- inputSchema={- "type": "object",- "properties": {- "name": {"type": "string", "description": "Current AOI name"},- "new_name": {- "type": "string",- "description": "New name (case-insensitive, must not collide)",- },- "lat": {- "type": "number",- "description": "New center latitude, -90..90",- },- "lon": {- "type": "number",- "description": "New center longitude, -180..180",- },- "radius_km": {- "type": "number",- "description": "New radius in kilometers, 1..2000",- },- },- "required": ["name"],- },- ),- Tool(- name="intel_aoi_define_polygon",- description="Define a polygon AOI/geofence: a named area bounded by 3-64 [lat, lon] vertices (a border region, a strait, an EEZ - shapes a radius cannot express). Works with every intel_aoi_* tool: briefs, escalation, and change detection scope to the exact polygon (line-feature infrastructure - pipelines, cables - matches the bounding circle, disclosed in data_gaps). Polygons may cross the antimeridian; they may span at most 180 degrees of longitude and a 2000 km bounding radius. Required: name, vertices.",- inputSchema={- "type": "object",- "properties": {- "name": {- "type": "string",- "description": "Unique AOI name (case-insensitive)",- },- "vertices": {- "type": "array",- "description": "3-64 [lat, lon] pairs tracing the polygon",- "items": {- "type": "array",- "items": {"type": "number"},- "minItems": 2,- "maxItems": 2,- },- "minItems": 3,- "maxItems": 64,- },- },- "required": ["name", "vertices"],- },- ),- Tool(- name="intel_aoi_define_corridor",- description="Define a corridor AOI/geofence: a route of 2-64 [lat, lon] waypoints plus a total width in km (1-500) - a shipping lane, supply road, or cable run. Membership means within width/2 of the great-circle route between consecutive waypoints. Works with every intel_aoi_* tool; distances in results are measured to the route, not to a center. Required: name, waypoints, width_km.",- inputSchema={- "type": "object",- "properties": {- "name": {- "type": "string",- "description": "Unique AOI name (case-insensitive)",- },- "waypoints": {- "type": "array",- "description": "2-64 [lat, lon] pairs tracing the route",- "items": {- "type": "array",- "items": {"type": "number"},- "minItems": 2,- "maxItems": 2,- },- "minItems": 2,- "maxItems": 64,- },- "width_km": {- "type": "number",- "description": "Total corridor width in km, 1..500",- },- },- "required": ["name", "waypoints", "width_km"],- },- ),- Tool(- name="intel_aoi_changes",- description="What entered or left a user-defined AOI since the last sweep: geofence change detection over earthquakes, military flights, ACLED conflict events, wildfire clusters, and news mentions. The first call establishes a baseline (nothing is claimed to have entered or left); subsequent calls report new, departed, and unchanged items per domain. A domain whose fetch failed is reported in data_gaps and excluded from the diff (a failed fetch never reads as 'everything left'), keeping its last real observation for the next successful sweep. Sampled aviation is excluded by design: a 1-in-10 sample churns every sweep. Required: name (must already be defined via intel_aoi_define).",- inputSchema={- "type": "object",- "properties": {- "name": {"type": "string", "description": "AOI name"},- },- "required": ["name"],- },- ),- # --- Situation Brief (1 tool) ---- Tool(- name="intel_situation_brief",- description="Cited situational awareness brief, generated on demand over MCP (previously reachable only through the dashboard). Gathers a bounded server-side overview (earthquakes, military flights, ACLED conflict events, wildfires, cyber threats, disease outbreaks, news headlines, space weather, strategic posture, alert digest; not the dashboard's full 47-source fan-out), then synthesizes a 3-paragraph brief via local Ollama, or a mechanically-cited fallback summary when Ollama is unreachable. Returns brief, ai_generated, model, metrics_snapshot, a numbered sources list, and a cited flag that is true only when the brief text references a real source number.",- inputSchema={"type": "object", "properties": {}},- ),- # --- Reports (1 tool) ---- Tool(- name="intel_generate_report",- description="Generate a PDF or HTML intelligence report covering markets, conflicts, earthquakes, cyber threats, health, infrastructure, and more. Returns the file path. Optional: sections (list of section names), title (string), format ('pdf' or 'html').",- inputSchema={- "type": "object",- "properties": {- "title": {- "type": "string",- "description": "Report title (default: 'World Intelligence Report')",- },- "sections": {- "type": "array",- "items": {"type": "string"},- "description": "Sections to include: world_brief, strategic_posture, alerts, markets, economic, earthquakes, wildfires, conflicts, military, infrastructure, maritime, cyber, health, news, climate, nuclear, shipping, service_status. Default: all.",- },- "format": {- "type": "string",- "enum": ["pdf", "html"],- "description": "Output format (default: pdf). Use html if weasyprint is not installed.",- "default": "pdf",- },- },- },- ),- # --- Hazard & Space Domains (4 tools, Phase 25) ---- Tool(- name="intel_weather_alerts",- description="Get active severe weather alerts (CAP) from the US National Weather Service: event, severity, urgency, headline, affected area, effective/expires times. US coverage only - there is no global feed. Lat/lon present only for polygon-based alerts (zone-based alerts return null coordinates rather than fabricated ones). No API key needed. Optional: area (two-letter US state code), severity (Extreme, Severe, Moderate, Minor, Unknown), limit (default 50, applied client-side).",- inputSchema={- "type": "object",- "properties": {- "area": {- "type": "string",- "description": "Two-letter US state/territory code (e.g. TX)",- },- "severity": {- "type": "string",- "description": "Filter: Extreme, Severe, Moderate, Minor, or Unknown",- },- "limit": {- "type": "integer",- "description": "Max alerts (default 50, applied client-side)",- "default": 50,- },- },- },- ),- Tool(- name="intel_launch_schedule",- description="Get upcoming rocket launches from Launch Library 2: name, provider, vehicle, pad with coordinates, launch time (NET), status, mission description. The free tier allows ~15 requests/hour, so results are cached for an hour; recently launched missions may appear with their final status. No API key needed. Optional: limit (default 20).",- inputSchema={- "type": "object",- "properties": {- "limit": {- "type": "integer",- "description": "Max launches (default 20)",- "default": 20,- },- },- },- ),- Tool(- name="intel_volcano_activity",- description="Get the Smithsonian GVP / USGS Weekly Volcanic Activity Report: volcano name, country, coordinates, activity status (new vs continuing), and summary. Updated weekly (Thursdays); a curated summary of activity meeting GVP reporting criteria, not a comprehensive eruption list. No API key needed.",- inputSchema={"type": "object", "properties": {}},- ),- Tool(- name="intel_cyclones",- description="Get active tropical cyclones from the US National Hurricane Center: name, classification, intensity (knots), pressure (mb), position, movement, by-basin grouping. Covers the Atlantic, Eastern and Central Pacific basins only - Western Pacific / Indian Ocean storms (JTWC) are not included. Zero storms means a quiet tropics, not an outage; a fetch failure carries an explicit error. No API key needed.",- inputSchema={"type": "object", "properties": {}},- ),- # --- System (1 tool) ---- Tool(- name="intel_status",- description="Get data source health, circuit breaker status, cache freshness, vector store stats, and system statistics.",- inputSchema={"type": "object", "properties": {}},- ),-]+TOOLS: list[Tool] = list(_tools_pkg.ALL_TOOLS)# ---------------------------------------------------------------------------@@ -2021,827 +110,11 @@ TOOLS: list[Tool] = [async def _dispatch(name: str, arguments: dict[str, Any]) -> Any:- """Route tool call to the appropriate source function."""- match name:- # Markets- case "intel_market_quotes":- return await markets.fetch_market_quotes(- fetcher, symbols=arguments.get("symbols")- )- case "intel_crypto_quotes":- return await markets.fetch_crypto_quotes(- fetcher, limit=arguments.get("limit", 20)- )- case "intel_stablecoin_status":- return await markets.fetch_stablecoin_status(fetcher)- case "intel_etf_flows":- return await markets.fetch_etf_flows(fetcher)- case "intel_sector_heatmap":- return await markets.fetch_sector_heatmap(fetcher)- case "intel_macro_signals":- return await markets.fetch_macro_signals(fetcher)- case "intel_commodity_quotes":- return await markets.fetch_commodity_quotes(fetcher)-- # Economic- case "intel_gas_prices":- return await economic.fetch_gas_prices(fetcher)- case "intel_residential_natgas":- return await economic.fetch_residential_natgas_prices(fetcher)- case "intel_electricity_rates":- return await economic.fetch_electricity_rates(- fetcher,- state=arguments.get("state"),- )- case "intel_energy_prices":- return await economic.fetch_energy_prices(fetcher)- case "intel_fred_series":- return await economic.fetch_fred_series(- fetcher,- series_id=arguments["series_id"],- limit=arguments.get("limit", 30),- )- case "intel_world_bank_indicators":- return await economic.fetch_world_bank_indicators(- fetcher,- country=arguments.get("country", "USA"),- indicators=arguments.get("indicators"),- )-- # Natural- case "intel_earthquakes":- return await seismology.fetch_earthquakes(- fetcher,- min_magnitude=arguments.get("min_magnitude", 4.5),- hours=arguments.get("hours", 24),- limit=arguments.get("limit", 50),- )- case "intel_wildfires":- return await wildfire.fetch_wildfires(- fetcher, region=arguments.get("region")- )-- # Conflict- case "intel_acled_events":- return await conflict.fetch_acled_events(- fetcher,- country=arguments.get("country"),- days=arguments.get("days", 7),- limit=arguments.get("limit", 100),- )- case "intel_ucdp_events":- return await conflict.fetch_ucdp_events(- fetcher,- days=arguments.get("days", 30),- limit=arguments.get("limit", 100),- )- case "intel_humanitarian_summary":- return await conflict.fetch_humanitarian_summary(- fetcher,- country=arguments.get("country"),- )-- # Military- case "intel_military_flights":- return await military.fetch_military_flights(- fetcher, bbox=arguments.get("bbox")- )- case "intel_theater_posture":- return await military.fetch_theater_posture(fetcher)- case "intel_aircraft_details":- return await military.fetch_aircraft_details(- fetcher, icao24=arguments["icao24"]- )-- # Infrastructure- case "intel_internet_outages":- return await infrastructure.fetch_internet_outages(fetcher)- case "intel_cable_health":- return await infrastructure.fetch_cable_health(fetcher)-- # Maritime- case "intel_nav_warnings":- return await maritime.fetch_nav_warnings(- fetcher, navarea=arguments.get("navarea")- )-- # Climate- case "intel_climate_anomalies":- return await climate.fetch_climate_anomalies(- fetcher, zones=arguments.get("zones")- )-- # Prediction- case "intel_prediction_markets":- return await prediction.fetch_prediction_markets(- fetcher, limit=arguments.get("limit", 20)- )-- # Displacement- case "intel_displacement_summary":- return await displacement.fetch_displacement_summary(- fetcher, year=arguments.get("year")- )-- # Aviation- case "intel_airport_delays":- return await aviation.fetch_airport_delays(fetcher)-- # Cyber- case "intel_cyber_threats":- return await cyber.fetch_cyber_threats(- fetcher, limit=arguments.get("limit", 50)- )-- # News- case "intel_news_feed":- return await news.fetch_news_feed(- fetcher,- category=arguments.get("category"),- limit=arguments.get("limit", 50),- )- case "intel_trending_keywords":- return await news.fetch_trending_keywords(- fetcher, min_count=arguments.get("min_count", 3)- )- case "intel_gdelt_search":- return await news.fetch_gdelt_search(- fetcher,- query=arguments.get("query", "conflict"),- mode=arguments.get("mode", "artlist"),- limit=arguments.get("limit", 50),- )-- # Intelligence- case "intel_country_brief":- return await intelligence.fetch_country_brief(- fetcher, country_code=arguments.get("country_code", "US")- )- case "intel_country_dossier":- from .analysis.dossier import fetch_country_dossier-- return await fetch_country_dossier(- fetcher, country=arguments.get("country", "US")- )- case "intel_risk_scores":- return await intelligence.fetch_risk_scores(- fetcher, limit=arguments.get("limit", 20)- )- case "intel_instability_index":- return await intelligence.fetch_instability_index(- fetcher, country_code=arguments.get("country_code")- )- case "intel_signal_convergence":- return await intelligence.fetch_signal_convergence(- fetcher,- lat=arguments.get("lat"),- lon=arguments.get("lon"),- radius_deg=arguments.get("radius_deg", 5.0),- )- case "intel_focal_points":- return await intelligence.fetch_focal_points(fetcher)- case "intel_signal_summary":- return await intelligence.fetch_signal_summary(- fetcher, country=arguments.get("country")- )- case "intel_temporal_anomalies":- return await intelligence.fetch_temporal_anomalies(fetcher)- case "intel_unrest_events":- return await intelligence.fetch_unrest_events(- fetcher,- country=arguments.get("country"),- days=arguments.get("days", 7),- limit=arguments.get("limit", 100),- )- case "intel_hotspot_escalation":- return await intelligence.fetch_hotspot_escalation(fetcher)- case "intel_military_surge":- return await intelligence.fetch_military_surge(fetcher)- case "intel_vessel_snapshot":- return await intelligence.fetch_vessel_snapshot(fetcher)- case "intel_cascade_analysis":- return await intelligence.fetch_cascade_analysis(- fetcher,- corridor=arguments.get("corridor"),- )-- # Space Weather- case "intel_space_weather":- return await space_weather.fetch_space_weather(fetcher)-- # AI Watch- case "intel_ai_releases":- return await ai_watch.fetch_ai_watch(- fetcher, limit=arguments.get("limit", 50)- )-- # Health- case "intel_disease_outbreaks":- return await health.fetch_disease_outbreaks(- fetcher, limit=arguments.get("limit", 50)- )-- # Sanctions- case "intel_sanctions_search":- return await sanctions.fetch_sanctions_search(- fetcher,- query=arguments.get("query", ""),- country=arguments.get("country"),- program=arguments.get("program"),- limit=arguments.get("limit", 50),- )-- # Elections- case "intel_election_calendar":- return await elections.fetch_election_calendar(- fetcher,- country=arguments.get("country"),- )-- # Shipping- case "intel_shipping_index":- return await shipping.fetch_shipping_index(fetcher)-- # Social- case "intel_social_signals":- return await social.fetch_social_signals(- fetcher,- limit=arguments.get("limit", 25),- )-- # Nuclear- case "intel_nuclear_monitor":- return await nuclear.fetch_nuclear_monitor(- fetcher,- hours=arguments.get("hours", 72),- )-- # Alert Digest- case "intel_alert_digest":- from .analysis.alerts import fetch_alert_digest-- return await fetch_alert_digest(fetcher)-- # Weekly Trends- case "intel_weekly_trends":- from .analysis.alerts import fetch_weekly_trends-- return await fetch_weekly_trends(fetcher)-- # Service Status- case "intel_service_status":- return await service_status.fetch_service_status(- fetcher,- provider=arguments.get("provider"),- )-- # Geospatial datasets- case "intel_military_bases":- return await geospatial.fetch_military_bases(- operator=arguments.get("operator"),- country=arguments.get("country"),- base_type=arguments.get("base_type"),- branch=arguments.get("branch"),- )- case "intel_strategic_ports":- return await geospatial.fetch_strategic_ports(- port_type=arguments.get("port_type"),- country=arguments.get("country"),- )- case "intel_pipelines":- return await geospatial.fetch_pipelines(- pipeline_type=arguments.get("pipeline_type"),- status=arguments.get("status"),- )- case "intel_nuclear_facilities":- return await geospatial.fetch_nuclear_facilities(- facility_type=arguments.get("facility_type"),- country=arguments.get("country"),- status=arguments.get("status"),- )-- # Strategic Synthesis- case "intel_strategic_posture":- from .analysis.posture import fetch_strategic_posture-- return await fetch_strategic_posture(fetcher)- case "intel_world_brief":- from .analysis.world_brief import fetch_world_brief-- return await fetch_world_brief(fetcher)- case "intel_fleet_report":- from .sources.fleet import fetch_fleet_report-- return await fetch_fleet_report(fetcher)- case "intel_population_exposure":- from .analysis.exposure import fetch_population_exposure-- return await fetch_population_exposure(- fetcher,- radius_km=arguments.get("radius_km", 200),- event_types=arguments.get("event_types"),- )-- # Extended Geospatial- case "intel_undersea_cables":- return await geospatial.fetch_undersea_cables(- status=arguments.get("status"),- country=arguments.get("country"),- owner=arguments.get("owner"),- min_capacity_tbps=arguments.get("min_capacity_tbps"),- )- case "intel_ai_datacenters":- return await geospatial.fetch_ai_datacenters(- country=arguments.get("country"),- operator=arguments.get("operator"),- min_power_mw=arguments.get("min_power_mw"),- region=arguments.get("region"),- )- case "intel_spaceports":- return await geospatial.fetch_spaceports(- country=arguments.get("country"),- status=arguments.get("status"),- spaceport_type=arguments.get("spaceport_type"),- operator=arguments.get("operator"),- )- case "intel_critical_minerals":- return await geospatial.fetch_critical_minerals(- mineral=arguments.get("mineral"),- country=arguments.get("country"),- mineral_type=arguments.get("mineral_type"),- operator=arguments.get("operator"),- )- case "intel_stock_exchanges":- return await geospatial.fetch_stock_exchanges(- tier=arguments.get("tier"),- country=arguments.get("country"),- currency=arguments.get("currency"),- )-- # Markets Extended- case "intel_country_stocks":- return await markets.fetch_country_stocks(- fetcher,- country=arguments.get("country", "USA"),- )-- # Military Extended- case "intel_aircraft_batch":- return await military.fetch_aircraft_details_batch(- fetcher,- icao24_list=arguments["icao24_list"],- )-- # Tech & Science- case "intel_hacker_news":- return await hacker_news.fetch_hacker_news(- fetcher,- limit=arguments.get("limit", 30),- )- case "intel_trending_repos":- return await github_trending.fetch_trending_repos(- fetcher,- language=arguments.get("language"),- since_days=arguments.get("since_days", 7),- limit=arguments.get("limit", 25),- )- case "intel_arxiv_papers":- return await arxiv_papers.fetch_arxiv_papers(- fetcher,- query=arguments.get("query"),- limit=arguments.get("limit", 25),- )-- # Government- case "intel_usa_spending":- return await usa_spending.fetch_usa_spending(- fetcher,- agency=arguments.get("agency"),- limit=arguments.get("limit", 25),- )-- # USNI Fleet- case "intel_usni_fleet":- return await usni_fleet.fetch_usni_fleet(fetcher)-- # BTC Technicals- case "intel_btc_technicals":- return await markets.fetch_btc_technicals(fetcher)-- # Central Bank Rates- case "intel_central_bank_rates":- return await central_banks.fetch_central_bank_rates(fetcher)-- # Trade Routes- case "intel_trade_routes":- return await geospatial.fetch_trade_routes(- route_type=arguments.get("route_type"),- country=arguments.get("country"),- )-- # Cloud Regions- case "intel_cloud_regions":- return await geospatial.fetch_cloud_regions(- provider=arguments.get("provider"),- country=arguments.get("country"),- )-- # Financial Centers- case "intel_financial_centers":- return await geospatial.fetch_financial_centers(- country=arguments.get("country"),- min_rank=arguments.get("min_rank"),- )-- # Environmental- case "intel_environmental_events":- return await environmental.fetch_environmental_events(- fetcher,- days=arguments.get("days", 30),- category=arguments.get("category"),- limit=arguments.get("limit", 50),- )- case "intel_disaster_alerts":- return await environmental.fetch_disaster_alerts(- fetcher,- alert_level=arguments.get("alert_level"),- event_type=arguments.get("event_type"),- limit=arguments.get("limit", 30),- )-- # NLP Intelligence- case "intel_extract_entities":- from .analysis.entities import fetch_entity_extraction-- return await fetch_entity_extraction(fetcher, text=arguments.get("text"))- case "intel_classify_event":- from .analysis.classifier import fetch_classify_event-- return await fetch_classify_event(fetcher, text=arguments["text"])- case "intel_news_clusters":- from .analysis.clustering import fetch_news_clusters-- return await fetch_news_clusters(- fetcher,- category=arguments.get("category"),- limit=arguments.get("limit", 100),- threshold=arguments.get("threshold", 0.25),- )- case "intel_keyword_spikes":- from .analysis.spikes import fetch_keyword_spikes-- return await fetch_keyword_spikes(- fetcher,- min_count=arguments.get("min_count", 3),- z_threshold=arguments.get("z_threshold", 2.0),- )-- # Traffic- case "intel_traffic_flow":- from .sources.traffic import fetch_traffic_flow-- return await fetch_traffic_flow(fetcher)- case "intel_traffic_incidents":- from .sources.traffic import fetch_traffic_incidents-- return await fetch_traffic_incidents(fetcher)-- # Aviation domestic- case "intel_aviation_domestic":- return await aviation.fetch_domestic_flights(fetcher)-- # Webcams- case "intel_webcams":- from .sources.webcams import fetch_webcams-- return await fetch_webcams(- fetcher,- category=arguments.get("category", "traffic"),- limit=arguments.get("limit", 50),- )-- # Forex- case "intel_forex_rates":- from .sources.forex import fetch_forex_rates-- return await fetch_forex_rates(- fetcher,- base=arguments.get("base", "USD"),- symbols=arguments.get("symbols"),- )- case "intel_forex_timeseries":- from .sources.forex import fetch_forex_timeseries-- return await fetch_forex_timeseries(- fetcher,- base=arguments.get("base", "USD"),- symbol=arguments.get("symbol", "EUR"),- days=arguments.get("days", 30),- )- case "intel_major_crosses":- from .sources.forex import fetch_major_crosses-- return await fetch_major_crosses(fetcher)-- # Bonds & Yields- case "intel_yield_curve":- from .sources.bonds import fetch_yield_curve-- return await fetch_yield_curve(fetcher)- case "intel_bond_indices":- from .sources.bonds import fetch_bond_indices-- return await fetch_bond_indices(fetcher)-- # Earnings- case "intel_earnings_calendar":- from .sources.earnings import fetch_earnings_calendar-- return await fetch_earnings_calendar(- fetcher, days_ahead=arguments.get("days_ahead", 7)- )- case "intel_earnings_surprise":- from .sources.earnings import fetch_earnings_surprise-- return await fetch_earnings_surprise(fetcher, symbol=arguments["symbol"])-- # SEC Filings- case "intel_sec_filings":- from .sources.sec_edgar import fetch_sec_filings-- return await fetch_sec_filings(- fetcher,- query=arguments.get("query"),- form_type=arguments.get("form_type"),- date_range=arguments.get("date_range"),- limit=arguments.get("limit", 25),- )- case "intel_company_filings":- from .sources.sec_edgar import fetch_company_filings-- return await fetch_company_filings(- fetcher,- ticker=arguments["ticker"],- form_types=arguments.get("form_types"),- limit=arguments.get("limit", 10),- )- case "intel_recent_8k":- from .sources.sec_edgar import fetch_recent_8k-- return await fetch_recent_8k(fetcher, limit=arguments.get("limit", 25))-- # Company Enrichment- case "intel_company_profile":- from .analysis.company import fetch_company_profile-- return await fetch_company_profile(fetcher, query=arguments["query"])-- # Macro Composite- case "intel_macro_composite":- from .analysis.macro_composite import fetch_macro_composite-- return await fetch_macro_composite(fetcher)-- # Vector Search- case "intel_semantic_search":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- return await _vector_store.semantic_search(- query=arguments["query"],- limit=arguments.get("limit", 20),- domain=arguments.get("domain"),- category=arguments.get("category"),- hours=arguments.get("hours"),- )- case "intel_similar_events":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- return await _vector_store.find_similar(- domain=arguments.get("domain", "unknown"),- text=arguments["text"],- limit=arguments.get("limit", 10),- hours=arguments.get("hours"),- )- case "intel_timeline":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- return await _vector_store.timeline(- domain=arguments.get("domain"),- category=arguments.get("category"),- hours=arguments.get("hours", 24.0),- limit=arguments.get("limit", 50),- )-- case "intel_vector_stats":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- return await _vector_store.collection_stats()-- case "intel_collect":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- from .collector import collect_once-- return await collect_once(- fetcher,- _vector_store,- source_filter=(- None- if not arguments.get("sources")- else set(arguments["sources"].split(","))- ),- )-- case "intel_cross_correlate":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- return await _vector_store.cross_domain_correlate(- query=arguments["query"],- hours=arguments.get("hours", 24.0),- limit_per_domain=arguments.get("limit_per_domain", 5),- )- case "intel_domain_summary":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- return await _vector_store.domain_summary(- hours=arguments.get("hours", 24.0),- )- case "intel_trend_detection":- if _vector_store is None:- return {"error": "Vector store not available (Qdrant not running?)"}- return await _vector_store.trend_detection(- category=arguments.get("category"),- recent_hours=arguments.get("recent_hours", 6.0),- baseline_hours=arguments.get("baseline_hours", 48.0),- )-- # Daily Digest- case "intel_daily_digest":- from .analysis.daily_digest import fetch_daily_digest-- return await fetch_daily_digest(fetcher, vector_store=_vector_store)-- # AOI Geofences- case "intel_aoi_define":- return aoi.define_aoi(- _aoi_store,- name=arguments.get("name"),- lat=arguments.get("lat"),- lon=arguments.get("lon"),- radius_km=arguments.get("radius_km"),- )- case "intel_aoi_list":- return aoi.list_aois(_aoi_store)- case "intel_aoi_delete":- return aoi.delete_aoi(_aoi_store, name=arguments.get("name"))- case "intel_aoi_define_polygon":- return aoi.define_polygon_aoi(- _aoi_store,- name=arguments.get("name"),- vertices=arguments.get("vertices"),- )- case "intel_aoi_define_corridor":- return aoi.define_corridor_aoi(- _aoi_store,- name=arguments.get("name"),- waypoints=arguments.get("waypoints"),- width_km=arguments.get("width_km"),- )- case "intel_aoi_update":- return aoi.update_aoi(- _aoi_store,- name=arguments.get("name"),- new_name=arguments.get("new_name"),- lat=arguments.get("lat"),- lon=arguments.get("lon"),- radius_km=arguments.get("radius_km"),- )- case "intel_aoi_changes":- return await aoi.fetch_aoi_changes(- fetcher, _aoi_store, name=arguments.get("name")- )- case "intel_aoi_brief":- return await aoi.fetch_aoi_brief(- fetcher, _aoi_store, name=arguments.get("name")- )- case "intel_aoi_escalation":- return await aoi.fetch_aoi_escalation(- fetcher, _aoi_store, name=arguments.get("name")- )-- # Situation Brief- case "intel_situation_brief":- from .analysis.situation import fetch_live_situation_brief-- return await fetch_live_situation_brief(fetcher)-- # System- # Reports- case "intel_generate_report":- from .reports import generate_report-- return await generate_report(- fetcher,- title=arguments.get("title"),- sections=arguments.get("sections"),- fmt=arguments.get("format", "pdf"),- )-- # System- case "intel_weather_alerts":- return await weather.fetch_weather_alerts(- fetcher,- area=arguments.get("area"),- severity=arguments.get("severity"),- limit=arguments.get("limit", 50),- )- case "intel_launch_schedule":- return await launches.fetch_launch_schedule(- fetcher, limit=arguments.get("limit", 20)- )- case "intel_volcano_activity":- return await volcano.fetch_volcano_activity(fetcher)- case "intel_cyclones":- return await cyclones.fetch_cyclones(fetcher)- case "intel_status":- vs_stats = {- "enabled": False,- "error": 'Vector store dependencies not installed. Install with `pip install -e ".[vector]"`.',- }- if _vector_store:- vs_stats = await _vector_store.collection_stats()- return {- "circuit_breakers": breaker.status(),- "cache": cache.stats(),- "cache_freshness": cache.freshness(),- "vector_store": vs_stats,- "sources": {- "markets": [- "yahoo-finance",- "coingecko",- "alternative-me",- "mempool",- ],- "economic": ["eia", "fred", "world-bank"],- "natural": ["usgs", "nasa-firms"],- "conflict": ["acled", "ucdp", "hdx"],- "military": ["opensky", "hexdb", "adsblol"],- "infrastructure": ["cloudflare-radar", "ioda", "nga-msi"],- "maritime": ["nga-msi"],- "climate": ["open-meteo"],- "news": ["rss-aggregator", "gdelt"],- "intelligence": ["ollama", "acled", "world-bank", "hdx", "usgs"],- "prediction": ["polymarket"],- "displacement": ["unhcr"],- "aviation": ["faa"],- "cyber": ["feodo-tracker", "cisa-kev", "sans-dshield", "urlhaus"],- "space_weather": ["noaa-swpc"],- "ai_watch": ["arxiv", "huggingface", "ai-news-rss"],- "health": ["who-don", "cdc", "outbreak-news"],- "sanctions": ["ofac-sdn"],- "elections": ["election-calendar"],- "shipping": ["yahoo-finance"],- "social": ["reddit-public"],- "nuclear": ["usgs-nuclear-monitor"],- "service_status": ["aws", "azure", "gcp", "cloudflare", "github"],- "geospatial": [- "static-datasets (bases, ports, pipelines, nuclear, cables, datacenters, spaceports, minerals, exchanges, trade-routes, cloud-regions, financial-centers)"- ],- "nlp": [- "regex-ner",- "keyword-classifier",- "jaccard-clustering",- "keyword-spike-detector",- ],- "synthesis": [- "strategic-posture",- "world-brief",- "fleet-report",- "population-exposure",- ],- "tech": ["hackernews", "github", "arxiv"],- "government": ["usaspending-gov"],- "environmental": ["eonet", "gdacs"],- "forex": ["ecb-frankfurter"],- "bonds": ["fred", "yahoo-finance"],- "earnings": ["yahoo-finance"],- "sec_filings": ["sec-edgar"],- "company_enrichment": [- "yahoo-finance",- "gdelt",- "sec-edgar",- "github",- ],- "macro_composite": [- "yahoo-finance",- "coingecko",- "alternative-me",- ],- },- }-- case _:- return {"error": f"Unknown tool: {name}"}+ """Route tool call to its domain-module handler."""+ handler = _tools_pkg.ALL_HANDLERS.get(name)+ if handler is not None:+ return await handler(arguments)+ return {"error": f"Unknown tool: {name}"}# ---------------------------------------------------------------------------diff --git a/src/world_intel_mcp/tests/test_aoi.py b/src/world_intel_mcp/tests/test_aoi.pyindex baab6f0..e545816 100644--- a/src/world_intel_mcp/tests/test_aoi.py+++ b/src/world_intel_mcp/tests/test_aoi.py@@ -9,6 +9,7 @@ aoi.py composes existing ``sources/*.py`` fetch functions rather thanmaking HTTP calls itself, so there is no network edge for respx to sit at."""+import inspectfrom pathlib import Pathimport pytest@@ -600,12 +601,38 @@ async def test_fetch_aoi_escalation_reports_data_gap_on_fetch_failure(# ----------------------------------------------------------------------------# Server registration / dispatch parity (matches test_daily_digest.py's-# pattern: read server.py as text rather than importing it, since import-# opens a live Cache()/AOIStore() at the default on-disk path).+# Server registration / dispatch parity. Since the Phase 26 split the AOI+# tools live in tools/aoi.py; these tests import the aggregated registry+# for real (under the suite's sanctioned temp cache path) instead of+# scanning server.py as text, and verify both registration and that each+# handler still dispatches to the intended analysis/aoi.py function.# ---------------------------------------------------------------------------+def _tools_registry():+ """Import world_intel_mcp.tools under the suite's temp cache path.++ Importing the tools package imports runtime, which opens a live+ ``Cache()``/``AOIStore()``; pointing WORLD_INTEL_CACHE_DB at+ test_server_registry's temp path (shared, so the override holds no+ matter which test file triggers the first import) keeps that off the+ developer's real cache database."""+ import importlib+ import os++ from .test_server_registry import _TMP_CACHE++ prior = os.environ.get("WORLD_INTEL_CACHE_DB")+ os.environ["WORLD_INTEL_CACHE_DB"] = str(_TMP_CACHE)+ try:+ return importlib.import_module("world_intel_mcp.tools")+ finally:+ if prior is None:+ os.environ.pop("WORLD_INTEL_CACHE_DB", None)+ else:+ os.environ["WORLD_INTEL_CACHE_DB"] = prior++@pytest.mark.parametrize("tool_name,fn_name",[@@ -617,25 +644,29 @@ async def test_fetch_aoi_escalation_reports_data_gap_on_fetch_failure(],)def test_aoi_tools_registered_and_dispatched(tool_name: str, fn_name: str) -> None:- """Structural parity check: the TOOLS/`_dispatch` 1:1 invariant this- repo maintains (see ROADMAP.md 'MCP tool parity') must hold for every- new AOI tool."""- text = _SERVER_PY.read_text()+ """Structural parity check: the TOOLS/handler 1:1 invariant this repo+ maintains (see ROADMAP.md 'MCP tool parity') must hold for every AOI+ tool. Membership in ALL_TOOLS/ALL_HANDLERS proves tools/aoi.py is+ wired into _MODULES (not merely present on disk); the handler-source+ check proves the tool still routes to the intended analysis/aoi.py+ function."""+ tools_pkg = _tools_registry()- assert f'name="{tool_name}"' in text+ assert tool_name in {t.name for t in tools_pkg.aoi.TOOLS}+ assert tool_name in {t.name for t in tools_pkg.ALL_TOOLS}- dispatch_idx = text.index(f'case "{tool_name}":')- assert dispatch_idx > 0- dispatch_body = text[dispatch_idx : dispatch_idx + 300]- assert fn_name in dispatch_body+ handler = tools_pkg.aoi.HANDLERS[tool_name]+ assert tools_pkg.ALL_HANDLERS[tool_name] is handler+ assert fn_name in inspect.getsource(handler)def test_aoi_store_instantiated_from_cache_db_path() -> None:"""The AOIStore must share the Cache's resolved db_path, not computeits own default independently (which could diverge under- WORLD_INTEL_CACHE_DB or the tempdir fallback)."""- text = _SERVER_PY.read_text()- assert "_aoi_store = aoi.AOIStore(cache.db_path)" in text+ WORLD_INTEL_CACHE_DB or the tempdir fallback). Since the Phase 26+ split the construction lives in runtime.py."""+ text = (_SERVER_PY.parent / "runtime.py").read_text()+ assert "aoi.AOIStore(cache.db_path)" in text# ---------------------------------------------------------------------------@@ -1003,11 +1034,14 @@ def test_delete_aoi_also_deletes_snapshot(store: AOIStore) -> None:],)def test_new_aoi_tools_registered_and_dispatched(tool_name: str, fn_name: str) -> None:- text = _SERVER_PY.read_text()- assert f'name="{tool_name}"' in text- dispatch_idx = text.index(f'case "{tool_name}":')- dispatch_body = text[dispatch_idx : dispatch_idx + 300]- assert fn_name in dispatch_body+ tools_pkg = _tools_registry()++ assert tool_name in {t.name for t in tools_pkg.aoi.TOOLS}+ assert tool_name in {t.name for t in tools_pkg.ALL_TOOLS}++ handler = tools_pkg.aoi.HANDLERS[tool_name]+ assert tools_pkg.ALL_HANDLERS[tool_name] is handler+ assert fn_name in inspect.getsource(handler)# ---------------------------------------------------------------------------diff --git a/src/world_intel_mcp/tests/test_daily_digest.py b/src/world_intel_mcp/tests/test_daily_digest.pyindex 8ad42b1..1f7304e 100644--- a/src/world_intel_mcp/tests/test_daily_digest.py+++ b/src/world_intel_mcp/tests/test_daily_digest.py@@ -6,7 +6,6 @@ used in test_intelligence.py, since daily_digest composes existing"""import re-from pathlib import Pathimport pytest@@ -24,8 +23,6 @@ from world_intel_mcp.sources import (wildfire,)-_SERVER_PY = Path(__file__).resolve().parents[1] / "server.py"-class _FakeVectorStore:def __init__(self, trend_result: dict, timeline_result: dict) -> None:@@ -270,18 +267,42 @@ async def test_digest_domain_failure_reports_gap_not_fabricated_event(assert not any(s["domain"] == "cyber" for s in result["sources"])+def _tools_registry():+ """Import world_intel_mcp.tools under the suite's temp cache path.++ Importing the tools package imports runtime, which opens a live+ ``Cache()``/``AOIStore()``; pointing WORLD_INTEL_CACHE_DB at+ test_server_registry's temp path (shared, so the override holds no+ matter which test file triggers the first import) keeps that off the+ developer's real cache database."""+ import importlib+ import os++ from .test_server_registry import _TMP_CACHE++ prior = os.environ.get("WORLD_INTEL_CACHE_DB")+ os.environ["WORLD_INTEL_CACHE_DB"] = str(_TMP_CACHE)+ try:+ return importlib.import_module("world_intel_mcp.tools")+ finally:+ if prior is None:+ os.environ.pop("WORLD_INTEL_CACHE_DB", None)+ else:+ os.environ["WORLD_INTEL_CACHE_DB"] = prior++def test_intel_daily_digest_registered_and_dispatched() -> None:- """Structural parity check: the TOOLS/`_dispatch` 1:1 invariant this+ """Structural parity check: the TOOLS/handler 1:1 invariant thisrepo maintains (see ROADMAP.md 'MCP tool parity') must hold for the- new tool. Reads server.py as text rather than importing the module,- since importing `world_intel_mcp.server` has real side effects- (opens a live Cache() at the default on-disk path) that no other- test in this suite triggers."""- text = _SERVER_PY.read_text()-- assert 'name="intel_daily_digest"' in text-- dispatch_idx = text.index('case "intel_daily_digest":')- assert dispatch_idx > 0- dispatch_body = text[dispatch_idx : dispatch_idx + 300]- assert "fetch_daily_digest" in dispatch_body+ tool. Since the Phase 26 split it lives in tools/aoi.py; importing+ the aggregated registry verifies registration for real (membership+ in ALL_TOOLS/ALL_HANDLERS proves the module is wired into _MODULES)+ and that the handler still routes to fetch_daily_digest."""+ import inspect++ tools_pkg = _tools_registry()++ assert "intel_daily_digest" in {t.name for t in tools_pkg.ALL_TOOLS}++ handler = tools_pkg.ALL_HANDLERS["intel_daily_digest"]+ assert "fetch_daily_digest" in inspect.getsource(handler)diff --git a/src/world_intel_mcp/tests/test_server_registry.py b/src/world_intel_mcp/tests/test_server_registry.pyindex 82e1bb2..c535bae 100644--- a/src/world_intel_mcp/tests/test_server_registry.py+++ b/src/world_intel_mcp/tests/test_server_registry.py@@ -60,14 +60,66 @@ def test_every_tool_has_description_and_object_schema(server) -> None:def test_tools_and_dispatch_are_in_one_to_one_parity(server) -> None:"""The invariant ROADMAP.md carries ('TOOLS and _dispatch are- aligned'), checked against the imported module rather than a text- scan of the repo: every registered tool has a dispatch case and- every dispatch case is a registered tool."""+ aligned'). Since the Phase 26 split, dispatch is the union of the+ modular handler registry (tools.ALL_HANDLERS, whose per-module+ parity is enforced at import by tools.aggregate) and the shrinking+ legacy match/case; every registered tool must resolve through+ exactly that union, and nothing may be dispatchable without being+ registered."""+ from world_intel_mcp import tools as tools_pkg+registered = {t.name for t in server.TOOLS}dispatch_src = inspect.getsource(server._dispatch)- dispatched = set(re.findall(r'case "(intel_[a-z0-9_]+)"', dispatch_src))- assert registered - dispatched == set(), "registered but never dispatched"- assert dispatched - registered == set(), "dispatched but never registered"+ legacy_cases = set(re.findall(r'case "(intel_[a-z0-9_]+)"', dispatch_src))+ handled = legacy_cases | set(tools_pkg.ALL_HANDLERS)+ assert registered - handled == set(), "registered but never dispatched"+ assert handled - registered == set(), "dispatched but never registered"+ overlap = legacy_cases & set(tools_pkg.ALL_HANDLERS)+ assert overlap == set(), f"tool handled twice (legacy + modular): {overlap}"+++def test_aggregate_refuses_drift_and_collisions() -> None:+ """The import-time guarantee has to be falsifiable: a module whose+ TOOLS and HANDLERS disagree, or that collides with an existing+ name, must refuse to aggregate."""+ import types++ from mcp.types import Tool as _Tool++ from world_intel_mcp import tools as tools_pkg++ drifty = types.SimpleNamespace(+ __name__="drifty",+ TOOLS=[+ _Tool(+ name="intel_fake",+ description="x",+ inputSchema={"type": "object", "properties": {}},+ )+ ],+ HANDLERS={},+ )+ with pytest.raises(RuntimeError, match="drift"):+ tools_pkg.aggregate([drifty])++ async def _h(arguments):+ return {}++ colliding = types.SimpleNamespace(+ __name__="colliding",+ TOOLS=[+ _Tool(+ name="intel_status",+ description="x",+ inputSchema={"type": "object", "properties": {}},+ )+ ],+ HANDLERS={"intel_status": _h},+ )+ from world_intel_mcp.tools import system as system_mod++ with pytest.raises(RuntimeError, match="collision"):+ tools_pkg.aggregate([system_mod, colliding])def test_tool_count_matches_documented_surface(server) -> None:diff --git a/src/world_intel_mcp/tests/test_situation.py b/src/world_intel_mcp/tests/test_situation.pyindex 7857cec..7d583ca 100644--- a/src/world_intel_mcp/tests/test_situation.py+++ b/src/world_intel_mcp/tests/test_situation.py@@ -10,7 +10,6 @@ analysis/*.py fetch functions rather than making HTTP calls itself."""import re-from pathlib import Pathimport httpximport pytest@@ -34,7 +33,6 @@ from world_intel_mcp.sources import (from world_intel_mcp.sources import wildfire_OLLAMA_GENERATE = "http://localhost:11434/api/generate"-_SERVER_PY = Path(__file__).resolve().parents[1] / "server.py"def _synthetic_overview() -> dict:@@ -533,18 +531,42 @@ async def test_situation_brief_tool_falls_back_when_ollama_unreachable(assert found_ns <= real_ns+def _tools_registry():+ """Import world_intel_mcp.tools under the suite's temp cache path.++ Importing the tools package imports runtime, which opens a live+ ``Cache()``/``AOIStore()``; pointing WORLD_INTEL_CACHE_DB at+ test_server_registry's temp path (shared, so the override holds no+ matter which test file triggers the first import) keeps that off the+ developer's real cache database."""+ import importlib+ import os++ from .test_server_registry import _TMP_CACHE++ prior = os.environ.get("WORLD_INTEL_CACHE_DB")+ os.environ["WORLD_INTEL_CACHE_DB"] = str(_TMP_CACHE)+ try:+ return importlib.import_module("world_intel_mcp.tools")+ finally:+ if prior is None:+ os.environ.pop("WORLD_INTEL_CACHE_DB", None)+ else:+ os.environ["WORLD_INTEL_CACHE_DB"] = prior++def test_intel_situation_brief_registered_and_dispatched() -> None:- """Structural parity check: the TOOLS/`_dispatch` 1:1 invariant this+ """Structural parity check: the TOOLS/handler 1:1 invariant thisrepo maintains (see ROADMAP.md 'MCP tool parity') must hold for the- new tool. Reads server.py as text rather than importing the module,- matching test_daily_digest.py's and test_aoi.py's pattern (importing- world_intel_mcp.server opens a live Cache() at the default on-disk- path, which no other test in this suite triggers)."""- text = _SERVER_PY.read_text()-- assert 'name="intel_situation_brief"' in text-- dispatch_idx = text.index('case "intel_situation_brief":')- assert dispatch_idx > 0- dispatch_body = text[dispatch_idx : dispatch_idx + 300]- assert "fetch_live_situation_brief" in dispatch_body+ tool. Since the Phase 26 split it lives in tools/aoi.py; importing+ the aggregated registry verifies registration for real (membership+ in ALL_TOOLS/ALL_HANDLERS proves the module is wired into _MODULES)+ and that the handler still routes to fetch_live_situation_brief."""+ import inspect++ tools_pkg = _tools_registry()++ assert "intel_situation_brief" in {t.name for t in tools_pkg.ALL_TOOLS}++ handler = tools_pkg.ALL_HANDLERS["intel_situation_brief"]+ assert "fetch_live_situation_brief" in inspect.getsource(handler)diff --git a/src/world_intel_mcp/tools/__init__.py b/src/world_intel_mcp/tools/__init__.pynew file mode 100644index 0000000..d1b68a7--- /dev/null+++ b/src/world_intel_mcp/tools/__init__.py@@ -0,0 +1,85 @@+"""Domain-modular tool registry (Phase 26 server.py split).++Each domain module in this package exports two names:++- ``TOOLS: list[mcp.types.Tool]`` — the domain's tool definitions.+- ``HANDLERS: dict[str, Handler]`` — tool name to handler, where a+ handler is ``async def h(arguments: dict) -> Any`` and reaches shared+ infrastructure through ``world_intel_mcp.runtime`` (fetcher, cache,+ aoi_store, vector_store).++``aggregate()`` builds the combined registry and enforces, at import+time, the invariant ROADMAP.md has carried since Phase 0: every+registered tool has exactly one handler and every handler has exactly+one registration, with no name collisions across modules. A drift that+the old text-scan parity check could only catch in CI now prevents the+server from importing at all.+"""++from typing import Any, Awaitable, Callable++from mcp.types import Tool++Handler = Callable[[dict[str, Any]], Awaitable[Any]]++from . import ( # noqa: E402+ aoi,+ conflict,+ finance,+ geospatial,+ hazards,+ infrastructure,+ intelligence,+ markets,+ society,+ synthesis,+ system,+ vector,+)++# Module order defines list_tools order, approximating the pre-split+# registry order (markets first ... system last).+_MODULES = [+ markets,+ hazards,+ conflict,+ infrastructure,+ society,+ intelligence,+ geospatial,+ synthesis,+ finance,+ vector,+ aoi,+ system,+]+++def aggregate(+ modules: list,+) -> tuple[list[Tool], dict[str, Handler]]:+ """Combine per-domain registries, refusing drift and collisions."""+ all_tools: list[Tool] = []+ all_handlers: dict[str, Handler] = {}+ for module in modules:+ tools: list[Tool] = module.TOOLS+ handlers: dict[str, Handler] = module.HANDLERS+ tool_names = {t.name for t in tools}+ if tool_names != set(handlers):+ raise RuntimeError(+ f"{module.__name__}: TOOLS/HANDLERS drift - "+ f"registered-without-handler {sorted(tool_names - set(handlers))}, "+ f"handler-without-registration {sorted(set(handlers) - tool_names)}"+ )+ collisions = tool_names & set(all_handlers)+ if collisions:+ raise RuntimeError(+ f"{module.__name__}: tool name collision across modules: "+ f"{sorted(collisions)}"+ )+ all_tools.extend(tools)+ all_handlers.update(handlers)+ return all_tools, all_handlers+++ALL_TOOLS, ALL_HANDLERS = aggregate(_MODULES)diff --git a/src/world_intel_mcp/tools/aoi.py b/src/world_intel_mcp/tools/aoi.pynew file mode 100644index 0000000..431000d--- /dev/null+++ b/src/world_intel_mcp/tools/aoi.py@@ -0,0 +1,317 @@+"""AOI geofences, briefs, and reports: daily digest, AOI+define/list/update/delete and change detection, AOI brief and+escalation, situation brief, PDF/HTML report generation.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime+from ..analysis import aoi++TOOLS: list[Tool] = [+ # --- Daily Digest (1 tool) ---+ Tool(+ name="intel_daily_digest",+ description="Cited markdown morning brief: top current events by domain (earthquakes, military, conflict, wildfires, cyber, health, air/traffic), recent headlines, and, when the optional vector store is installed, recent activity trends and a 24h timeline. Every listed item carries a [n] citation into a numbered sources list. Degrades honestly via data_gaps when the vector store or a domain fetch is unavailable, instead of showing an empty section as a quiet day.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- AOI Geofences (5 tools) ---+ Tool(+ name="intel_aoi_define",+ description="Define a named area of interest (AOI/geofence): a point plus a radius in kilometers, persisted for intel_aoi_brief, intel_aoi_escalation, intel_aoi_list, and intel_aoi_delete. Required: name, lat (-90..90), lon (-180..180), radius_km (1..2000). Rejects a duplicate name (case-insensitive) politely, echoing the existing definition instead of overwriting it.",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {+ "type": "string",+ "description": "Unique AOI name (case-insensitive)",+ },+ "lat": {+ "type": "number",+ "description": "Center latitude, -90..90",+ },+ "lon": {+ "type": "number",+ "description": "Center longitude, -180..180",+ },+ "radius_km": {+ "type": "number",+ "description": "Radius in kilometers, 1..2000",+ },+ },+ "required": ["name", "lat", "lon", "radius_km"],+ },+ ),+ Tool(+ name="intel_aoi_list",+ description="List all user-defined areas of interest (AOIs/geofences).",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_aoi_delete",+ description="Delete a user-defined area of interest by name.",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {"type": "string", "description": "AOI name to delete"},+ },+ "required": ["name"],+ },+ ),+ Tool(+ name="intel_aoi_brief",+ description="Cited brief for a user-defined AOI: earthquakes, military flights (bbox-derived), wildfires (region-mapped), ACLED conflict events, sampled aviation traffic, nearby static infrastructure (bases, ports, pipelines, nuclear, cables, datacenters, spaceports) with distances in km, and news headline mentions of the AOI name. Every item carries a [n] citation into a numbered sources list; data_gaps names every domain that could not be scoped to the AOI rather than omitting it silently. Required: name (must already be defined via intel_aoi_define).",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {"type": "string", "description": "AOI name"},+ },+ "required": ["name"],+ },+ ),+ Tool(+ name="intel_aoi_escalation",+ description="Run the hotspot escalation scoring (baseline, military, conflict, social-unrest components; 0-100) on a user-defined AOI instead of only the 22 built-in intel hotspots. News-mention and geo-convergence components are not wired up and report null, same as intel_hotspot_escalation. Required: name (must already be defined via intel_aoi_define).",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {"type": "string", "description": "AOI name"},+ },+ "required": ["name"],+ },+ ),+ Tool(+ name="intel_aoi_update",+ description="Update a user-defined AOI in place: rename it and/or change its center or radius, without losing its identity. Required: name. Optional: new_name, lat, lon, radius_km (same validation as intel_aoi_define; at least one must be provided). A rename keeps the AOI's change-detection history; changing center or radius drops it, because the old baseline described a different area.",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {"type": "string", "description": "Current AOI name"},+ "new_name": {+ "type": "string",+ "description": "New name (case-insensitive, must not collide)",+ },+ "lat": {+ "type": "number",+ "description": "New center latitude, -90..90",+ },+ "lon": {+ "type": "number",+ "description": "New center longitude, -180..180",+ },+ "radius_km": {+ "type": "number",+ "description": "New radius in kilometers, 1..2000",+ },+ },+ "required": ["name"],+ },+ ),+ Tool(+ name="intel_aoi_define_polygon",+ description="Define a polygon AOI/geofence: a named area bounded by 3-64 [lat, lon] vertices (a border region, a strait, an EEZ - shapes a radius cannot express). Works with every intel_aoi_* tool: briefs, escalation, and change detection scope to the exact polygon (line-feature infrastructure - pipelines, cables - matches the bounding circle, disclosed in data_gaps). Polygons may cross the antimeridian; they may span at most 180 degrees of longitude and a 2000 km bounding radius. Required: name, vertices.",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {+ "type": "string",+ "description": "Unique AOI name (case-insensitive)",+ },+ "vertices": {+ "type": "array",+ "description": "3-64 [lat, lon] pairs tracing the polygon",+ "items": {+ "type": "array",+ "items": {"type": "number"},+ "minItems": 2,+ "maxItems": 2,+ },+ "minItems": 3,+ "maxItems": 64,+ },+ },+ "required": ["name", "vertices"],+ },+ ),+ Tool(+ name="intel_aoi_define_corridor",+ description="Define a corridor AOI/geofence: a route of 2-64 [lat, lon] waypoints plus a total width in km (1-500) - a shipping lane, supply road, or cable run. Membership means within width/2 of the great-circle route between consecutive waypoints. Works with every intel_aoi_* tool; distances in results are measured to the route, not to a center. Required: name, waypoints, width_km.",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {+ "type": "string",+ "description": "Unique AOI name (case-insensitive)",+ },+ "waypoints": {+ "type": "array",+ "description": "2-64 [lat, lon] pairs tracing the route",+ "items": {+ "type": "array",+ "items": {"type": "number"},+ "minItems": 2,+ "maxItems": 2,+ },+ "minItems": 2,+ "maxItems": 64,+ },+ "width_km": {+ "type": "number",+ "description": "Total corridor width in km, 1..500",+ },+ },+ "required": ["name", "waypoints", "width_km"],+ },+ ),+ Tool(+ name="intel_aoi_changes",+ description="What entered or left a user-defined AOI since the last sweep: geofence change detection over earthquakes, military flights, ACLED conflict events, wildfire clusters, and news mentions. The first call establishes a baseline (nothing is claimed to have entered or left); subsequent calls report new, departed, and unchanged items per domain. A domain whose fetch failed is reported in data_gaps and excluded from the diff (a failed fetch never reads as 'everything left'), keeping its last real observation for the next successful sweep. Sampled aviation is excluded by design: a 1-in-10 sample churns every sweep. Required: name (must already be defined via intel_aoi_define).",+ inputSchema={+ "type": "object",+ "properties": {+ "name": {"type": "string", "description": "AOI name"},+ },+ "required": ["name"],+ },+ ),+ # --- Situation Brief (1 tool) ---+ Tool(+ name="intel_situation_brief",+ description="Cited situational awareness brief, generated on demand over MCP (previously reachable only through the dashboard). Gathers a bounded server-side overview (earthquakes, military flights, ACLED conflict events, wildfires, cyber threats, disease outbreaks, news headlines, space weather, strategic posture, alert digest; not the dashboard's full 47-source fan-out), then synthesizes a 3-paragraph brief via local Ollama, or a mechanically-cited fallback summary when Ollama is unreachable. Returns brief, ai_generated, model, metrics_snapshot, a numbered sources list, and a cited flag that is true only when the brief text references a real source number.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Reports (1 tool) ---+ Tool(+ name="intel_generate_report",+ description="Generate a PDF or HTML intelligence report covering markets, conflicts, earthquakes, cyber threats, health, infrastructure, and more. Returns the file path. Optional: sections (list of section names), title (string), format ('pdf' or 'html').",+ inputSchema={+ "type": "object",+ "properties": {+ "title": {+ "type": "string",+ "description": "Report title (default: 'World Intelligence Report')",+ },+ "sections": {+ "type": "array",+ "items": {"type": "string"},+ "description": "Sections to include: world_brief, strategic_posture, alerts, markets, economic, earthquakes, wildfires, conflicts, military, infrastructure, maritime, cyber, health, news, climate, nuclear, shipping, service_status. Default: all.",+ },+ "format": {+ "type": "string",+ "enum": ["pdf", "html"],+ "description": "Output format (default: pdf). Use html if weasyprint is not installed.",+ "default": "pdf",+ },+ },+ },+ ),+]+++async def _daily_digest(arguments: dict[str, Any]) -> Any:+ from ..analysis.daily_digest import fetch_daily_digest++ return await fetch_daily_digest(runtime.fetcher, vector_store=runtime.vector_store)+++async def _aoi_define(arguments: dict[str, Any]) -> Any:+ return aoi.define_aoi(+ runtime.aoi_store,+ name=arguments.get("name"),+ lat=arguments.get("lat"),+ lon=arguments.get("lon"),+ radius_km=arguments.get("radius_km"),+ )+++async def _aoi_list(arguments: dict[str, Any]) -> Any:+ return aoi.list_aois(runtime.aoi_store)+++async def _aoi_delete(arguments: dict[str, Any]) -> Any:+ return aoi.delete_aoi(runtime.aoi_store, name=arguments.get("name"))+++async def _aoi_brief(arguments: dict[str, Any]) -> Any:+ return await aoi.fetch_aoi_brief(+ runtime.fetcher, runtime.aoi_store, name=arguments.get("name")+ )+++async def _aoi_escalation(arguments: dict[str, Any]) -> Any:+ return await aoi.fetch_aoi_escalation(+ runtime.fetcher, runtime.aoi_store, name=arguments.get("name")+ )+++async def _aoi_update(arguments: dict[str, Any]) -> Any:+ return aoi.update_aoi(+ runtime.aoi_store,+ name=arguments.get("name"),+ new_name=arguments.get("new_name"),+ lat=arguments.get("lat"),+ lon=arguments.get("lon"),+ radius_km=arguments.get("radius_km"),+ )+++async def _aoi_define_polygon(arguments: dict[str, Any]) -> Any:+ return aoi.define_polygon_aoi(+ runtime.aoi_store,+ name=arguments.get("name"),+ vertices=arguments.get("vertices"),+ )+++async def _aoi_define_corridor(arguments: dict[str, Any]) -> Any:+ return aoi.define_corridor_aoi(+ runtime.aoi_store,+ name=arguments.get("name"),+ waypoints=arguments.get("waypoints"),+ width_km=arguments.get("width_km"),+ )+++async def _aoi_changes(arguments: dict[str, Any]) -> Any:+ return await aoi.fetch_aoi_changes(+ runtime.fetcher, runtime.aoi_store, name=arguments.get("name")+ )+++async def _situation_brief(arguments: dict[str, Any]) -> Any:+ from ..analysis.situation import fetch_live_situation_brief++ return await fetch_live_situation_brief(runtime.fetcher)+++async def _generate_report(arguments: dict[str, Any]) -> Any:+ from ..reports import generate_report++ return await generate_report(+ runtime.fetcher,+ title=arguments.get("title"),+ sections=arguments.get("sections"),+ fmt=arguments.get("format", "pdf"),+ )+++HANDLERS = {+ "intel_daily_digest": _daily_digest,+ "intel_aoi_define": _aoi_define,+ "intel_aoi_list": _aoi_list,+ "intel_aoi_delete": _aoi_delete,+ "intel_aoi_brief": _aoi_brief,+ "intel_aoi_escalation": _aoi_escalation,+ "intel_aoi_update": _aoi_update,+ "intel_aoi_define_polygon": _aoi_define_polygon,+ "intel_aoi_define_corridor": _aoi_define_corridor,+ "intel_aoi_changes": _aoi_changes,+ "intel_situation_brief": _situation_brief,+ "intel_generate_report": _generate_report,+}diff --git a/src/world_intel_mcp/tools/conflict.py b/src/world_intel_mcp/tools/conflict.pynew file mode 100644index 0000000..135a583--- /dev/null+++ b/src/world_intel_mcp/tools/conflict.py@@ -0,0 +1,211 @@+"""Conflict and military tools: ACLED and UCDP events,+humanitarian summaries, military flights and aircraft lookups, nuclear+test-site monitoring, USNI fleet disposition.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime+from ..sources import (+ conflict,+ military,+ nuclear,+ usni_fleet,+)++TOOLS: list[Tool] = [+ # --- Conflict (3 tools) ---+ Tool(+ name="intel_acled_events",+ description="Get armed conflict events from ACLED. Optional: country (name), days (default 7), limit (default 100). Requires ACLED_ACCESS_TOKEN.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {"type": "string", "description": "Country name filter"},+ "days": {+ "type": "integer",+ "description": "Lookback days (default 7)",+ "default": 7,+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default 100)",+ "default": 100,+ },+ },+ },+ ),+ Tool(+ name="intel_ucdp_events",+ description="Get state-based violence events from UCDP GED. No API key needed. Optional: days (default 30).",+ inputSchema={+ "type": "object",+ "properties": {+ "days": {+ "type": "integer",+ "description": "Lookback days (default 30)",+ "default": 30,+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default 100)",+ "default": 100,+ },+ },+ },+ ),+ Tool(+ name="intel_humanitarian_summary",+ description="Get humanitarian crisis datasets from HDX. No API key needed. Optional: country code.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {"type": "string", "description": "ISO country code filter"},+ },+ },+ ),+ # --- Military (3 tools) ---+ Tool(+ name="intel_military_flights",+ description="Track military aircraft via OpenSky Network (ICAO hex + callsign filtering). Optional: bbox (lamin,lomin,lamax,lomax).",+ inputSchema={+ "type": "object",+ "properties": {+ "bbox": {+ "type": "string",+ "description": "Bounding box: lamin,lomin,lamax,lomax",+ },+ },+ },+ ),+ Tool(+ name="intel_theater_posture",+ description="Get military aircraft presence across 5 theaters: European, Indo-Pacific, Middle East, Arctic, Korean Peninsula.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_aircraft_details",+ description="Get aircraft details from hexdb.io by ICAO24 hex code (free, no API key).",+ inputSchema={+ "type": "object",+ "properties": {+ "icao24": {"type": "string", "description": "ICAO24 hex code"},+ },+ "required": ["icao24"],+ },+ ),+ # --- Military Extended (1 tool) ---+ Tool(+ name="intel_aircraft_batch",+ description="Batch lookup of aircraft details by ICAO24 hex codes (max 20). Returns registration, type, operator from hexdb.io.",+ inputSchema={+ "type": "object",+ "properties": {+ "icao24_list": {+ "type": "array",+ "items": {"type": "string"},+ "description": "List of ICAO24 hex addresses (max 20)",+ },+ },+ "required": ["icao24_list"],+ },+ ),+ # --- Nuclear (1 tool) ---+ Tool(+ name="intel_nuclear_monitor",+ description="Monitor seismic activity near 5 known nuclear test sites (Punggye-ri, Lop Nur, Novaya Zemlya, Nevada NTS, Semipalatinsk). Concern scoring based on depth, magnitude, distance.",+ inputSchema={+ "type": "object",+ "properties": {+ "hours": {+ "type": "integer",+ "description": "Lookback hours (default 72)",+ "default": 72,+ },+ },+ },+ ),+ # --- USNI Fleet (1 tool) ---+ Tool(+ name="intel_usni_fleet",+ description="US Navy fleet disposition from USNI News Fleet Tracker. Extracts ships, hull numbers, carrier strike groups, regional deployment, and force totals from the latest weekly report.",+ inputSchema={"type": "object", "properties": {}},+ ),+]+++async def _acled_events(arguments: dict[str, Any]) -> Any:+ return await conflict.fetch_acled_events(+ runtime.fetcher,+ country=arguments.get("country"),+ days=arguments.get("days", 7),+ limit=arguments.get("limit", 100),+ )+++async def _ucdp_events(arguments: dict[str, Any]) -> Any:+ return await conflict.fetch_ucdp_events(+ runtime.fetcher,+ days=arguments.get("days", 30),+ limit=arguments.get("limit", 100),+ )+++async def _humanitarian_summary(arguments: dict[str, Any]) -> Any:+ return await conflict.fetch_humanitarian_summary(+ runtime.fetcher,+ country=arguments.get("country"),+ )+++async def _military_flights(arguments: dict[str, Any]) -> Any:+ return await military.fetch_military_flights(+ runtime.fetcher, bbox=arguments.get("bbox")+ )+++async def _theater_posture(arguments: dict[str, Any]) -> Any:+ return await military.fetch_theater_posture(runtime.fetcher)+++async def _aircraft_details(arguments: dict[str, Any]) -> Any:+ return await military.fetch_aircraft_details(+ runtime.fetcher, icao24=arguments["icao24"]+ )+++async def _aircraft_batch(arguments: dict[str, Any]) -> Any:+ return await military.fetch_aircraft_details_batch(+ runtime.fetcher,+ icao24_list=arguments["icao24_list"],+ )+++async def _nuclear_monitor(arguments: dict[str, Any]) -> Any:+ return await nuclear.fetch_nuclear_monitor(+ runtime.fetcher,+ hours=arguments.get("hours", 72),+ )+++async def _usni_fleet(arguments: dict[str, Any]) -> Any:+ return await usni_fleet.fetch_usni_fleet(runtime.fetcher)+++HANDLERS = {+ "intel_acled_events": _acled_events,+ "intel_ucdp_events": _ucdp_events,+ "intel_humanitarian_summary": _humanitarian_summary,+ "intel_military_flights": _military_flights,+ "intel_theater_posture": _theater_posture,+ "intel_aircraft_details": _aircraft_details,+ "intel_aircraft_batch": _aircraft_batch,+ "intel_nuclear_monitor": _nuclear_monitor,+ "intel_usni_fleet": _usni_fleet,+}diff --git a/src/world_intel_mcp/tools/finance.py b/src/world_intel_mcp/tools/finance.pynew file mode 100644index 0000000..9b552ff--- /dev/null+++ b/src/world_intel_mcp/tools/finance.py@@ -0,0 +1,301 @@+"""Business-finance tools: forex, bonds and yields, earnings,+SEC filings, company enrichment, macro composite.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime++TOOLS: list[Tool] = [+ # --- Forex (3 tools) ---+ Tool(+ name="intel_forex_rates",+ description="Get latest foreign exchange rates from ECB via Frankfurter API. Optional: base currency (default USD), target symbols list.",+ inputSchema={+ "type": "object",+ "properties": {+ "base": {+ "type": "string",+ "description": "Base currency code (default: USD)",+ "default": "USD",+ },+ "symbols": {+ "type": "array",+ "items": {"type": "string"},+ "description": "Target currency codes (e.g., ['EUR', 'GBP', 'JPY'])",+ },+ },+ },+ ),+ Tool(+ name="intel_forex_timeseries",+ description="Get historical FX rate timeseries with trend analysis. Optional: base, symbol, days.",+ inputSchema={+ "type": "object",+ "properties": {+ "base": {+ "type": "string",+ "description": "Base currency (default: USD)",+ "default": "USD",+ },+ "symbol": {+ "type": "string",+ "description": "Target currency (default: EUR)",+ "default": "EUR",+ },+ "days": {+ "type": "integer",+ "description": "Number of days of history (default: 30)",+ "default": 30,+ },+ },+ },+ ),+ Tool(+ name="intel_major_crosses",+ description="Get all 8 major FX currency pairs (EUR/USD, USD/JPY, GBP/USD, etc.) with cross rates and DXY proxy.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Bonds & Yields (2 tools) ---+ Tool(+ name="intel_yield_curve",+ description="Get US Treasury yield curve (2Y-30Y maturities), 2s10s and 3m10y spreads, and inversion detection. Uses FRED or Yahoo Finance fallback.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_bond_indices",+ description="Get major bond ETF prices and performance: AGG (total bond), TLT (20Y+ Treasury), HYG (high yield), LQD (investment grade), TIP (TIPS).",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Earnings (2 tools) ---+ Tool(+ name="intel_earnings_calendar",+ description="Get upcoming earnings announcements for top 20 mega-cap stocks (AAPL, MSFT, GOOGL, etc.) with EPS estimates and days until report.",+ inputSchema={+ "type": "object",+ "properties": {+ "days_ahead": {+ "type": "integer",+ "description": "Days to look ahead for 'this_week' filter (default: 7)",+ "default": 7,+ },+ },+ },+ ),+ Tool(+ name="intel_earnings_surprise",+ description="Get recent earnings surprises for a specific stock — past quarter actual vs estimate, surprise %, and forward estimates.",+ inputSchema={+ "type": "object",+ "properties": {+ "symbol": {+ "type": "string",+ "description": "Stock ticker symbol (e.g., 'AAPL')",+ },+ },+ "required": ["symbol"],+ },+ ),+ # --- SEC Filings (3 tools) ---+ Tool(+ name="intel_sec_filings",+ description="Search SEC EDGAR filings via full-text search. Filter by form type (10-K, 10-Q, 8-K) and date range.",+ inputSchema={+ "type": "object",+ "properties": {+ "query": {+ "type": "string",+ "description": "Search query (company name, keyword, etc.)",+ },+ "form_type": {+ "type": "string",+ "description": "Comma-separated form types (e.g., '10-K,10-Q,8-K')",+ },+ "date_range": {+ "type": "string",+ "description": "Date range as 'YYYY-MM-DD,YYYY-MM-DD' (default: last 30 days)",+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default: 25, max: 100)",+ "default": 25,+ },+ },+ },+ ),+ Tool(+ name="intel_company_filings",+ description="Get recent SEC filings for a company by ticker symbol (10-K, 10-Q, 8-K). Resolves ticker to CIK automatically.",+ inputSchema={+ "type": "object",+ "properties": {+ "ticker": {+ "type": "string",+ "description": "Stock ticker symbol (e.g., 'AAPL')",+ },+ "form_types": {+ "type": "array",+ "items": {"type": "string"},+ "description": "Form types to include (default: ['10-K', '10-Q', '8-K'])",+ },+ "limit": {+ "type": "integer",+ "description": "Max filings (default: 10)",+ "default": 10,+ },+ },+ "required": ["ticker"],+ },+ ),+ Tool(+ name="intel_recent_8k",+ description="Get most recent 8-K filings (material corporate events: M&A, executive changes, earnings releases) across all companies.",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Max filings (default: 25, max: 100)",+ "default": 25,+ },+ },+ },+ ),+ # --- Company Enrichment (1 tool) ---+ Tool(+ name="intel_company_profile",+ description="Get comprehensive company profile: stock quote, financials, sector/industry, recent news, SEC filings, and GitHub repos (for tech companies). Accepts ticker or company name.",+ inputSchema={+ "type": "object",+ "properties": {+ "query": {+ "type": "string",+ "description": "Ticker symbol (e.g., 'AAPL') or company name",+ },+ },+ "required": ["query"],+ },+ ),+ # --- Macro Composite (1 tool) ---+ Tool(+ name="intel_macro_composite",+ description="Get weighted macro market composite score (0-100) synthesizing Fear & Greed, VIX, sector breadth, DXY, BTC technicals, and 10Y yield into an actionable verdict (RISK_ON / CONSTRUCTIVE / NEUTRAL / CAUTIOUS / STRONG_CAUTION).",+ inputSchema={"type": "object", "properties": {}},+ ),+]+++async def _forex_rates(arguments: dict[str, Any]) -> Any:+ from ..sources.forex import fetch_forex_rates++ return await fetch_forex_rates(+ runtime.fetcher,+ base=arguments.get("base", "USD"),+ symbols=arguments.get("symbols"),+ )+++async def _forex_timeseries(arguments: dict[str, Any]) -> Any:+ from ..sources.forex import fetch_forex_timeseries++ return await fetch_forex_timeseries(+ runtime.fetcher,+ base=arguments.get("base", "USD"),+ symbol=arguments.get("symbol", "EUR"),+ days=arguments.get("days", 30),+ )+++async def _major_crosses(arguments: dict[str, Any]) -> Any:+ from ..sources.forex import fetch_major_crosses++ return await fetch_major_crosses(runtime.fetcher)+++async def _yield_curve(arguments: dict[str, Any]) -> Any:+ from ..sources.bonds import fetch_yield_curve++ return await fetch_yield_curve(runtime.fetcher)+++async def _bond_indices(arguments: dict[str, Any]) -> Any:+ from ..sources.bonds import fetch_bond_indices++ return await fetch_bond_indices(runtime.fetcher)+++async def _earnings_calendar(arguments: dict[str, Any]) -> Any:+ from ..sources.earnings import fetch_earnings_calendar++ return await fetch_earnings_calendar(+ runtime.fetcher, days_ahead=arguments.get("days_ahead", 7)+ )+++async def _earnings_surprise(arguments: dict[str, Any]) -> Any:+ from ..sources.earnings import fetch_earnings_surprise++ return await fetch_earnings_surprise(runtime.fetcher, symbol=arguments["symbol"])+++async def _sec_filings(arguments: dict[str, Any]) -> Any:+ from ..sources.sec_edgar import fetch_sec_filings++ return await fetch_sec_filings(+ runtime.fetcher,+ query=arguments.get("query"),+ form_type=arguments.get("form_type"),+ date_range=arguments.get("date_range"),+ limit=arguments.get("limit", 25),+ )+++async def _company_filings(arguments: dict[str, Any]) -> Any:+ from ..sources.sec_edgar import fetch_company_filings++ return await fetch_company_filings(+ runtime.fetcher,+ ticker=arguments["ticker"],+ form_types=arguments.get("form_types"),+ limit=arguments.get("limit", 10),+ )+++async def _recent_8k(arguments: dict[str, Any]) -> Any:+ from ..sources.sec_edgar import fetch_recent_8k++ return await fetch_recent_8k(runtime.fetcher, limit=arguments.get("limit", 25))+++async def _company_profile(arguments: dict[str, Any]) -> Any:+ from ..analysis.company import fetch_company_profile++ return await fetch_company_profile(runtime.fetcher, query=arguments["query"])+++async def _macro_composite(arguments: dict[str, Any]) -> Any:+ from ..analysis.macro_composite import fetch_macro_composite++ return await fetch_macro_composite(runtime.fetcher)+++HANDLERS = {+ "intel_forex_rates": _forex_rates,+ "intel_forex_timeseries": _forex_timeseries,+ "intel_major_crosses": _major_crosses,+ "intel_yield_curve": _yield_curve,+ "intel_bond_indices": _bond_indices,+ "intel_earnings_calendar": _earnings_calendar,+ "intel_earnings_surprise": _earnings_surprise,+ "intel_sec_filings": _sec_filings,+ "intel_company_filings": _company_filings,+ "intel_recent_8k": _recent_8k,+ "intel_company_profile": _company_profile,+ "intel_macro_composite": _macro_composite,+}diff --git a/src/world_intel_mcp/tools/geospatial.py b/src/world_intel_mcp/tools/geospatial.pynew file mode 100644index 0000000..d2f7d6d--- /dev/null+++ b/src/world_intel_mcp/tools/geospatial.py@@ -0,0 +1,384 @@+"""Static geospatial dataset tools: military bases, strategic+ports, pipelines, nuclear facilities, undersea cables, AI datacenters,+spaceports, critical minerals, stock exchanges, trade routes, cloud+regions, financial centers.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from ..sources import geospatial++TOOLS: list[Tool] = [+ # --- Geospatial Datasets (4 tools) ---+ Tool(+ name="intel_military_bases",+ description="Query 120+ military bases worldwide from 9 operators (USA, Russia, China, UK, France, NATO, India, Turkey, Israel, Iran, UAE). Filterable by operator, host country, base type, branch.",+ inputSchema={+ "type": "object",+ "properties": {+ "operator": {+ "type": "string",+ "description": "Filter by operating country (USA, RUS, CHN, GBR, FRA, NATO, IND, TUR, ISR, IRN, ARE)",+ },+ "country": {+ "type": "string",+ "description": "Filter by host country name or ISO-3 code",+ },+ "base_type": {+ "type": "string",+ "description": "Filter by type: air_base, naval_base, army_base, marine_base, training, space_base, missile_defense, expeditionary",+ },+ "branch": {+ "type": "string",+ "description": "Filter by branch (USAF, US Navy, PLA Navy, RAF, etc.)",+ },+ },+ },+ ),+ Tool(+ name="intel_strategic_ports",+ description="Query 40+ strategic ports worldwide: container mega-ports, oil/LNG terminals, naval bases, bulk ports. Filterable by type and country.",+ inputSchema={+ "type": "object",+ "properties": {+ "port_type": {+ "type": "string",+ "description": "Filter by type: container, oil, lng, naval, bulk, mixed",+ },+ "country": {+ "type": "string",+ "description": "Filter by country name or ISO-3 code",+ },+ },+ },+ ),+ Tool(+ name="intel_pipelines",+ description="Query 25+ strategic oil, gas, and hydrogen pipelines with routes, capacity, and status. Includes Nord Stream, Druzhba, Power of Siberia, BTC, TAPS, etc.",+ inputSchema={+ "type": "object",+ "properties": {+ "pipeline_type": {+ "type": "string",+ "description": "Filter by type: oil, gas, hydrogen",+ },+ "status": {+ "type": "string",+ "description": "Filter by status: active, destroyed, proposed, stalled, reduced, cancelled, construction, intermittent, terminated",+ },+ },+ },+ ),+ Tool(+ name="intel_nuclear_facilities",+ description="Query 25+ nuclear power plants, enrichment sites, research reactors, and reprocessing facilities worldwide. Includes Zaporizhzhia, Natanz, Fordow, Yongbyon, etc.",+ inputSchema={+ "type": "object",+ "properties": {+ "facility_type": {+ "type": "string",+ "description": "Filter by type: power, enrichment, research, reprocessing, decommissioned",+ },+ "country": {+ "type": "string",+ "description": "Filter by country name or ISO-3 code",+ },+ "status": {+ "type": "string",+ "description": "Filter by status: operational, construction, shutdown, occupied, commissioning, decommissioning, exclusion_zone",+ },+ },+ },+ ),+ # --- Extended Geospatial (5 tools) ---+ Tool(+ name="intel_undersea_cables",+ description="Query 30+ undersea fiber-optic cable routes with landing points, owners, capacity (Tbps), and length (km). Filterable by status, country, owner, min capacity.",+ inputSchema={+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "description": "Filter by status: active, planned, construction, decommissioned",+ },+ "country": {+ "type": "string",+ "description": "Filter by country in landing points",+ },+ "owner": {+ "type": "string",+ "description": "Filter by cable owner (Google, Meta, Microsoft, etc.)",+ },+ "min_capacity_tbps": {+ "type": "number",+ "description": "Minimum cable capacity in Tbps",+ },+ },+ },+ ),+ Tool(+ name="intel_ai_datacenters",+ description="Query 48+ AI datacenter clusters worldwide with power capacity (MW), operators, and locations. Covers hyperscalers and sovereign AI.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "Filter by country name or ISO-3 code",+ },+ "operator": {+ "type": "string",+ "description": "Filter by operator (AWS, Google, Microsoft, Meta, etc.)",+ },+ "min_power_mw": {+ "type": "integer",+ "description": "Minimum power capacity in MW",+ },+ "region": {+ "type": "string",+ "description": "Filter by region (North America, Europe, Asia-Pacific, etc.)",+ },+ },+ },+ ),+ Tool(+ name="intel_spaceports",+ description="Query 27+ launch facilities and spaceports worldwide. Filterable by country, status, type (orbital/suborbital), and operator.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "Filter by country name or ISO-3 code",+ },+ "status": {+ "type": "string",+ "description": "Filter by status: active, limited, planned, decommissioned",+ },+ "spaceport_type": {+ "type": "string",+ "description": "Filter by type: orbital, suborbital",+ },+ "operator": {+ "type": "string",+ "description": "Filter by operator (SpaceX, NASA, CNSA, Roscosmos, etc.)",+ },+ },+ },+ ),+ Tool(+ name="intel_critical_minerals",+ description="Query 28+ critical mineral deposits worldwide: lithium, cobalt, rare earths, nickel, copper, graphite, manganese, PGM, tungsten, uranium, tin, gallium, germanium.",+ inputSchema={+ "type": "object",+ "properties": {+ "mineral": {+ "type": "string",+ "description": "Filter by mineral (lithium, cobalt, rare_earths, nickel, copper, graphite, manganese, platinum_group, tungsten, uranium, tin, gallium, germanium)",+ },+ "country": {+ "type": "string",+ "description": "Filter by country name or ISO-3 code",+ },+ "mineral_type": {+ "type": "string",+ "description": "Filter by type: battery, electronic, structural, energy, industrial, strategic",+ },+ "operator": {"type": "string", "description": "Filter by operator"},+ },+ },+ ),+ Tool(+ name="intel_stock_exchanges",+ description="Query 80+ stock exchanges across 4 tiers (mega >$3T, major, emerging, frontier) with market cap, index tickers, currencies, timezones.",+ inputSchema={+ "type": "object",+ "properties": {+ "tier": {+ "type": "string",+ "description": "Filter by tier: mega, major, emerging, frontier",+ },+ "country": {+ "type": "string",+ "description": "Filter by country name or ISO-3 code",+ },+ "currency": {+ "type": "string",+ "description": "Filter by currency (USD, EUR, GBP, JPY, CNY, etc.)",+ },+ },+ },+ ),+ # --- Trade Routes (1 tool) ---+ Tool(+ name="intel_trade_routes",+ description="19 critical maritime chokepoints and trade routes with oil flow (mbd), daily vessel transits, trade value share. Optional: route_type (chokepoint/canal/route), country (ISO-3).",+ inputSchema={+ "type": "object",+ "properties": {+ "route_type": {+ "type": "string",+ "description": "Filter: chokepoint, canal, route",+ },+ "country": {+ "type": "string",+ "description": "Filter by ISO-3 country code",+ },+ },+ },+ ),+ # --- Cloud Regions (1 tool) ---+ Tool(+ name="intel_cloud_regions",+ description="28 major cloud provider regions (AWS, Azure, GCP) with coordinates, zone counts, and launch dates. Optional: provider, country.",+ inputSchema={+ "type": "object",+ "properties": {+ "provider": {+ "type": "string",+ "description": "Filter: AWS, Azure, GCP",+ },+ "country": {+ "type": "string",+ "description": "Filter by region name substring",+ },+ },+ },+ ),+ # --- Financial Centers (1 tool) ---+ Tool(+ name="intel_financial_centers",+ description="GFCI top 20 global financial centers with rankings, ratings, specializations, and exchange info. Optional: country (ISO-3), min_rank.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "Filter by ISO-3 country code",+ },+ "min_rank": {+ "type": "integer",+ "description": "Only include centers ranked this or better",+ },+ },+ },+ ),+]+++async def _military_bases(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_military_bases(+ operator=arguments.get("operator"),+ country=arguments.get("country"),+ base_type=arguments.get("base_type"),+ branch=arguments.get("branch"),+ )+++async def _strategic_ports(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_strategic_ports(+ port_type=arguments.get("port_type"),+ country=arguments.get("country"),+ )+++async def _pipelines(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_pipelines(+ pipeline_type=arguments.get("pipeline_type"),+ status=arguments.get("status"),+ )+++async def _nuclear_facilities(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_nuclear_facilities(+ facility_type=arguments.get("facility_type"),+ country=arguments.get("country"),+ status=arguments.get("status"),+ )+++async def _undersea_cables(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_undersea_cables(+ status=arguments.get("status"),+ country=arguments.get("country"),+ owner=arguments.get("owner"),+ min_capacity_tbps=arguments.get("min_capacity_tbps"),+ )+++async def _ai_datacenters(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_ai_datacenters(+ country=arguments.get("country"),+ operator=arguments.get("operator"),+ min_power_mw=arguments.get("min_power_mw"),+ region=arguments.get("region"),+ )+++async def _spaceports(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_spaceports(+ country=arguments.get("country"),+ status=arguments.get("status"),+ spaceport_type=arguments.get("spaceport_type"),+ operator=arguments.get("operator"),+ )+++async def _critical_minerals(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_critical_minerals(+ mineral=arguments.get("mineral"),+ country=arguments.get("country"),+ mineral_type=arguments.get("mineral_type"),+ operator=arguments.get("operator"),+ )+++async def _stock_exchanges(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_stock_exchanges(+ tier=arguments.get("tier"),+ country=arguments.get("country"),+ currency=arguments.get("currency"),+ )+++async def _trade_routes(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_trade_routes(+ route_type=arguments.get("route_type"),+ country=arguments.get("country"),+ )+++async def _cloud_regions(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_cloud_regions(+ provider=arguments.get("provider"),+ country=arguments.get("country"),+ )+++async def _financial_centers(arguments: dict[str, Any]) -> Any:+ return await geospatial.fetch_financial_centers(+ country=arguments.get("country"),+ min_rank=arguments.get("min_rank"),+ )+++HANDLERS = {+ "intel_military_bases": _military_bases,+ "intel_strategic_ports": _strategic_ports,+ "intel_pipelines": _pipelines,+ "intel_nuclear_facilities": _nuclear_facilities,+ "intel_undersea_cables": _undersea_cables,+ "intel_ai_datacenters": _ai_datacenters,+ "intel_spaceports": _spaceports,+ "intel_critical_minerals": _critical_minerals,+ "intel_stock_exchanges": _stock_exchanges,+ "intel_trade_routes": _trade_routes,+ "intel_cloud_regions": _cloud_regions,+ "intel_financial_centers": _financial_centers,+}diff --git a/src/world_intel_mcp/tools/hazards.py b/src/world_intel_mcp/tools/hazards.pynew file mode 100644index 0000000..00af22a--- /dev/null+++ b/src/world_intel_mcp/tools/hazards.py@@ -0,0 +1,271 @@+"""Natural-hazard and space-domain tools: earthquakes,+wildfires, climate anomalies, space weather, environmental events,+disaster alerts, severe weather, rocket launches, volcanoes, cyclones.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime+from ..sources import (+ seismology,+ wildfire,+ climate,+ space_weather,+ environmental,+ weather,+ launches,+ volcano,+ cyclones,+)++TOOLS: list[Tool] = [+ # --- Natural (2 tools) ---+ Tool(+ name="intel_earthquakes",+ description="Get recent earthquakes from USGS. No API key needed.",+ inputSchema={+ "type": "object",+ "properties": {+ "min_magnitude": {+ "type": "number",+ "description": "Minimum magnitude (default 4.5)",+ "default": 4.5,+ },+ "hours": {+ "type": "integer",+ "description": "Lookback hours (default 24)",+ "default": 24,+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default 50)",+ "default": 50,+ },+ },+ },+ ),+ Tool(+ name="intel_wildfires",+ description="Get active wildfires from NASA FIRMS (9 global regions). Requires NASA_FIRMS_API_KEY.",+ inputSchema={+ "type": "object",+ "properties": {+ "region": {+ "type": "string",+ "description": "Specific region (north_america, europe, etc.) or omit for all 9",+ "enum": [+ "north_america",+ "south_america",+ "europe",+ "africa",+ "middle_east",+ "south_asia",+ "east_asia",+ "southeast_asia",+ "oceania",+ ],+ },+ },+ },+ ),+ # --- Climate (1 tool) ---+ Tool(+ name="intel_climate_anomalies",+ description="Detect temperature and precipitation anomalies across 15 global climate zones (vs. prior year baseline).",+ inputSchema={+ "type": "object",+ "properties": {+ "zones": {+ "type": "array",+ "items": {"type": "string"},+ "description": "Zone keys to check (default: all 15)",+ },+ },+ },+ ),+ # --- Space Weather (1 tool) ---+ Tool(+ name="intel_space_weather",+ description="Get solar activity: Kp geomagnetic index, X-ray flare class, solar wind, and SWPC alerts from NOAA.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Environmental (2 tools) ---+ Tool(+ name="intel_environmental_events",+ description="Natural events from NASA EONET: wildfires, severe storms, volcanoes, floods, icebergs, drought. Includes geolocation and source links.",+ inputSchema={+ "type": "object",+ "properties": {+ "days": {+ "type": "integer",+ "description": "Look back N days (default 30)",+ "default": 30,+ },+ "category": {+ "type": "string",+ "description": "Filter by category: wildfires, severeStorms, volcanoes, floods, earthquakes, drought, seaLakeIce",+ },+ "limit": {+ "type": "integer",+ "description": "Max events (default 50)",+ "default": 50,+ },+ },+ },+ ),+ Tool(+ name="intel_disaster_alerts",+ description="Global disaster alerts from GDACS (UN): earthquakes, floods, cyclones, droughts, wildfires. Severity levels (green/orange/red) with affected populations.",+ inputSchema={+ "type": "object",+ "properties": {+ "alert_level": {+ "type": "string",+ "description": "Filter by level: green, orange, red",+ },+ "event_type": {+ "type": "string",+ "description": "Filter by type: EQ, FL, TC, DR, WF, VO",+ },+ "limit": {+ "type": "integer",+ "description": "Max alerts (default 30)",+ "default": 30,+ },+ },+ },+ ),+ # --- Hazard & Space Domains (4 tools, Phase 25) ---+ Tool(+ name="intel_weather_alerts",+ description="Get active severe weather alerts (CAP) from the US National Weather Service: event, severity, urgency, headline, affected area, effective/expires times. US coverage only - there is no global feed. Lat/lon present only for polygon-based alerts (zone-based alerts return null coordinates rather than fabricated ones). No API key needed. Optional: area (two-letter US state code), severity (Extreme, Severe, Moderate, Minor, Unknown), limit (default 50, applied client-side).",+ inputSchema={+ "type": "object",+ "properties": {+ "area": {+ "type": "string",+ "description": "Two-letter US state/territory code (e.g. TX)",+ },+ "severity": {+ "type": "string",+ "description": "Filter: Extreme, Severe, Moderate, Minor, or Unknown",+ },+ "limit": {+ "type": "integer",+ "description": "Max alerts (default 50, applied client-side)",+ "default": 50,+ },+ },+ },+ ),+ Tool(+ name="intel_launch_schedule",+ description="Get upcoming rocket launches from Launch Library 2: name, provider, vehicle, pad with coordinates, launch time (NET), status, mission description. The free tier allows ~15 requests/hour, so results are cached for an hour; recently launched missions may appear with their final status. No API key needed. Optional: limit (default 20).",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Max launches (default 20)",+ "default": 20,+ },+ },+ },+ ),+ Tool(+ name="intel_volcano_activity",+ description="Get the Smithsonian GVP / USGS Weekly Volcanic Activity Report: volcano name, country, coordinates, activity status (new vs continuing), and summary. Updated weekly (Thursdays); a curated summary of activity meeting GVP reporting criteria, not a comprehensive eruption list. No API key needed.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_cyclones",+ description="Get active tropical cyclones from the US National Hurricane Center: name, classification, intensity (knots), pressure (mb), position, movement, by-basin grouping. Covers the Atlantic, Eastern and Central Pacific basins only - Western Pacific / Indian Ocean storms (JTWC) are not included. Zero storms means a quiet tropics, not an outage; a fetch failure carries an explicit error. No API key needed.",+ inputSchema={"type": "object", "properties": {}},+ ),+]+++async def _earthquakes(arguments: dict[str, Any]) -> Any:+ return await seismology.fetch_earthquakes(+ runtime.fetcher,+ min_magnitude=arguments.get("min_magnitude", 4.5),+ hours=arguments.get("hours", 24),+ limit=arguments.get("limit", 50),+ )+++async def _wildfires(arguments: dict[str, Any]) -> Any:+ return await wildfire.fetch_wildfires(+ runtime.fetcher, region=arguments.get("region")+ )+++async def _climate_anomalies(arguments: dict[str, Any]) -> Any:+ return await climate.fetch_climate_anomalies(+ runtime.fetcher, zones=arguments.get("zones")+ )+++async def _space_weather(arguments: dict[str, Any]) -> Any:+ return await space_weather.fetch_space_weather(runtime.fetcher)+++async def _environmental_events(arguments: dict[str, Any]) -> Any:+ return await environmental.fetch_environmental_events(+ runtime.fetcher,+ days=arguments.get("days", 30),+ category=arguments.get("category"),+ limit=arguments.get("limit", 50),+ )+++async def _disaster_alerts(arguments: dict[str, Any]) -> Any:+ return await environmental.fetch_disaster_alerts(+ runtime.fetcher,+ alert_level=arguments.get("alert_level"),+ event_type=arguments.get("event_type"),+ limit=arguments.get("limit", 30),+ )+++async def _weather_alerts(arguments: dict[str, Any]) -> Any:+ return await weather.fetch_weather_alerts(+ runtime.fetcher,+ area=arguments.get("area"),+ severity=arguments.get("severity"),+ limit=arguments.get("limit", 50),+ )+++async def _launch_schedule(arguments: dict[str, Any]) -> Any:+ return await launches.fetch_launch_schedule(+ runtime.fetcher, limit=arguments.get("limit", 20)+ )+++async def _volcano_activity(arguments: dict[str, Any]) -> Any:+ return await volcano.fetch_volcano_activity(runtime.fetcher)+++async def _cyclones(arguments: dict[str, Any]) -> Any:+ return await cyclones.fetch_cyclones(runtime.fetcher)+++HANDLERS = {+ "intel_earthquakes": _earthquakes,+ "intel_wildfires": _wildfires,+ "intel_climate_anomalies": _climate_anomalies,+ "intel_space_weather": _space_weather,+ "intel_environmental_events": _environmental_events,+ "intel_disaster_alerts": _disaster_alerts,+ "intel_weather_alerts": _weather_alerts,+ "intel_launch_schedule": _launch_schedule,+ "intel_volcano_activity": _volcano_activity,+ "intel_cyclones": _cyclones,+}diff --git a/src/world_intel_mcp/tools/infrastructure.py b/src/world_intel_mcp/tools/infrastructure.pynew file mode 100644index 0000000..28f6897--- /dev/null+++ b/src/world_intel_mcp/tools/infrastructure.py@@ -0,0 +1,182 @@+"""Infrastructure and transport tools: internet outages,+undersea cable health, navigational warnings, airport delays, global+air traffic, road traffic, webcams, shipping stress, cloud service+status.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime+from ..sources import (+ infrastructure,+ maritime,+ aviation,+ shipping,+ service_status,+)++TOOLS: list[Tool] = [+ # --- Infrastructure (2 tools) ---+ Tool(+ name="intel_internet_outages",+ description="Get internet outages from Cloudflare Radar (last 7 days). Optional: CLOUDFLARE_API_TOKEN for higher limits.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_cable_health",+ description="Assess undersea cable corridor health from NGA navigational warnings. 6 corridors scored 0-3.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Maritime (1 tool) ---+ Tool(+ name="intel_nav_warnings",+ description="Get active navigational warnings from NGA Maritime Safety. Optional: navarea (I-XVI).",+ inputSchema={+ "type": "object",+ "properties": {+ "navarea": {+ "type": "string",+ "description": "NAVAREA number (e.g., IV, XII)",+ },+ },+ },+ ),+ # --- Aviation (1 tool) ---+ Tool(+ name="intel_airport_delays",+ description="Get current US airport delays from FAA (20 major airports). No API key needed.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Aviation domestic (1 tool) ---+ Tool(+ name="intel_aviation_domestic",+ description="Global air traffic snapshot from OpenSky Network: total airborne aircraft, regional breakdown, busiest origin countries, and sampled positions for mapping.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Traffic (2 tools) ---+ Tool(+ name="intel_traffic_flow",+ description="Real-time traffic congestion for 20 major world cities via TomTom API. Congestion percentage, speeds, global average. Requires TOMTOM_API_KEY.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_traffic_incidents",+ description="Major traffic incidents across 5 strategic regions (US East/West, Europe, Middle East, East Asia) via TomTom API. Requires TOMTOM_API_KEY.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Webcams (1 tool) ---+ Tool(+ name="intel_webcams",+ description="Public webcam locations and live previews worldwide from Windy Webcams API. Filter by category (traffic, weather, landscape). Requires WINDY_API_KEY.",+ inputSchema={+ "type": "object",+ "properties": {+ "category": {+ "type": "string",+ "description": "Webcam category (traffic, weather, landscape, etc.)",+ "default": "traffic",+ },+ "limit": {+ "type": "integer",+ "description": "Max cameras to return (default 50)",+ "default": 50,+ },+ },+ },+ ),+ # --- Shipping (1 tool) ---+ Tool(+ name="intel_shipping_index",+ description="Compute shipping stress index from dry bulk ETFs (BDRY, SBLK, EGLE, ZIM). Stress score 0-100.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Service Status (1 tool) ---+ Tool(+ name="intel_service_status",+ description="Monitor cloud service provider status (AWS, Azure, GCP, Cloudflare, GitHub). Shows active incidents and recent outages. Optional: provider (aws/azure/gcp/cloudflare/github).",+ inputSchema={+ "type": "object",+ "properties": {+ "provider": {+ "type": "string",+ "description": "Filter by provider (aws, azure, gcp, cloudflare, github)",+ },+ },+ },+ ),+]+++async def _internet_outages(arguments: dict[str, Any]) -> Any:+ return await infrastructure.fetch_internet_outages(runtime.fetcher)+++async def _cable_health(arguments: dict[str, Any]) -> Any:+ return await infrastructure.fetch_cable_health(runtime.fetcher)+++async def _nav_warnings(arguments: dict[str, Any]) -> Any:+ return await maritime.fetch_nav_warnings(+ runtime.fetcher, navarea=arguments.get("navarea")+ )+++async def _airport_delays(arguments: dict[str, Any]) -> Any:+ return await aviation.fetch_airport_delays(runtime.fetcher)+++async def _aviation_domestic(arguments: dict[str, Any]) -> Any:+ return await aviation.fetch_domestic_flights(runtime.fetcher)+++async def _traffic_flow(arguments: dict[str, Any]) -> Any:+ from ..sources.traffic import fetch_traffic_flow++ return await fetch_traffic_flow(runtime.fetcher)+++async def _traffic_incidents(arguments: dict[str, Any]) -> Any:+ from ..sources.traffic import fetch_traffic_incidents++ return await fetch_traffic_incidents(runtime.fetcher)+++async def _webcams(arguments: dict[str, Any]) -> Any:+ from ..sources.webcams import fetch_webcams++ return await fetch_webcams(+ runtime.fetcher,+ category=arguments.get("category", "traffic"),+ limit=arguments.get("limit", 50),+ )+++async def _shipping_index(arguments: dict[str, Any]) -> Any:+ return await shipping.fetch_shipping_index(runtime.fetcher)+++async def _service_status(arguments: dict[str, Any]) -> Any:+ return await service_status.fetch_service_status(+ runtime.fetcher,+ provider=arguments.get("provider"),+ )+++HANDLERS = {+ "intel_internet_outages": _internet_outages,+ "intel_cable_health": _cable_health,+ "intel_nav_warnings": _nav_warnings,+ "intel_airport_delays": _airport_delays,+ "intel_aviation_domestic": _aviation_domestic,+ "intel_traffic_flow": _traffic_flow,+ "intel_traffic_incidents": _traffic_incidents,+ "intel_webcams": _webcams,+ "intel_shipping_index": _shipping_index,+ "intel_service_status": _service_status,+}diff --git a/src/world_intel_mcp/tools/intelligence.py b/src/world_intel_mcp/tools/intelligence.pynew file mode 100644index 0000000..d87aca8--- /dev/null+++ b/src/world_intel_mcp/tools/intelligence.py@@ -0,0 +1,293 @@+"""Intelligence-analysis tools: country briefs and dossiers,+risk and instability scoring, signal convergence and summaries,+temporal anomalies, unrest, hotspot escalation, military surge, vessel+snapshot, cascade analysis, alert digest, weekly trends.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime+from ..sources import intelligence++TOOLS: list[Tool] = [+ # --- Intelligence (13 tools) ---+ Tool(+ name="intel_country_brief",+ description="Generate a country intelligence brief using Ollama LLM + World Bank + ACLED data. Falls back to data-only if LLM unavailable.",+ inputSchema={+ "type": "object",+ "properties": {+ "country_code": {+ "type": "string",+ "description": "ISO country code (default: US)",+ "default": "US",+ },+ },+ },+ ),+ Tool(+ name="intel_country_dossier",+ description="Comprehensive country intelligence dossier: economy (GDP/inflation), stock market, elections, sanctions, news mentions, hotspots, and conflict zones. Aggregates 6 sources in parallel.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "ISO-2 or ISO-3 country code (e.g. US, USA, UA, UKR)",+ "default": "US",+ },+ },+ },+ ),+ Tool(+ name="intel_risk_scores",+ description="Get country risk scores computed from ACLED conflict data vs historical baselines. Requires ACLED_ACCESS_TOKEN.",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Top N countries (default 20)",+ "default": 20,+ },+ },+ },+ ),+ Tool(+ name="intel_instability_index",+ description="Compute Country Instability Index v2 (0-100) from 4 weighted domains: unrest, conflict, security, information. Applies country-specific multipliers and UCDP floors.",+ inputSchema={+ "type": "object",+ "properties": {+ "country_code": {+ "type": "string",+ "description": "ISO alpha-3 code (e.g., UKR). Omit for top-10 focus countries.",+ },+ },+ },+ ),+ Tool(+ name="intel_signal_convergence",+ description="Detect geographic convergence of multi-domain signals (earthquakes, conflict, military) in hotspot regions.",+ inputSchema={+ "type": "object",+ "properties": {+ "lat": {+ "type": "number",+ "description": "Center latitude (omit for 5 global hotspots)",+ },+ "lon": {"type": "number", "description": "Center longitude"},+ "radius_deg": {+ "type": "number",+ "description": "Radius in degrees (default 5.0)",+ "default": 5.0,+ },+ },+ },+ ),+ Tool(+ name="intel_focal_points",+ description="Detect focal points where multiple intelligence signals converge on the same entity (country, organization, leader). Cross-references news, military, protests, and infrastructure signals.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_signal_summary",+ description="Aggregate all intelligence signals by country with convergence scoring. Combines conflict, displacement, earthquakes, fires, outages, military, and protests.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "Country name filter (optional)",+ },+ },+ },+ ),+ Tool(+ name="intel_temporal_anomalies",+ description="Detect temporal anomalies — activity levels that deviate from historical baselines using Welford's algorithm. Reports z-score deviations like 'Military flights 3.2x normal for Thursday'.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_unrest_events",+ description="Get social unrest events (protests + riots) from ACLED with Haversine deduplication. Optional: country (name), days (default 7), limit (default 100).",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {"type": "string", "description": "Country name filter"},+ "days": {+ "type": "integer",+ "description": "Lookback days (default 7)",+ "default": 7,+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default 100)",+ "default": 100,+ },+ },+ },+ ),+ Tool(+ name="intel_hotspot_escalation",+ description="Dynamic escalation scores for 22 intel hotspots from baseline risk, military activity, and conflict signals (ACLED events near each hotspot). Each hotspot scored 0-100, renormalized over the signals actually measured. News-mention and geo-convergence components are not currently wired up and are reported as null (see unavailable_components), not a fabricated zero.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_military_surge",+ description="Detect military surge anomalies — foreign aircraft concentration above baselines in 8 sensitive regions (Persian Gulf, Taiwan Strait, Baltic Sea, etc.).",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_vessel_snapshot",+ description="Naval activity snapshot at 9 strategic waterways (Hormuz, Malacca, Suez, etc.) from NGA navigational warnings. Each waterway scored clear/advisory/elevated/critical.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_cascade_analysis",+ description="Simulate infrastructure cascade — 'what if cable corridor X is disrupted?' Impact scoring across dependent countries. Optional: corridor name (default: simulate at-risk corridors).",+ inputSchema={+ "type": "object",+ "properties": {+ "corridor": {+ "type": "string",+ "description": "Cable corridor to simulate (e.g., red_sea, transpacific, asia_europe)",+ "enum": [+ "transatlantic_north",+ "transatlantic_south",+ "asia_europe",+ "red_sea",+ "transpacific",+ "mediterranean",+ ],+ },+ },+ },+ ),+ # --- Alert Digest (1 tool) ---+ Tool(+ name="intel_alert_digest",+ description="Cross-domain alert aggregation from 7 intelligence sources: space weather, instability, military surge, cable health, hotspot escalation, internet outages, shipping stress. Threshold-based prioritized alerts.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Weekly Trends (1 tool) ---+ Tool(+ name="intel_weekly_trends",+ description="Analyze weekly trends from temporal baselines. Reports volatility (coefficient of variation) and current anomalies across all tracked metrics.",+ inputSchema={"type": "object", "properties": {}},+ ),+]+++async def _country_brief(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_country_brief(+ runtime.fetcher, country_code=arguments.get("country_code", "US")+ )+++async def _country_dossier(arguments: dict[str, Any]) -> Any:+ from ..analysis.dossier import fetch_country_dossier++ return await fetch_country_dossier(+ runtime.fetcher, country=arguments.get("country", "US")+ )+++async def _risk_scores(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_risk_scores(+ runtime.fetcher, limit=arguments.get("limit", 20)+ )+++async def _instability_index(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_instability_index(+ runtime.fetcher, country_code=arguments.get("country_code")+ )+++async def _signal_convergence(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_signal_convergence(+ runtime.fetcher,+ lat=arguments.get("lat"),+ lon=arguments.get("lon"),+ radius_deg=arguments.get("radius_deg", 5.0),+ )+++async def _focal_points(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_focal_points(runtime.fetcher)+++async def _signal_summary(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_signal_summary(+ runtime.fetcher, country=arguments.get("country")+ )+++async def _temporal_anomalies(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_temporal_anomalies(runtime.fetcher)+++async def _unrest_events(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_unrest_events(+ runtime.fetcher,+ country=arguments.get("country"),+ days=arguments.get("days", 7),+ limit=arguments.get("limit", 100),+ )+++async def _hotspot_escalation(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_hotspot_escalation(runtime.fetcher)+++async def _military_surge(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_military_surge(runtime.fetcher)+++async def _vessel_snapshot(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_vessel_snapshot(runtime.fetcher)+++async def _cascade_analysis(arguments: dict[str, Any]) -> Any:+ return await intelligence.fetch_cascade_analysis(+ runtime.fetcher,+ corridor=arguments.get("corridor"),+ )+++async def _alert_digest(arguments: dict[str, Any]) -> Any:+ from ..analysis.alerts import fetch_alert_digest++ return await fetch_alert_digest(runtime.fetcher)+++async def _weekly_trends(arguments: dict[str, Any]) -> Any:+ from ..analysis.alerts import fetch_weekly_trends++ return await fetch_weekly_trends(runtime.fetcher)+++HANDLERS = {+ "intel_country_brief": _country_brief,+ "intel_country_dossier": _country_dossier,+ "intel_risk_scores": _risk_scores,+ "intel_instability_index": _instability_index,+ "intel_signal_convergence": _signal_convergence,+ "intel_focal_points": _focal_points,+ "intel_signal_summary": _signal_summary,+ "intel_temporal_anomalies": _temporal_anomalies,+ "intel_unrest_events": _unrest_events,+ "intel_hotspot_escalation": _hotspot_escalation,+ "intel_military_surge": _military_surge,+ "intel_vessel_snapshot": _vessel_snapshot,+ "intel_cascade_analysis": _cascade_analysis,+ "intel_alert_digest": _alert_digest,+ "intel_weekly_trends": _weekly_trends,+}diff --git a/src/world_intel_mcp/tools/markets.py b/src/world_intel_mcp/tools/markets.pynew file mode 100644index 0000000..3a4d48c--- /dev/null+++ b/src/world_intel_mcp/tools/markets.py@@ -0,0 +1,272 @@+"""Market and economic tools: equities, crypto, commodities,+energy and consumer prices, FRED and World Bank series, country stock+indices, BTC technicals, central bank rates.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime+from ..sources import (+ markets,+ economic,+ central_banks,+)++TOOLS: list[Tool] = [+ # --- Markets (7 tools) ---+ Tool(+ name="intel_market_quotes",+ description="Get real-time stock market index quotes (S&P 500, Dow, Nasdaq, FTSE, Nikkei, etc.). Optional: symbols (list of ticker symbols).",+ inputSchema={+ "type": "object",+ "properties": {+ "symbols": {+ "type": "array",+ "items": {"type": "string"},+ "description": "Ticker symbols (default: major indices)",+ },+ },+ },+ ),+ Tool(+ name="intel_crypto_quotes",+ description="Get top cryptocurrency prices, market caps, and 7-day sparklines from CoinGecko. Optional: limit (int, default 20).",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Number of coins (default 20)",+ "default": 20,+ },+ },+ },+ ),+ Tool(+ name="intel_stablecoin_status",+ description="Check stablecoin peg health (USDT, USDC, DAI, FDUSD). Flags depegs >0.5%.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_etf_flows",+ description="Get Bitcoin spot ETF prices and volumes (IBIT, FBTC, GBTC, ARKB, BITB).",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_sector_heatmap",+ description="Get US equity sector performance heatmap (11 SPDR sector ETFs).",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_macro_signals",+ description="Get 7 key macro signals: Fear & Greed, mempool fees, DXY, VIX, gold, 10Y Treasury, BTC dominance.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_commodity_quotes",+ description="Get commodity futures quotes: gold, silver, crude oil (WTI & Brent), natural gas, corn, wheat, soybeans from Yahoo Finance.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Economic (6 tools) ---+ Tool(+ name="intel_gas_prices",+ description="Get today's US retail gasoline and diesel prices ($/gallon) from AAA — daily national averages for regular, mid-grade, premium, diesel, E85. Includes day-over-day, week, month, year deltas plus per-state prices. No API key required.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_residential_natgas",+ description="Get US residential natural gas prices ($/thousand cubic feet) — monthly average. Requires EIA_API_KEY.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_electricity_rates",+ description="Get US electricity retail rates (cents/kWh) by sector (residential, commercial, industrial). Optionally filter by state. Requires EIA_API_KEY.",+ inputSchema={+ "type": "object",+ "properties": {+ "state": {+ "type": "string",+ "description": "2-letter US state code (e.g., 'CA', 'TX'). Defaults to nationwide.",+ },+ },+ },+ ),+ Tool(+ name="intel_energy_prices",+ description="Get crude oil (Brent, WTI) and natural gas futures prices from EIA. Requires EIA_API_KEY.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_fred_series",+ description="Get Federal Reserve economic data series (GDP, UNRATE, CPIAUCSL, DFF, T10YIE, etc.). Requires FRED_API_KEY.",+ inputSchema={+ "type": "object",+ "properties": {+ "series_id": {+ "type": "string",+ "description": "FRED series ID (e.g., 'UNRATE')",+ },+ "limit": {+ "type": "integer",+ "description": "Number of observations",+ "default": 30,+ },+ },+ "required": ["series_id"],+ },+ ),+ Tool(+ name="intel_world_bank_indicators",+ description="Get World Bank development indicators (GDP, inflation, unemployment) for a country.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "ISO country code (default: USA)",+ "default": "USA",+ },+ "indicators": {+ "type": "array",+ "items": {"type": "string"},+ "description": "World Bank indicator codes",+ },+ },+ },+ ),+ # --- Markets Extended (1 tool) ---+ Tool(+ name="intel_country_stocks",+ description="Get real-time stock index quote for any country by ISO-3 code. Maps country to its primary exchange index ticker and fetches via Yahoo Finance.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "ISO-3 country code (USA, GBR, JPN, CHN, DEU, etc.)",+ "default": "USA",+ },+ },+ },+ ),+ # --- BTC Technicals (1 tool) ---+ Tool(+ name="intel_btc_technicals",+ description="Bitcoin technical indicators: SMA-50, SMA-200, Mayer Multiple, golden/death cross, distance from ATH, 7d/30d changes.",+ inputSchema={"type": "object", "properties": {}},+ ),+ # --- Central Banks (1 tool) ---+ Tool(+ name="intel_central_bank_rates",+ description="Policy rates for 15 major central banks: Fed, ECB, BoE, BoJ, PBoC, RBI, RBA, BoC, SNB, BCB, BoK, CBRT, SARB, Banxico, BI. Live FRED data when API key set, curated fallback otherwise.",+ inputSchema={"type": "object", "properties": {}},+ ),+]+++async def _market_quotes(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_market_quotes(+ runtime.fetcher, symbols=arguments.get("symbols")+ )+++async def _crypto_quotes(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_crypto_quotes(+ runtime.fetcher, limit=arguments.get("limit", 20)+ )+++async def _stablecoin_status(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_stablecoin_status(runtime.fetcher)+++async def _etf_flows(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_etf_flows(runtime.fetcher)+++async def _sector_heatmap(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_sector_heatmap(runtime.fetcher)+++async def _macro_signals(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_macro_signals(runtime.fetcher)+++async def _commodity_quotes(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_commodity_quotes(runtime.fetcher)+++async def _gas_prices(arguments: dict[str, Any]) -> Any:+ return await economic.fetch_gas_prices(runtime.fetcher)+++async def _residential_natgas(arguments: dict[str, Any]) -> Any:+ return await economic.fetch_residential_natgas_prices(runtime.fetcher)+++async def _electricity_rates(arguments: dict[str, Any]) -> Any:+ return await economic.fetch_electricity_rates(+ runtime.fetcher,+ state=arguments.get("state"),+ )+++async def _energy_prices(arguments: dict[str, Any]) -> Any:+ return await economic.fetch_energy_prices(runtime.fetcher)+++async def _fred_series(arguments: dict[str, Any]) -> Any:+ return await economic.fetch_fred_series(+ runtime.fetcher,+ series_id=arguments["series_id"],+ limit=arguments.get("limit", 30),+ )+++async def _world_bank_indicators(arguments: dict[str, Any]) -> Any:+ return await economic.fetch_world_bank_indicators(+ runtime.fetcher,+ country=arguments.get("country", "USA"),+ indicators=arguments.get("indicators"),+ )+++async def _country_stocks(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_country_stocks(+ runtime.fetcher,+ country=arguments.get("country", "USA"),+ )+++async def _btc_technicals(arguments: dict[str, Any]) -> Any:+ return await markets.fetch_btc_technicals(runtime.fetcher)+++async def _central_bank_rates(arguments: dict[str, Any]) -> Any:+ return await central_banks.fetch_central_bank_rates(runtime.fetcher)+++HANDLERS = {+ "intel_market_quotes": _market_quotes,+ "intel_crypto_quotes": _crypto_quotes,+ "intel_stablecoin_status": _stablecoin_status,+ "intel_etf_flows": _etf_flows,+ "intel_sector_heatmap": _sector_heatmap,+ "intel_macro_signals": _macro_signals,+ "intel_commodity_quotes": _commodity_quotes,+ "intel_gas_prices": _gas_prices,+ "intel_residential_natgas": _residential_natgas,+ "intel_electricity_rates": _electricity_rates,+ "intel_energy_prices": _energy_prices,+ "intel_fred_series": _fred_series,+ "intel_world_bank_indicators": _world_bank_indicators,+ "intel_country_stocks": _country_stocks,+ "intel_btc_technicals": _btc_technicals,+ "intel_central_bank_rates": _central_bank_rates,+}diff --git a/src/world_intel_mcp/tools/society.py b/src/world_intel_mcp/tools/society.pynew file mode 100644index 0000000..d019ee6--- /dev/null+++ b/src/world_intel_mcp/tools/society.py@@ -0,0 +1,444 @@+"""News and public-signal tools: RSS news, trending keywords,+GDELT, prediction markets, displacement, cyber threats, AI watch,+disease outbreaks, sanctions, elections, social signals, tech and+science feeds, government spending.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime+from ..sources import (+ news,+ prediction,+ displacement,+ cyber,+ ai_watch,+ health,+ sanctions,+ elections,+ social,+ hacker_news,+ github_trending,+ arxiv_papers,+ usa_spending,+)++TOOLS: list[Tool] = [+ # --- Prediction (1 tool) ---+ Tool(+ name="intel_prediction_markets",+ description="Get active prediction markets from Polymarket (questions, YES probabilities, volumes, sentiment).",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Number of markets (default 20)",+ "default": 20,+ },+ },+ },+ ),+ # --- Displacement (1 tool) ---+ Tool(+ name="intel_displacement_summary",+ description="Get UNHCR refugee/displacement statistics by country of origin. No API key needed.",+ inputSchema={+ "type": "object",+ "properties": {+ "year": {+ "type": "integer",+ "description": "Reporting year (default: last year)",+ },+ },+ },+ ),+ # --- Cyber (1 tool) ---+ Tool(+ name="intel_cyber_threats",+ description="Get aggregated cyber threat intelligence from 4 feeds (Feodo, CISA KEV, SANS, URLhaus). No API key needed.",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Max threats (default 50)",+ "default": 50,+ },+ },+ },+ ),+ # --- News (3 tools) ---+ Tool(+ name="intel_news_feed",+ description="Get aggregated intelligence news from 119 RSS feeds across 24 categories. Covers geopolitics, security, tech, finance, military, science, think tanks, regional, energy, space, nuclear, climate, maritime, arctic, and more.",+ inputSchema={+ "type": "object",+ "properties": {+ "category": {+ "type": "string",+ "description": "Category filter (24 categories available)",+ "enum": [+ "geopolitics",+ "security",+ "technology",+ "finance",+ "military",+ "science",+ "think_tanks",+ "middle_east",+ "asia_pacific",+ "africa",+ "latin_america",+ "multilingual",+ "energy",+ "government",+ "crisis",+ "europe",+ "south_asia",+ "health",+ "central_asia",+ "arctic",+ "maritime",+ "space",+ "nuclear",+ "climate",+ ],+ },+ "limit": {+ "type": "integer",+ "description": "Max items (default 50)",+ "default": 50,+ },+ },+ },+ ),+ Tool(+ name="intel_trending_keywords",+ description="Detect trending keywords from recent news headlines. Keyword spike detection across 20+ feeds.",+ inputSchema={+ "type": "object",+ "properties": {+ "min_count": {+ "type": "integer",+ "description": "Minimum occurrences (default 3)",+ "default": 3,+ },+ },+ },+ ),+ Tool(+ name="intel_gdelt_search",+ description="Search GDELT 2.0 for global news articles or volume timelines. No API key needed.",+ inputSchema={+ "type": "object",+ "properties": {+ "query": {+ "type": "string",+ "description": "Search query (default: 'conflict')",+ "default": "conflict",+ },+ "mode": {+ "type": "string",+ "description": "artlist (articles) or timelinevol (volume timeline)",+ "enum": ["artlist", "timelinevol"],+ "default": "artlist",+ },+ "limit": {+ "type": "integer",+ "description": "Max records (default 50)",+ "default": 50,+ },+ },+ },+ ),+ # --- AI Watch (1 tool) ---+ Tool(+ name="intel_ai_releases",+ description="Track AI/AGI developments from arXiv, HuggingFace, and AI news feeds. Lab mention trending.",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Max items (default 50)",+ "default": 50,+ },+ },+ },+ ),+ # --- Health (1 tool) ---+ Tool(+ name="intel_disease_outbreaks",+ description="Aggregate disease outbreak alerts from WHO DON, ProMED, and CIDRAP. Flags high-concern pathogens (Ebola, H5N1, mpox, etc.).",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Max items (default 50)",+ "default": 50,+ },+ },+ },+ ),+ # --- Sanctions (1 tool) ---+ Tool(+ name="intel_sanctions_search",+ description="Search the US Treasury OFAC Specially Designated Nationals (SDN) sanctions list. Substring match on name, country, program.",+ inputSchema={+ "type": "object",+ "properties": {+ "query": {"type": "string", "description": "Name substring to search"},+ "country": {"type": "string", "description": "Country filter"},+ "program": {+ "type": "string",+ "description": "Sanctions program filter",+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default 50)",+ "default": 50,+ },+ },+ },+ ),+ # --- Elections (1 tool) ---+ Tool(+ name="intel_election_calendar",+ description="Get upcoming global election calendar with proximity-based instability risk scoring. Covers 2025-2029.",+ inputSchema={+ "type": "object",+ "properties": {+ "country": {+ "type": "string",+ "description": "ISO-3 code or country name filter",+ },+ },+ },+ ),+ # --- Social (1 tool) ---+ Tool(+ name="intel_social_signals",+ description="Monitor geopolitical discussion velocity on Reddit (r/worldnews, r/geopolitics). Engagement metrics and trending posts.",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Max posts per subreddit (default 25)",+ "default": 25,+ },+ },+ },+ ),+ # --- Tech & Science (3 tools) ---+ Tool(+ name="intel_hacker_news",+ description="Get top stories from Hacker News (Firebase API). Returns title, score, URL, author, comment count. Optional: limit (default 30).",+ inputSchema={+ "type": "object",+ "properties": {+ "limit": {+ "type": "integer",+ "description": "Number of stories (default 30, max 100)",+ "default": 30,+ },+ },+ },+ ),+ Tool(+ name="intel_trending_repos",+ description="Get trending GitHub repositories (recently created, most starred). Optional: language filter, time window, limit.",+ inputSchema={+ "type": "object",+ "properties": {+ "language": {+ "type": "string",+ "description": "Programming language filter (python, rust, typescript, etc.)",+ },+ "since_days": {+ "type": "integer",+ "description": "Look back N days for new repos (default 7)",+ "default": 7,+ },+ "limit": {+ "type": "integer",+ "description": "Number of repos (default 25)",+ "default": 25,+ },+ },+ },+ ),+ Tool(+ name="intel_arxiv_papers",+ description="Search recent arXiv papers in AI/ML (cs.AI, cs.LG, cs.CL). Optional custom query. Returns title, authors, abstract, categories, PDF link.",+ inputSchema={+ "type": "object",+ "properties": {+ "query": {+ "type": "string",+ "description": "arXiv search query (default: cs.AI OR cs.LG OR cs.CL)",+ },+ "limit": {+ "type": "integer",+ "description": "Number of papers (default 25)",+ "default": 25,+ },+ },+ },+ ),+ # --- Government (1 tool) ---+ Tool(+ name="intel_usa_spending",+ description="Federal agency spending data from USAspending.gov. Shows top agencies by budget for current fiscal year. Optional: agency filter.",+ inputSchema={+ "type": "object",+ "properties": {+ "agency": {+ "type": "string",+ "description": "Filter by agency name substring",+ },+ "limit": {+ "type": "integer",+ "description": "Number of agencies (default 25)",+ "default": 25,+ },+ },+ },+ ),+]+++async def _prediction_markets(arguments: dict[str, Any]) -> Any:+ return await prediction.fetch_prediction_markets(+ runtime.fetcher, limit=arguments.get("limit", 20)+ )+++async def _displacement_summary(arguments: dict[str, Any]) -> Any:+ return await displacement.fetch_displacement_summary(+ runtime.fetcher, year=arguments.get("year")+ )+++async def _cyber_threats(arguments: dict[str, Any]) -> Any:+ return await cyber.fetch_cyber_threats(+ runtime.fetcher, limit=arguments.get("limit", 50)+ )+++async def _news_feed(arguments: dict[str, Any]) -> Any:+ return await news.fetch_news_feed(+ runtime.fetcher,+ category=arguments.get("category"),+ limit=arguments.get("limit", 50),+ )+++async def _trending_keywords(arguments: dict[str, Any]) -> Any:+ return await news.fetch_trending_keywords(+ runtime.fetcher, min_count=arguments.get("min_count", 3)+ )+++async def _gdelt_search(arguments: dict[str, Any]) -> Any:+ return await news.fetch_gdelt_search(+ runtime.fetcher,+ query=arguments.get("query", "conflict"),+ mode=arguments.get("mode", "artlist"),+ limit=arguments.get("limit", 50),+ )+++async def _ai_releases(arguments: dict[str, Any]) -> Any:+ return await ai_watch.fetch_ai_watch(+ runtime.fetcher, limit=arguments.get("limit", 50)+ )+++async def _disease_outbreaks(arguments: dict[str, Any]) -> Any:+ return await health.fetch_disease_outbreaks(+ runtime.fetcher, limit=arguments.get("limit", 50)+ )+++async def _sanctions_search(arguments: dict[str, Any]) -> Any:+ return await sanctions.fetch_sanctions_search(+ runtime.fetcher,+ query=arguments.get("query", ""),+ country=arguments.get("country"),+ program=arguments.get("program"),+ limit=arguments.get("limit", 50),+ )+++async def _election_calendar(arguments: dict[str, Any]) -> Any:+ return await elections.fetch_election_calendar(+ runtime.fetcher,+ country=arguments.get("country"),+ )+++async def _social_signals(arguments: dict[str, Any]) -> Any:+ return await social.fetch_social_signals(+ runtime.fetcher,+ limit=arguments.get("limit", 25),+ )+++async def _hacker_news(arguments: dict[str, Any]) -> Any:+ return await hacker_news.fetch_hacker_news(+ runtime.fetcher,+ limit=arguments.get("limit", 30),+ )+++async def _trending_repos(arguments: dict[str, Any]) -> Any:+ return await github_trending.fetch_trending_repos(+ runtime.fetcher,+ language=arguments.get("language"),+ since_days=arguments.get("since_days", 7),+ limit=arguments.get("limit", 25),+ )+++async def _arxiv_papers(arguments: dict[str, Any]) -> Any:+ return await arxiv_papers.fetch_arxiv_papers(+ runtime.fetcher,+ query=arguments.get("query"),+ limit=arguments.get("limit", 25),+ )+++async def _usa_spending(arguments: dict[str, Any]) -> Any:+ return await usa_spending.fetch_usa_spending(+ runtime.fetcher,+ agency=arguments.get("agency"),+ limit=arguments.get("limit", 25),+ )+++HANDLERS = {+ "intel_prediction_markets": _prediction_markets,+ "intel_displacement_summary": _displacement_summary,+ "intel_cyber_threats": _cyber_threats,+ "intel_news_feed": _news_feed,+ "intel_trending_keywords": _trending_keywords,+ "intel_gdelt_search": _gdelt_search,+ "intel_ai_releases": _ai_releases,+ "intel_disease_outbreaks": _disease_outbreaks,+ "intel_sanctions_search": _sanctions_search,+ "intel_election_calendar": _election_calendar,+ "intel_social_signals": _social_signals,+ "intel_hacker_news": _hacker_news,+ "intel_trending_repos": _trending_repos,+ "intel_arxiv_papers": _arxiv_papers,+ "intel_usa_spending": _usa_spending,+}diff --git a/src/world_intel_mcp/tools/synthesis.py b/src/world_intel_mcp/tools/synthesis.pynew file mode 100644index 0000000..5464068--- /dev/null+++ b/src/world_intel_mcp/tools/synthesis.py@@ -0,0 +1,194 @@+"""NLP and strategic-synthesis tools: entity extraction, event+classification, news clustering, keyword spikes, strategic posture,+world brief, fleet report, population exposure.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime++TOOLS: list[Tool] = [+ # --- NLP Intelligence (4 tools) ---+ Tool(+ name="intel_extract_entities",+ description="Extract named entities (countries, leaders, organizations, companies, CVEs, APT groups) from text or recent news headlines.",+ inputSchema={+ "type": "object",+ "properties": {+ "text": {+ "type": "string",+ "description": "Text to analyze. If omitted, analyzes recent news headlines.",+ },+ },+ },+ ),+ Tool(+ name="intel_classify_event",+ description="Classify text into threat categories (military, terrorism, cyber, political, economic, health, climate, nuclear, etc.) with severity scoring (1-10).",+ inputSchema={+ "type": "object",+ "properties": {+ "text": {+ "type": "string",+ "description": "Event text or headline to classify.",+ },+ },+ "required": ["text"],+ },+ ),+ Tool(+ name="intel_news_clusters",+ description="Cluster recent news articles by topic similarity using Jaccard coefficient. Groups related stories and extracts top keywords per cluster.",+ inputSchema={+ "type": "object",+ "properties": {+ "category": {+ "type": "string",+ "description": "RSS feed category filter (geopolitics, security, military, etc.)",+ },+ "limit": {+ "type": "integer",+ "description": "Max news items to cluster (default: 100)",+ },+ "threshold": {+ "type": "number",+ "description": "Similarity threshold 0.0-1.0 (default: 0.25)",+ },+ },+ },+ ),+ Tool(+ name="intel_keyword_spikes",+ description="Detect trending keyword spikes against historical baselines using Welford's algorithm. Extracts CVE identifiers and APT group mentions.",+ inputSchema={+ "type": "object",+ "properties": {+ "min_count": {+ "type": "integer",+ "description": "Minimum keyword frequency to consider (default: 3)",+ },+ "z_threshold": {+ "type": "number",+ "description": "Z-score threshold for spike detection (default: 2.0)",+ },+ },+ },+ ),+ # --- Strategic Synthesis (4 tools) ---+ Tool(+ name="intel_strategic_posture",+ description="Composite global risk assessment from 9 intelligence domains: military, political, conflict, infrastructure, economic, cyber, health, climate, space. Weighted composite score 0-100 with per-domain breakdown and top threats.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_world_brief",+ description="Structured daily intelligence summary: risk overview, focal areas, top story clusters, temporal anomalies, and trending threats. Comprehensive situational awareness in one call.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_fleet_report",+ description="Naval fleet activity report aggregating theater posture (5 theaters), vessel snapshot (9 waterways), military surge detections, and naval base count. Readiness scoring.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_population_exposure",+ description="Estimate population at risk near active events (earthquakes, wildfires, conflict). Finds major cities within radius and sums exposed population.",+ inputSchema={+ "type": "object",+ "properties": {+ "radius_km": {+ "type": "number",+ "description": "Search radius in km (default: 200)",+ "default": 200,+ },+ "event_types": {+ "type": "array",+ "items": {+ "type": "string",+ "enum": ["earthquake", "wildfire", "conflict"],+ },+ "description": "Event types to include (default: all three)",+ },+ },+ },+ ),+]+++async def _extract_entities(arguments: dict[str, Any]) -> Any:+ from ..analysis.entities import fetch_entity_extraction++ return await fetch_entity_extraction(runtime.fetcher, text=arguments.get("text"))+++async def _classify_event(arguments: dict[str, Any]) -> Any:+ from ..analysis.classifier import fetch_classify_event++ return await fetch_classify_event(runtime.fetcher, text=arguments["text"])+++async def _news_clusters(arguments: dict[str, Any]) -> Any:+ from ..analysis.clustering import fetch_news_clusters++ return await fetch_news_clusters(+ runtime.fetcher,+ category=arguments.get("category"),+ limit=arguments.get("limit", 100),+ threshold=arguments.get("threshold", 0.25),+ )+++async def _keyword_spikes(arguments: dict[str, Any]) -> Any:+ from ..analysis.spikes import fetch_keyword_spikes++ return await fetch_keyword_spikes(+ runtime.fetcher,+ min_count=arguments.get("min_count", 3),+ z_threshold=arguments.get("z_threshold", 2.0),+ )+++async def _strategic_posture(arguments: dict[str, Any]) -> Any:+ from ..analysis.posture import fetch_strategic_posture++ return await fetch_strategic_posture(runtime.fetcher)+++async def _world_brief(arguments: dict[str, Any]) -> Any:+ from ..analysis.world_brief import fetch_world_brief++ return await fetch_world_brief(runtime.fetcher)+++async def _fleet_report(arguments: dict[str, Any]) -> Any:+ from ..sources.fleet import fetch_fleet_report++ return await fetch_fleet_report(runtime.fetcher)+++async def _population_exposure(arguments: dict[str, Any]) -> Any:+ from ..analysis.exposure import fetch_population_exposure++ return await fetch_population_exposure(+ runtime.fetcher,+ radius_km=arguments.get("radius_km", 200),+ event_types=arguments.get("event_types"),+ )+++HANDLERS = {+ "intel_extract_entities": _extract_entities,+ "intel_classify_event": _classify_event,+ "intel_news_clusters": _news_clusters,+ "intel_keyword_spikes": _keyword_spikes,+ "intel_strategic_posture": _strategic_posture,+ "intel_world_brief": _world_brief,+ "intel_fleet_report": _fleet_report,+ "intel_population_exposure": _population_exposure,+}diff --git a/src/world_intel_mcp/tools/system.py b/src/world_intel_mcp/tools/system.pynew file mode 100644index 0000000..93716e8--- /dev/null+++ b/src/world_intel_mcp/tools/system.py@@ -0,0 +1,112 @@+"""System tools: server health and source status.++The exemplar domain module for the Phase 26 split. The pattern every+migrated module follows:++- ``TOOLS`` holds the ``Tool`` definitions verbatim from the old+ server.py registry (descriptions and schemas unchanged).+- ``HANDLERS`` maps each tool name to an ``async def h(arguments)``+ whose body is the old ``_dispatch`` case verbatim, with shared+ infrastructure reached via ``runtime`` (``runtime.fetcher``,+ ``runtime.cache``, ``runtime.aoi_store``, ``runtime.vector_store``)+ instead of server.py module globals.+- ``aggregate()`` in the package init refuses to import a module whose+ TOOLS and HANDLERS disagree.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime++TOOLS: list[Tool] = [+ Tool(+ name="intel_status",+ description="Get data source health, circuit breaker status, cache freshness, vector store stats, and system statistics.",+ inputSchema={"type": "object", "properties": {}},+ ),+]+++async def _status(arguments: dict[str, Any]) -> Any:+ vs_stats = {+ "enabled": False,+ "error": 'Vector store dependencies not installed. Install with `pip install -e ".[vector]"`.',+ }+ if runtime.vector_store:+ vs_stats = await runtime.vector_store.collection_stats()+ return {+ "circuit_breakers": runtime.breaker.status(),+ "cache": runtime.cache.stats(),+ "cache_freshness": runtime.cache.freshness(),+ "vector_store": vs_stats,+ "sources": {+ "markets": [+ "yahoo-finance",+ "coingecko",+ "alternative-me",+ "mempool",+ ],+ "economic": ["eia", "fred", "world-bank"],+ "natural": ["usgs", "nasa-firms"],+ "conflict": ["acled", "ucdp", "hdx"],+ "military": ["opensky", "hexdb", "adsblol"],+ "infrastructure": ["cloudflare-radar", "ioda", "nga-msi"],+ "maritime": ["nga-msi"],+ "climate": ["open-meteo"],+ "news": ["rss-aggregator", "gdelt"],+ "intelligence": ["ollama", "acled", "world-bank", "hdx", "usgs"],+ "prediction": ["polymarket"],+ "displacement": ["unhcr"],+ "aviation": ["faa"],+ "cyber": ["feodo-tracker", "cisa-kev", "sans-dshield", "urlhaus"],+ "space_weather": ["noaa-swpc"],+ "ai_watch": ["arxiv", "huggingface", "ai-news-rss"],+ "health": ["who-don", "cdc", "outbreak-news"],+ "sanctions": ["ofac-sdn"],+ "elections": ["election-calendar"],+ "shipping": ["yahoo-finance"],+ "social": ["reddit-public"],+ "nuclear": ["usgs-nuclear-monitor"],+ "service_status": ["aws", "azure", "gcp", "cloudflare", "github"],+ "geospatial": [+ "static-datasets (bases, ports, pipelines, nuclear, cables, datacenters, spaceports, minerals, exchanges, trade-routes, cloud-regions, financial-centers)"+ ],+ "nlp": [+ "regex-ner",+ "keyword-classifier",+ "jaccard-clustering",+ "keyword-spike-detector",+ ],+ "synthesis": [+ "strategic-posture",+ "world-brief",+ "fleet-report",+ "population-exposure",+ ],+ "tech": ["hackernews", "github", "arxiv"],+ "government": ["usaspending-gov"],+ "environmental": ["eonet", "gdacs"],+ "forex": ["ecb-frankfurter"],+ "bonds": ["fred", "yahoo-finance"],+ "earnings": ["yahoo-finance"],+ "sec_filings": ["sec-edgar"],+ "company_enrichment": [+ "yahoo-finance",+ "gdelt",+ "sec-edgar",+ "github",+ ],+ "macro_composite": [+ "yahoo-finance",+ "coingecko",+ "alternative-me",+ ],+ },+ }+++HANDLERS = {+ "intel_status": _status,+}diff --git a/src/world_intel_mcp/tools/vector.py b/src/world_intel_mcp/tools/vector.pynew file mode 100644index 0000000..7c24bb8--- /dev/null+++ b/src/world_intel_mcp/tools/vector.py@@ -0,0 +1,278 @@+"""Vector-store tools: semantic search, similar events,+timeline, collection stats, on-demand collection, cross-domain+correlation, domain summary, trend detection.++Phase 26 split: Tool definitions moved byte-identical and dispatch+case bodies verbatim from server.py; handlers reach shared+infrastructure via ``runtime``. See tools/system.py for the pattern.+"""++from typing import Any++from mcp.types import Tool++from .. import runtime++TOOLS: list[Tool] = [+ # --- Vector Search (3 tools) ---+ Tool(+ name="intel_semantic_search",+ description="Semantic search across all stored intelligence data using natural language. Searches historical data accumulated from all 101+ tools. Filters: domain (e.g., 'markets', 'conflict'), category (e.g., 'Financial Markets', 'Cyber Threats'), hours (last N hours). Returns ranked results by relevance.",+ inputSchema={+ "type": "object",+ "properties": {+ "query": {+ "type": "string",+ "description": "Natural language search query (e.g., 'military activity near Taiwan', 'oil price disruptions')",+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default 20)",+ "default": 20,+ },+ "domain": {+ "type": "string",+ "description": "Filter by source domain (e.g., 'markets', 'conflict', 'military')",+ },+ "category": {+ "type": "string",+ "description": "Filter by category (e.g., 'Financial Markets', 'Conflict & Security', 'Cyber Threats')",+ },+ "hours": {+ "type": "number",+ "description": "Only results from last N hours",+ },+ },+ "required": ["query"],+ },+ ),+ Tool(+ name="intel_similar_events",+ description="Find historically similar intelligence events or data. Given a text description, finds the most similar stored entries across all domains. Useful for pattern matching and precedent analysis.",+ inputSchema={+ "type": "object",+ "properties": {+ "text": {+ "type": "string",+ "description": "Reference text to find similar events for",+ },+ "domain": {+ "type": "string",+ "description": "Source domain of the reference text",+ },+ "limit": {+ "type": "integer",+ "description": "Max results (default 10)",+ "default": 10,+ },+ "hours": {+ "type": "number",+ "description": "Only results from last N hours",+ },+ },+ "required": ["text"],+ },+ ),+ Tool(+ name="intel_timeline",+ description="Get chronological timeline of stored intelligence data. Returns recent entries sorted by time. Filter by domain or category to focus on specific intelligence areas.",+ inputSchema={+ "type": "object",+ "properties": {+ "domain": {+ "type": "string",+ "description": "Filter by source domain",+ },+ "category": {+ "type": "string",+ "description": "Filter by category",+ },+ "hours": {+ "type": "number",+ "description": "Time window in hours (default 24)",+ "default": 24,+ },+ "limit": {+ "type": "integer",+ "description": "Max entries (default 50)",+ "default": 50,+ },+ },+ },+ ),+ Tool(+ name="intel_vector_stats",+ description="Get vector store statistics: total points, collection status, embedding model info. Shows how much intelligence data has been accumulated.",+ inputSchema={"type": "object", "properties": {}},+ ),+ Tool(+ name="intel_collect",+ description="Trigger an immediate collection cycle to populate the vector store. Fetches all intelligence sources and stores them. Optional: sources (comma-separated domain groups like 'markets,conflict,cyber').",+ inputSchema={+ "type": "object",+ "properties": {+ "sources": {+ "type": "string",+ "description": "Comma-separated domain groups (e.g., 'markets,conflict,cyber'). Default: all sources.",+ },+ },+ },+ ),+ Tool(+ name="intel_cross_correlate",+ description="Cross-domain intelligence correlation. Given a topic, finds related signals across ALL intelligence domains (military, financial, cyber, conflict, etc.) and groups them by category. Shows how events ripple across domains — e.g., how a military buildup correlates with market movements and news coverage.",+ inputSchema={+ "type": "object",+ "properties": {+ "query": {+ "type": "string",+ "description": "Topic to correlate across domains (e.g., 'Taiwan strait tensions', 'oil supply disruption')",+ },+ "hours": {+ "type": "number",+ "description": "Time window in hours (default 24)",+ "default": 24,+ },+ "limit_per_domain": {+ "type": "integer",+ "description": "Max signals per domain category (default 5)",+ "default": 5,+ },+ },+ "required": ["query"],+ },+ ),+ Tool(+ name="intel_domain_summary",+ description="Summary of all intelligence data stored in the vector database. Shows per-category data point counts, unique sources, latest/earliest timestamps, and total events tracked. Answers: what intelligence do we have and how recent is it?",+ inputSchema={+ "type": "object",+ "properties": {+ "hours": {+ "type": "number",+ "description": "Time window in hours (default 24)",+ "default": 24,+ },+ },+ },+ ),+ Tool(+ name="intel_trend_detection",+ description="Detect activity trends by comparing recent intelligence activity against a baseline. Identifies SURGE (>50% increase), ELEVATED (>20%), DECLINING (<-20%), and DROP (<-50%) patterns. Useful for early warning when a domain suddenly spikes or goes quiet.",+ inputSchema={+ "type": "object",+ "properties": {+ "category": {+ "type": "string",+ "description": "Focus on one category (e.g., 'Conflict & Security'). Default: all categories.",+ },+ "recent_hours": {+ "type": "number",+ "description": "Recent window to measure (default 6 hours)",+ "default": 6,+ },+ "baseline_hours": {+ "type": "number",+ "description": "Baseline window for comparison (default 48 hours)",+ "default": 48,+ },+ },+ },+ ),+]+++async def _semantic_search(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ return await runtime.vector_store.semantic_search(+ query=arguments["query"],+ limit=arguments.get("limit", 20),+ domain=arguments.get("domain"),+ category=arguments.get("category"),+ hours=arguments.get("hours"),+ )+++async def _similar_events(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ return await runtime.vector_store.find_similar(+ domain=arguments.get("domain", "unknown"),+ text=arguments["text"],+ limit=arguments.get("limit", 10),+ hours=arguments.get("hours"),+ )+++async def _timeline(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ return await runtime.vector_store.timeline(+ domain=arguments.get("domain"),+ category=arguments.get("category"),+ hours=arguments.get("hours", 24.0),+ limit=arguments.get("limit", 50),+ )+++async def _vector_stats(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ return await runtime.vector_store.collection_stats()+++async def _collect(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ from ..collector import collect_once++ return await collect_once(+ runtime.fetcher,+ runtime.vector_store,+ source_filter=(+ None+ if not arguments.get("sources")+ else set(arguments["sources"].split(","))+ ),+ )+++async def _cross_correlate(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ return await runtime.vector_store.cross_domain_correlate(+ query=arguments["query"],+ hours=arguments.get("hours", 24.0),+ limit_per_domain=arguments.get("limit_per_domain", 5),+ )+++async def _domain_summary(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ return await runtime.vector_store.domain_summary(+ hours=arguments.get("hours", 24.0),+ )+++async def _trend_detection(arguments: dict[str, Any]) -> Any:+ if runtime.vector_store is None:+ return {"error": "Vector store not available (Qdrant not running?)"}+ return await runtime.vector_store.trend_detection(+ category=arguments.get("category"),+ recent_hours=arguments.get("recent_hours", 6.0),+ baseline_hours=arguments.get("baseline_hours", 48.0),+ )+++HANDLERS = {+ "intel_semantic_search": _semantic_search,+ "intel_similar_events": _similar_events,+ "intel_timeline": _timeline,+ "intel_vector_stats": _vector_stats,+ "intel_collect": _collect,+ "intel_cross_correlate": _cross_correlate,+ "intel_domain_summary": _domain_summary,+ "intel_trend_detection": _trend_detection,+}