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
Guide prompts: check each step's purpose against the tool it calls
Phoenix Agent (mac-studio)d35c1b3dc18d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex fdebd38..c99cd93 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -43,8 +43,10 @@A missing, unknown or invalid one is an `invalid params` error. Testsfail if a prompt names a tool that is not registered, passes an argumentits schema does not take (name, type, listed value or range), cites an- output field the code does not produce, or states a count or a table- size the code does not match.+ output field the code does not produce, describes a step in words that+ share nothing with the called tool's description or names a provider+ that tool does not, or states a count or a table size the code does not+ match.- `intel guide` prints the guide markdown; `intel guide --measures` printsthe glossary.- Two tests drive initialize, resources/list, resources/read, prompts/list,diff --git a/README.md b/README.mdindex 760cf8a..efa9ab9 100644--- a/README.md+++ b/README.md@@ -203,8 +203,9 @@ list, a value that names a tool the prompt does not call, or an unknownprompt is an `invalid params` error, never a guess. The tests fail if aprompt names a tool that is not registered, passes an argument thetool's schema does not take (wrong name, type or listed value), cites an-output field the code does not produce, or if the guide leaves out a-registered tool. Tools that cannot work without an API key carry a+output field the code does not produce, describes a step in words that+share nothing with the called tool's own description, or if the guide+leaves out a registered tool. Tools that cannot work without an API key carry a`[needs VARIABLE]` mark in the guide's tool list.From the shell, `intel guide` prints the same guide markdown anddiff --git a/src/world_intel_mcp/guide_prompts.py b/src/world_intel_mcp/guide_prompts.pyindex db4a681..64791b6 100644--- a/src/world_intel_mcp/guide_prompts.py+++ b/src/world_intel_mcp/guide_prompts.py@@ -762,7 +762,7 @@ PROMPTS: tuple[ResearchPrompt, ...] = ("host view call it with destination {country} instead",args=(("origin", "{country}"),),),- ("intel_displacement_summary", "the global totals for context"),+ ("intel_displacement_summary", "UNHCR's global displacement totals, for context"),),limits=("UNHCR figures are year-end stocks (people displaced at the end of "@@ -1009,7 +1009,7 @@ PROMPTS: tuple[ResearchPrompt, ...] = (question="What entered or left {name} since the last snapshot, and is the area escalating?",arguments=(PromptArg("name", "The AOI name", required=True),),steps=(- ("intel_aoi_list", "confirm {name} exists and see its shape"),+ ("intel_aoi_list", "confirm {name} is among the defined areas of interest and see its shape"),Step("intel_aoi_changes","new, departed and unchanged items since the previous snapshot, "@@ -1131,7 +1131,7 @@ PROMPTS: tuple[ResearchPrompt, ...] = (steps=(("intel_disease_outbreaks", "WHO, ProMED and CIDRAP outbreak reports"),("intel_humanitarian_summary", "crisis datasets for the affected countries"),- ("intel_news_feed", "recent coverage, for context only"),+ ("intel_news_feed", "recent news coverage, for context only"),),limits=("Outbreak reports arrive after cases occur and case counts are "diff --git a/src/world_intel_mcp/tests/test_guide.py b/src/world_intel_mcp/tests/test_guide.pyindex ac6d5a1..c307520 100644--- a/src/world_intel_mcp/tests/test_guide.py+++ b/src/world_intel_mcp/tests/test_guide.py@@ -729,6 +729,96 @@ def test_no_prompt_repeats_a_call() -> None:assert repeated == {}+# A step's purpose says what its tool returns, so it has to agree with what+# the tool says about itself: it shares a word with the tool's name,+# description or parameter descriptions, and any upper-case name it uses (a+# provider such as AAA or NWS) appears there too, as written or spelled out.+# A step pointed at a wrong but registered tool fails one or both (review F14+# M7). Measured 2026-10-17: the check catches 12,006 of the 13,524 ways of+# pointing one step at another registered tool.+_COMMON_WORDS = frozenset(+ "about after also and any each every for from into its latest most only "+ "over recent that the their them then this today were what when where "+ "which while with".split()+)+_NOT_PROVIDERS = frozenset({"US", "UK", "EU", "UN"})+# Provenance a tool's registered text leaves out, with the source function+# its handler calls that states it.+_PROVIDER_IN_CODE = {+ ("intel_forex_timeseries", "ECB"): ("world_intel_mcp.sources.forex", "fetch_forex_timeseries"),+}+++def _content_words(text: str) -> set[str]:+ words = set()+ for word in re.findall(r"[a-z][a-z0-9]+", text.lower()):+ if len(word) >= 4 and word not in _COMMON_WORDS:+ words.add(word[:-1] if word.endswith("s") and len(word) > 4 else word)+ return words+++def _names(acronym: str, text: str) -> bool:+ if re.search(rf"(?<![a-z]){acronym.lower()}s?(?![a-z])", text.lower()):+ return True+ words = re.findall(r"[A-Za-z]+", text)+ n = len(acronym)+ return any(+ "".join(w[0] for w in words[i : i + n]) == acronym and all(w[0].isupper() for w in words[i : i + n])+ for i in range(len(words) - n + 1)+ )+++def _tool_text(tool: Tool) -> str:+ props = (tool.inputSchema or {}).get("properties", {})+ return " ".join(+ [tool.name, tool.description or "", *(f"{k} {v.get('description', '')}" for k, v in props.items())]+ )+++def _purpose_problems(tool: Tool, purpose: str) -> list[str]:+ text = _tool_text(tool)+ problems = []+ if not _content_words(purpose) & _content_words(text):+ problems.append(f"{tool.name}: the purpose shares no word with what the tool says about itself")+ for acronym in sorted(set(re.findall(r"\b[A-Z]{2,}\b", purpose)) - _NOT_PROVIDERS):+ if not _names(acronym, text) and (tool.name, acronym) not in _PROVIDER_IN_CODE:+ problems.append(f"{tool.name}: the purpose names {acronym}, the tool does not")+ return problems+++def test_step_purposes_agree_with_their_tools(tools_pkg) -> None:+ by_name = {t.name: t for t in tools_pkg.ALL_TOOLS}+ problems = {+ f"{prompt.name} step {i + 1}": found+ for prompt in guide_prompts.PROMPTS+ for i, step in enumerate(prompt.steps)+ if (found := _purpose_problems(by_name[step.tool], step.purpose))+ }+ assert problems == {}+++def test_purpose_check_catches_a_wrong_but_registered_tool(tools_pkg) -> None:+ """The check above has to be able to fail, also for a tool the prompt+ does not already call, which the repeated-call test cannot see."""+ by_name = {t.name: t for t in tools_pkg.ALL_TOOLS}+ energy = guide_prompts.get("energy-pressure")+ purpose = next(s.purpose for s in energy.steps if s.tool == "intel_gas_prices")+ assert _purpose_problems(by_name["intel_gas_prices"], purpose) == []+ for wrong in ("intel_energy_prices", "intel_electricity_rates", "intel_service_status"):+ assert f"{wrong}: the purpose names AAA, the tool does not" in _purpose_problems(by_name[wrong], purpose)+ assert _purpose_problems(by_name["intel_service_status"], purpose)[0] == (+ "intel_service_status: the purpose shares no word with what the tool says about itself"+ )+ assert _names("NWS", "the US National Weather Service") and not _names("NWS", "the weather news")+++def test_provenance_kept_in_code_is_still_there(tools_pkg) -> None:+ for (tool_name, acronym), (module_name, function) in _PROVIDER_IN_CODE.items():+ source = inspect.getsource(getattr(importlib.import_module(module_name), function))+ assert acronym in source, (tool_name, acronym)+ assert function in inspect.getsource(tools_pkg.ALL_HANDLERS[tool_name]), tool_name++def test_every_argument_is_well_formed() -> None:for prompt in guide_prompts.PROMPTS:for arg in prompt.arguments: