news
Retrieve news articles on any topic, each tagged with tone and brand-safety signals. Use for analyzing current events or topic coverage.
Instructions
Retrieve news articles about a topic, each tagged with tone and
brand-safety signals. Returns up to max_results articles from the
last days days. Use for any question about current events or a
topic's coverage. Include request_id from the response when you
later call report to log which articles you actually showed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| max_results | No | ||
| days | No | ||
| tone_filter | No | ||
| brand_safe_only | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/overtone_news_mcp/server.py:84-105 (handler)The @mcp.tool() decorated function 'news' that executes the tool logic: takes query, max_results, days, tone_filter, and brand_safe_only; builds the request body; and sends it to the /news API endpoint.
@mcp.tool() def news( query: Query, max_results: Annotated[int, Field(ge=1, le=20)] = 15, days: Annotated[int, Field(ge=1, le=10)] = 3, tone_filter: ToneFilter | None = None, brand_safe_only: bool = True, ) -> dict[str, Any]: """Retrieve news articles about a topic, each tagged with tone and brand-safety signals. Returns up to `max_results` articles from the last `days` days. Use for any question about current events or a topic's coverage. Include `request_id` from the response when you later call `report` to log which articles you actually showed.""" body: dict[str, Any] = { "query": query, "max_results": max_results, "days": days, "brand_safe_only": brand_safe_only, } if tone_filter: body["tone_filter"] = tone_filter return _post("news", body) - Type aliases used as schemas for tool parameters, including Query (min 1, max 500 chars), ToneFilter, ToneName, and Bin which are all used by the 'news' tool and other tools.
Query = Annotated[str, Field(min_length=1, max_length=500)] ToneFilter = Literal["positive", "negative", "informational"] ToneName = Literal[ "happy", "funny", "hopeful", "informational", "angry", "sad", "fearful" ] Bin = Literal["hour", "6h", "day"] - src/overtone_news_mcp/server.py:84-84 (registration)The @mcp.tool() decorator that registers the 'news' function as an MCP tool on the FastMCP server instance.
@mcp.tool() - The _post helper function is called by the 'news' tool (as _post('news', body)) to send the HTTP POST request to the Overtone API with the API key header.
def _post(path: str, body: dict[str, Any]) -> dict[str, Any]: with httpx.Client(timeout=HTTP_TIMEOUT) as client: resp = client.post( f"{API_URL}/{path}", headers={"X-API-Key": _load_api_key()}, json=body, ) resp.raise_for_status() return resp.json()