echo_tool
Test MCP Ahrefs integration by echoing input messages with automated exception handling and logging for SEO tool development.
Instructions
Echo back the input message.
This is a simple example tool that demonstrates basic MCP tool functionality.
It will be automatically decorated with SAAGA decorators for exception handling
and logging.
Args:
message: The message to echo back
Returns:
The echoed message with a prefix
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes |
Implementation Reference
- mcp_ahrefs/tools/example_tools.py:13-26 (handler)The core implementation of the echo_tool handler. This async function takes a string message as input and returns it prefixed with 'Echo: ', demonstrating basic MCP tool functionality.async def echo_tool(message: str) -> str: """Echo back the input message. This is a simple example tool that demonstrates basic MCP tool functionality. It will be automatically decorated with SAAGA decorators for exception handling and logging. Args: message: The message to echo back Returns: The echoed message with a prefix """ return f"Echo: {message}"
- mcp_ahrefs/tools/example_tools.py:178-183 (registration)echo_tool is included in the example_tools list, which collects tools for automatic registration with SAAGA decorators.example_tools = [ echo_tool, get_time, random_number, calculate_fibonacci ]
- mcp_ahrefs/server/app.py:98-111 (registration)Server-side registration loop that applies SAAGA decorators (exception_handler and tool_logger) to each tool in example_tools (including echo_tool) and registers them explicitly with the MCP server using mcp_server.tool(name=tool_name).for tool_func in example_tools: # Apply SAAGA decorator chain: exception_handler → tool_logger decorated_func = exception_handler(tool_logger(tool_func, config.__dict__)) # Extract metadata from the original function tool_name = tool_func.__name__ # Register the decorated function directly with MCP # This preserves the function signature for parameter introspection mcp_server.tool( name=tool_name )(decorated_func) unified_logger.info(f"Registered tool: {tool_name}")