An engineer needs to give an AI agent reverse-DNS capability so it can map IP addresses to hostnames when summarizing incidents. The engineer must implement a FastMCP tool that resolves PTR records with `socket.gethostbyaddr` and expose it through stdio for MCP clients. Construct the artifact by dragging the code snippets into the boxes. Not all options are used. <DragDrop items={["FastMCP","transport","tools","stdio_mode","runner","tool","run"]} slots={[{"answer":"FastMCP","id":"import_class"},{"answer":"tool","id":"decorator"},{"answer":"run","id":"server_method"},{"answer":"transport","id":"transport_arg"}]} template={"from mcp.server.fastmcp import {{import_class}}\nimport socket\n\nmcp = FastMCP(\"dns-tools\")\n\n@mcp.{{decorator}}()\ndef reverse_dns(ip: str) -> str:\n \"\"\"Return primary hostname for an IP address (PTR).\"\"\"\n try:\n name, _, _ = socket.gethostbyaddr(ip)\n return name\n except Exception as e:\n return f\"lookup failed: {e}\"\n\nif __name__ == \"__main__\":\n mcp.{{server_method}}({{transport_arg}}=\"stdio\")"} explanation={"`FastMCP` is the server class, `@mcp.tool()` registers the function as an MCP tool, and `mcp.run(transport=\"stdio\")` starts the server using the standard-input/output transport required by local MCP clients. `socket.gethostbyaddr(ip)` performs the reverse hostname lookup used for PTR resolution.\n\n**Learn more:** [Model Context Protocol Python SDK](https://github.com/modelcontextprotocol/python-sdk)"} reuse={false} />