tone
Analyze recent news coverage of a topic to reveal emotional tone distribution and dominant sentiment. Understand public mood with tones like happy, angry, or fearful.
Instructions
Get the emotional tone distribution across recent coverage of a topic (happy, funny, hopeful, informational, angry, sad, fearful) plus the dominant_tone. Use when the user asks how a topic is being talked about or the public mood around it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| days | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/overtone_news_mcp/server.py:108-117 (handler)The tool handler function for 'tone'. It accepts a query and days parameter, then delegates to _post('tone', ...) which calls the Overtone News API.
@mcp.tool() def tone( query: Query, days: Annotated[int, Field(ge=1, le=10)] = 3, ) -> dict[str, Any]: """Get the emotional tone distribution across recent coverage of a topic (happy, funny, hopeful, informational, angry, sad, fearful) plus the dominant_tone. Use when the user asks how a topic is being talked about or the public mood around it.""" return _post("tone", {"query": query, "days": days}) - src/overtone_news_mcp/server.py:108-108 (registration)The @mcp.tool() decorator registers the `tone` function as an MCP tool.
@mcp.tool() - Type aliases used in the tone tool: ToneFilter (positive/negative/informational) and ToneName (happy, funny, hopeful, informational, angry, sad, fearful).
ToneFilter = Literal["positive", "negative", "informational"] ToneName = Literal[ "happy", "funny", "hopeful", "informational", "angry", "sad", "fearful" ] - The _post helper makes an authenticated POST request to the Overtone API, used by the tone handler to call the 'tone' endpoint.
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()