Browse Source

news-mcp: make capabilities more agent friendly

Lukas Goldschmidt 1 month ago
parent
commit
4408634c9d
1 changed files with 45 additions and 0 deletions
  1. 45 0
      news_mcp/mcp_server_fastmcp.py

+ 45 - 0
news_mcp/mcp_server_fastmcp.py

@@ -197,6 +197,49 @@ NEWS_COMPOSITION_RECIPES = [
 ]
 
 
+NEWS_AGENT_TIPS = [
+    "If you need a fast answer, start with get_latest_events, then summarize the strongest cluster with get_event_summary.",
+    "If a user asks about a person/place/company/theme, use get_events_for_entity before broadening to get_related_recent_entities.",
+    "Treat cluster_id as an internal cursor, not user-facing output; use it only for follow-up tool calls.",
+    "When describing clusters, keep sources and timestamps visible so the user can assess recency and provenance.",
+    "Prefer a short chain of tools over many parallel calls unless you are building a neighborhood map or comparison table.",
+    "For tricky names, rely on the server’s resolver instead of inventing alias rules in the client.",
+]
+
+
+NEWS_EXAMPLE_CHAINS = [
+    {
+        "task": "What is happening now?",
+        "chain": [
+            "get_latest_events(topic=...)",
+            "get_event_summary(event_id=...) if one cluster looks important",
+        ],
+    },
+    {
+        "task": "Deep dive on an entity",
+        "chain": [
+            "get_events_for_entity(entity=..., timeframe=...)",
+            "get_news_sentiment(entity=..., timeframe=...)",
+            "get_event_summary(event_id=...) for the strongest cluster",
+        ],
+    },
+    {
+        "task": "Broaden from a subject",
+        "chain": [
+            "get_related_recent_entities(subject=..., include_trends=true)",
+            "get_events_for_entity(entity=...) for the strongest related entities",
+        ],
+    },
+    {
+        "task": "Find what is emerging",
+        "chain": [
+            "detect_emerging_topics(limit=...)",
+            "get_events_for_entity(entity=...) on one or two emerging terms",
+        ],
+    },
+]
+
+
 @mcp.tool(description="Investigate a topic and return the newest deduplicated news clusters, sorted by recency.")
 async def get_latest_events(topic: str = "crypto", limit: int = 5, include_articles: bool = False):
     limit = max(1, min(int(limit), 20))
@@ -596,6 +639,8 @@ async def get_capabilities():
         },
         "tools": NEWS_TOOL_CARDS,
         "recipes": NEWS_COMPOSITION_RECIPES,
+        "example_chains": NEWS_EXAMPLE_CHAINS,
+        "agent_tips": NEWS_AGENT_TIPS,
         "guidance": [
             "Use get_latest_events for a tail, get_events_for_entity for entity deep dives, and get_related_recent_entities for neighborhood expansion.",
             "Prefer normalized/canonical entities when possible, but the server will resolve common aliases and MIDs for you.",