Skip to main content
Glama
NimbleBrainInc

MCP Echo Service

echo_json

Validate and analyze JSON data by echoing it back with structured analysis for testing MCP protocol functionality.

Instructions

Echo back structured JSON data with validation and analysis.

Args: data: The JSON data to echo back ctx: MCP context

Returns: Echo response with data analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes

Implementation Reference

  • The main handler function for the echo_json MCP tool. It validates, analyzes, and returns the provided JSON data.
    @mcp.tool()
    async def echo_json(data: dict[str, Any], ctx: Context | None = None) -> EchoJsonResponse:
        """Echo back structured JSON data with validation and analysis.
    
        Args:
            data: The JSON data to echo back
            ctx: MCP context
    
        Returns:
            Echo response with data analysis
        """
        import json
    
        if ctx:
            await ctx.info(f"Echoing JSON data with {len(data)} keys...")
    
        # Analyze the data structure
        analysis = DataAnalysis(
            key_count=len(data),
            keys=list(data.keys()),
            data_types={key: type(value).__name__ for key, value in data.items()},
            total_size=len(json.dumps(data)),
        )
    
        return EchoJsonResponse(
            original_data=data,
            echoed_data=data,
            analysis=analysis,
            timestamp=datetime.now(UTC).isoformat(),
        )
  • The Pydantic schema defining the response structure for the echo_json tool.
    class EchoJsonResponse(BaseModel):
        """Response model for echo_json tool."""
    
        original_data: dict[str, Any] = Field(..., description="The original JSON data sent")
        echoed_data: dict[str, Any] = Field(..., description="The echoed JSON data")
        analysis: DataAnalysis = Field(..., description="Analysis of the data structure")
        timestamp: str = Field(..., description="ISO 8601 timestamp of the operation")
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/NimbleBrainInc/mcp-echo'

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