Skip to main content
Glama

compareGas

Compare gas fees across 5 EVM chains to find the lowest cost option, with USD estimates and sorted by price.

Instructions

5개 EVM 체인의 가스비를 한 번에 비교합니다 (최저가 순 정렬, USD 예상 비용 포함)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function fetches gas information for multiple EVM chains, calculates the estimated cost in USD, and returns the sorted results.
    async function handler(_args: z.infer<typeof inputSchema>): Promise<ToolResult<CompareGasData>> {
      const cacheKey = "comparegas:all";
      const cached = cache.get<CompareGasData>(cacheKey);
      if (cached.hit) return makeSuccess("ethereum", cached.data, true);
    
      try {
        const results = await Promise.allSettled(
          SUPPORTED_CHAINS.map((chain) => fetchChainGas(chain)),
        );
    
        const chains: ChainGas[] = [];
        for (const result of results) {
          if (result.status === "fulfilled") {
            chains.push(result.value);
          }
        }
    
        if (chains.length === 0) {
          return makeError("Failed to fetch gas from any chain", "RPC_ERROR");
        }
    
        // 비용 오름차순 정렬
        chains.sort((a, b) => a.estimatedCostUsd - b.estimatedCostUsd);
    
        const data: CompareGasData = {
          chains,
          cheapest: chains[0].chain,
          mostExpensive: chains[chains.length - 1].chain,
        };
    
        cache.set(cacheKey, data, CACHE_TTL);
        return makeSuccess("ethereum", data, false);
      } catch (err) {
        const message = sanitizeError(err);
        return makeError(`Failed to compare gas: ${message}`, "RPC_ERROR");
      }
    }
  • Registration of the compareGas MCP tool.
    export function register(server: McpServer) {
      server.tool(
        "compareGas",
        "5개 EVM 체인의 가스비를 한 번에 비교합니다 (최저가 순 정렬, USD 예상 비용 포함)",
        inputSchema.shape,
        async (args) => {
          const result = await handler(args as z.infer<typeof inputSchema>);
          return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] };
        },
      );
    }
  • Input schema definition for the compareGas tool (empty object).
    const inputSchema = z.object({});
Behavior3/5

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

With no annotations provided, the description carries the full disclosure burden. It successfully communicates output formatting (lowest-first sorting, USD estimates) and scope limitation (5 chains). However, it omits operational details like whether data is real-time vs cached, specific chain identifiers, or rate limiting concerns.

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

Conciseness5/5

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

Single sentence construction with action-front-loaded structure ('5개 EVM 체인의 가스비를 한 번에 비교합니다'). Parenthetical details (sorting order, USD inclusion) efficiently append without verbosity. Zero redundant content.

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

Completeness4/5

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

For a zero-parameter tool without output schema, the description adequately conveys return value characteristics (sorted comparison with USD estimates). Minor gap exists regarding specific chain identification (which 5 chains), but sufficient for tool selection given the explicit '5 chains' quantifier.

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

Parameters4/5

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

Input schema contains zero parameters, establishing a baseline of 4 per evaluation rules. The description appropriately requires no parameter explanation, as the empty schema properties object confirms this is a parameter-free comparison utility.

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

Purpose5/5

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

The description clearly states the tool compares gas fees across 5 EVM chains, using the specific verb '비교합니다' (compare). It distinguishes from sibling 'getGasPrice' by emphasizing multi-chain scope (5 chains) and added features (sorting, USD conversion), which implies aggregation behavior beyond single-chain queries.

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

Usage Guidelines3/5

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

The description implies usage through its scope (5 chains vs single), suggesting use when users need comparative cross-chain data rather than individual chain data. However, it lacks explicit guidance on when to prefer this over 'getGasPrice' or other siblings, and states no prerequisites or exclusions.

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/calintzy/evmscope'

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