Skip to main content
Glama

ODOS_GET_CHAIN_ID

Retrieve the chain ID for a specified chain name using MCP-ODOS. Enables precise identification of blockchain networks for decentralized exchange interactions.

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 execute function implementing the core logic of ODOS_GET_CHAIN_ID: logs the call, retrieves chain object using helper, returns chain ID as string, with error handling.
    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;
    	}
    },
  • Zod schema defining the input parameters for the tool: a 'chain' string.
    const chainIdSchema = z.object({
    	chain: z.string().describe("The chain name to get the ID for"),
    });
  • src/index.ts:16-16 (registration)
    Registers the chainIdTool (ODOS_GET_CHAIN_ID) with the FastMCP server.
    server.addTool(chainIdTool);
  • Helper function that maps a chain name (case-insensitive) to the corresponding viem Chain object from predefined chains.
    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, so the description carries the full burden of behavioral disclosure. It only states the basic function without adding context like error handling (e.g., what happens if the chain name is invalid), performance traits (e.g., rate limits), or output format (since there's no output schema). This is a significant gap for a tool with no annotation coverage.

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, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., numeric ID, string), error conditions, or behavioral context. For a tool with no structured data beyond the input schema, this leaves significant gaps in understanding how to use it 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 schema description coverage is 100%, with the parameter 'chain' clearly documented as 'The chain name to get the ID for'. The description adds no additional meaning beyond this, such as examples of valid chain names or format details. Given the high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('Get') and the resource ('chain ID'), specifying it's for a given chain name. It's specific enough to understand what the tool does, though it doesn't explicitly differentiate from sibling tools like ODOS_GET_QUOTE or ODOS_SWAP, which appear to be different operations (getting quotes and executing swaps).

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. It doesn't mention any context, prerequisites, or exclusions, such as whether it's for validation, configuration, or error handling, nor does it relate to the sibling tools. This leaves the agent with minimal usage direction.

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

Related 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