Skip to main content
Glama
cegme

Emotion Dataset Analysis MCP Server

by cegme

get_sample

Retrieve random samples from an emotion-labeled Twitter dataset for analysis, returning text and emotion labels in JSON format.

Instructions

Get n random samples from the emotion dataset.

Args: n: Number of samples to retrieve (default: 5, max: 20)

Returns: JSON string with samples including text and emotion label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nNo

Implementation Reference

  • server.py:53-76 (handler)
    The get_sample function is registered as an MCP tool using the @mcp.tool() decorator and retrieves n random samples from the loaded emotion dataset.
    @mcp.tool()
    def get_sample(n: int = 5) -> str:
        """Get n random samples from the emotion dataset.
    
        Args:
            n: Number of samples to retrieve (default: 5, max: 20)
    
        Returns:
            JSON string with samples including text and emotion label
        """
        n = min(max(n, 1), 20)  # Clamp to 1-20
        dataset = get_dataset()
        indices = random.sample(range(len(dataset)), n)
    
        samples = []
        for idx in indices:
            sample = dataset[idx]
            samples.append({
                "text": sample["text"],
                "emotion": EMOTION_LABELS[sample["label"]],
                "index": idx
            })
    
        return json.dumps(samples, indent=2)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cegme/cis6930sp26-assignment1.5'

If you have feedback or need assistance with the MCP directory API, please join our Discord server