Skip to main content
Glama

get_suggest_gas

Retrieve EIP1559 gas fee estimates for blockchain transactions by specifying a network chain ID to optimize transaction costs.

Instructions

Get EIP1559 estimated gas info (chainid required)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainidYesChain ID for the blockchain network (e.g., 1 for Ethereum mainnet, 137 for Polygon)

Implementation Reference

  • The core handler function that implements the get_suggest_gas tool logic by querying the Desk3 API 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}")
  • The JSON schema defining the input parameters for the get_suggest_gas tool, registered in list_tools().
    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"], }, ),
  • The dispatch logic in the MCP server's call_tool handler that invokes the get_suggest_gas function upon tool call.
    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}")
  • Helper function used by get_suggest_gas to make authenticated API requests to the Desk3 endpoints.
    def request_api(method: str, url: str, params: dict = None, data: dict = None) -> any: headers = { 'Accepts': 'application/json', 'X-DESK3_PRO_API_KEY': API_KEY, } try: logging.info(f"Requesting {method.upper()} {url} params={params} data={data}") if method.lower() == 'get': response = requests.get(url, headers=headers, params=params) elif method.lower() == 'post': response = requests.post(url, headers=headers, json=data) else: raise ValueError(f"Unsupported HTTP method: {method}") response.raise_for_status() logging.info(f"Response {response.status_code} for {url}") return json.loads(response.text) except Exception as e: logging.error(f"Error during {method.upper()} {url}: {e}") raise

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/desk3/cryptocurrency-mcp-server'

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