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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and successfully discloses constraints ('max: 20') and return format ('JSON string with samples including text and emotion label'). It omits traits like idempotency or caching, but covers the essential behavioral constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Uses a clean docstring format with Args and Returns sections. Every sentence earns its place; no redundancy or fluff. The structure front-loads the core purpose before detailing parameters and returns.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a low-complexity tool with one optional parameter and an existing output schema (reducing the need for extensive return documentation), the description is nearly complete. Minor gap: lacks explicit differentiation from siblings despite having clear siblings available.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, but the description fully compensates by documenting the 'n' parameter with semantics ('Number of samples'), default value, and maximum constraint ('max: 20'), exceeding baseline expectations.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Get'), resource ('samples from the emotion dataset'), and scope ('random'), clearly distinguishing it from sibling tools like search_text (query-based) and count_by_emotion (aggregation).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying 'random samples,' which suggests when to use it (for random inspection), but lacks explicit guidance on when to choose this over search_text or other siblings, and lists no prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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