We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AkkioTim/mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
echo_tool.py•1.27 KiB
"""
Echo Tool - Simple demonstration tool.
Demonstrates:
- Basic tool registration with @mcp.tool() decorator
- Input parameter handling
- Return value formatting
"""
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mcp.server.fastmcp import FastMCP
from ..config import ServerConfig
def register(mcp: "FastMCP", config: "ServerConfig") -> None:
"""Register echo tools with the server."""
@mcp.tool()
def echo(message: str) -> str:
"""
Echo back the provided message.
Args:
message: The message to echo back
Returns:
The same message, confirming receipt
"""
return f"Echo: {message}"
@mcp.tool()
def echo_uppercase(message: str) -> str:
"""
Echo back the message in uppercase.
Args:
message: The message to transform and echo
Returns:
The message converted to uppercase
"""
return f"ECHO: {message.upper()}"
@mcp.tool()
def echo_reverse(message: str) -> str:
"""
Echo back the message reversed.
Args:
message: The message to reverse
Returns:
The message with characters in reverse order
"""
return f"Echo: {message[::-1]}"