Skip to main content
Glama

ODOS_GET_CHAIN_ID

Retrieve the numeric chain ID for a given blockchain name to identify the network.

Instructions

Get the chain ID for a given chain name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainYesThe chain name to get the ID for

Implementation Reference

  • The main handler/tool definition for ODOS_GET_CHAIN_ID. Contains the execute function that calls getChainFromName and returns the chain ID.
    export const chainIdTool = {
    	name: "ODOS_GET_CHAIN_ID",
    	description: "Get the chain ID for a given chain name",
    	parameters: chainIdSchema,
    	execute: async (args: z.infer<typeof chainIdSchema>) => {
    		try {
    			console.log("[ODOS_GET_CHAIN_ID] Called...");
    
    			const chain = getChainFromName(args.chain);
    			return chain.id.toString();
    		} catch (error) {
    			console.error(error);
    			throw error;
    		}
    	},
    };
  • The Zod schema for input validation. Expects a single 'chain' string parameter describing the chain name.
    const chainIdSchema = z.object({
    	chain: z.string().describe("The chain name to get the ID for"),
    });
  • src/index.ts:18-18 (registration)
    The tool is registered with the FastMCP server via server.addTool(chainIdTool).
    server.addTool(chainIdTool);
  • Helper function getChainFromName that maps a chain name string to a viem Chain object using the viem/chains library.
    export function getChainFromName(name: string): Chain {
    	switch (name.toLowerCase()) {
    		case "fraxtal":
    			return chains.fraxtal;
    		case "mainnet":
    			return chains.mainnet;
    		case "optimism":
    			return chains.optimism;
    		case "polygon":
    			return chains.polygon;
    		case "bsc":
    			return chains.bsc;
    		case "base":
    			return chains.base;
    		case "arbitrum":
    			return chains.arbitrum;
    		case "avalanche":
    			return chains.avalanche;
    		case "linea":
    			return chains.linea;
    		case "scroll":
    			return chains.scroll;
    		case "mode":
    			return chains.mode;
    		case "sonic":
    			return chains.sonic;
    		case "fantom":
    			return chains.fantom;
    		case "zksync era":
    			return chains.zksync;
    		case "mantle":
    			return chains.mantle;
    		case "sepolia":
    			return chains.sepolia;
    		case "goerli":
    			return chains.goerli;
    		case "polygon mumbai":
    			return chains.polygonMumbai;
    		case "arbitrum goerli":
    			return chains.arbitrumGoerli;
    		case "bsc testnet":
    			return chains.bscTestnet;
    		case "eth":
    			return chains.mainnet;
    		case "matic":
    			return chains.polygon;
    		case "bnb":
    			return chains.bsc;
    		case "avax":
    			return chains.avalanche;
    		case "arb":
    			return chains.arbitrum;
    		case "ftm":
    			return chains.fantom;
    		case "era":
    			return chains.zksync;
    		default:
    			throw new Error(`Chain ${name} not supported`);
    	}
    }
Behavior2/5

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

No annotations are provided, and the description does not disclose any behavioral traits such as idempotency, side effects, or rate limits. While the tool name suggests a read-only operation, the description does not explicitly confirm safety or other behavioral details.

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?

The description is a single concise sentence with no unnecessary words. It is front-loaded with the verb and clearly states the purpose, earning full marks for efficiency.

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

Completeness3/5

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

Given the tool's simplicity (single parameter, no output schema), the description is adequate but could be improved by explaining what the chain ID is or the format of the return value. It is minimally complete.

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 parameter 'chain' already described. The description adds minimal additional meaning beyond the schema, so it meets the baseline but does not enhance understanding.

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 verb 'Get', the resource 'chain ID', and the condition 'for a given chain name'. It effectively distinguishes itself from sibling tools like ODOS_GET_QUOTE and ODOS_SWAP, which serve different purposes.

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 provides no guidance on when to use this tool versus alternatives, nor does it mention any prerequisites or limitations. It is straightforward but lacks usage context.

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/IQAIcom/mcp-odos'

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