Skip to main content
Glama

GAS_PRICE

Check current gas prices on blockchain networks to estimate transaction costs before executing swaps or transfers on decentralized exchanges.

Instructions

Get gas price

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoThe blockchain network to execute the transaction on. uses fraxtal as defaultfraxtal

Implementation Reference

  • The execute handler function for the GAS_PRICE tool. Resolves the chain name, instantiates ChainService, fetches gas price, and returns JSON or error.
    export const gasPrice = async (args: z.infer<typeof chainParamsSchema>) => {
    	try {
    		const inputChain = args.chain.toLowerCase();
    		const chainObject = getChainFromName(inputChain);
    
    		console.error(`[GAS_PRICE] Using chain: ${chainObject} (${chainObject.id})`);
    
    		const service = new ChainService();
    		const gasPrice = await service.gasPrice(chainObject.id);
    		if (gasPrice instanceof Error) {
    			return `Error fetching gasPrice: ${gasPrice.message}`;
    		}
    
    		return JSON.stringify(gasPrice, null, 2);
    	} catch (error: unknown) {
    		const message =
    			error instanceof Error
    				? error.message
    				: "An unknown error occurred while fetching gasPrice.";
    		console.error(`[GAS_PRICE] Error: ${message}`);
    		throw new Error(`Failed to fetch gasPrice: ${message}`);
    	}
    };
  • Input schema (parameters) for GAS_PRICE tool, defining optional 'chain' parameter defaulting to 'fraxtal'.
    export const chainParamsSchema = z.object({
    	chain: z
    		.string()
    		.optional()
    		.describe(
    			"The blockchain network to execute the transaction on. uses fraxtal as default",
    		)
    		.default("fraxtal")
    });
  • Registration of the GAS_PRICE tool in the tools export object, linking name, description, parameters, and execute handler.
    gasPrice: {
    	name: "GAS_PRICE",
    	description: "Get gas price",
    	parameters: chainParamsSchema,
    	execute: chainExecute.gasPrice
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get gas price' implies a read-only operation, but it does not specify aspects like whether it requires authentication, rate limits, data freshness, or error handling. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just two words, which is efficient and front-loaded. However, this brevity borders on under-specification, as it lacks necessary details for clarity and completeness. It earns a high score for conciseness but loses a point for not providing enough substance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It does not explain what the gas price represents (e.g., in wei or gwei), how it's sourced, or what the return value looks like. Without annotations or an output schema, the description should compensate more to ensure the agent can use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'chain' parameter fully documented in the schema itself. The description does not add any meaning beyond the schema, as it mentions no parameters. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles the parameter semantics adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get gas price' clearly states the action (get) and resource (gas price), making the purpose understandable. However, it lacks specificity about what exactly is retrieved (e.g., current price, historical data, or estimates) and does not distinguish this tool from potential siblings like GET_TRANSACTION that might involve gas-related data. This makes it vague but minimally viable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like QUOTE and SWAP that might involve gas calculations, there is no indication of whether this tool is for standalone gas price checks or part of a broader workflow. This absence of context leaves usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/openocean-finance/openocean-mcp'

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