analyze_emotion_distribution
Analyze the distribution of emotions across a Twitter dataset to understand sentiment patterns and frequency of emotional labels.
Instructions
Get the distribution of emotions in the dataset.
Returns: JSON string with counts and percentages for each emotion
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:144-167 (handler)The implementation of the analyze_emotion_distribution tool, which calculates emotion distribution from a dataset.
def analyze_emotion_distribution() -> str: """Get the distribution of emotions in the dataset. Returns: JSON string with counts and percentages for each emotion """ dataset = get_dataset() counter = Counter(sample["label"] for sample in dataset) total = len(dataset) distribution = [] for label_id, count in counter.most_common(): distribution.append({ "emotion": EMOTION_LABELS[label_id], "count": count, "percentage": round((count / total) * 100, 2) }) return json.dumps({ "total_samples": total, "distribution": distribution }, indent=2) - server.py:143-143 (registration)MCP tool registration for analyze_emotion_distribution.
@mcp.tool()