get_suggest_gas
Retrieve EIP1559 gas fee estimates for blockchain transactions using a specific chain ID with Desk3 MCP Server, enabling efficient transaction planning and cost optimization.
Instructions
Get EIP1559 estimated gas info (chainid required)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainid | Yes | Chain ID for the blockchain network (e.g., 1 for Ethereum mainnet, 137 for Polygon) |
Implementation Reference
- src/desk3_service/server.py:43-54 (handler)Core handler function implementing the logic for the get_suggest_gas tool by querying the Desk3 API endpoint for EIP1559 gas suggestions.async def get_suggest_gas(chainid: str) -> dict[str, Any]: """ Get EIP1559 estimated gas information. :param chainid: Chain ID, required :return: Gas suggestion and trend information """ url = 'https://mcp.desk3.io/v1/price/getSuggestGas' params = {'chainid': chainid} try: return request_api('get', url, params=params) except Exception as e: raise RuntimeError(f"Failed to fetch suggest gas data: {e}")
- src/desk3_service/server.py:521-532 (schema)JSON Schema defining the input parameters for the get_suggest_gas tool, requiring a 'chainid' string parameter.inputSchema={ "type": "object", "properties": { "chainid": { "type": "string", "description": "Chain ID for the blockchain network (e.g., 1 for Ethereum mainnet, 137 for Polygon)", "examples": ["1", "137", "56", "42161"], "pattern": "^[0-9]+$" }, }, "required": ["chainid"], },
- src/desk3_service/server.py:518-533 (registration)Registration of the get_suggest_gas tool in the server's list_tools method, including name, description, and input schema.types.Tool( name="get_suggest_gas", description="Get EIP1559 estimated gas info (chainid required)", inputSchema={ "type": "object", "properties": { "chainid": { "type": "string", "description": "Chain ID for the blockchain network (e.g., 1 for Ethereum mainnet, 137 for Polygon)", "examples": ["1", "137", "56", "42161"], "pattern": "^[0-9]+$" }, }, "required": ["chainid"], }, ),
- src/desk3_service/server.py:710-723 (handler)MCP server tool dispatch handler for get_suggest_gas, which validates input, calls the core handler, formats JSON response, and returns as TextContent.case "get_suggest_gas": if not arguments or "chainid" not in arguments: raise ValueError("Missing required argument: chainid") chainid = arguments["chainid"] try: data = await get_suggest_gas(chainid=chainid) return [ types.TextContent( type="text", text=json.dumps(data, indent=2), ) ] except Exception as e: raise RuntimeError(f"Failed to fetch suggest gas data: {e}")