Skip to main content
Glama

get_supported_chains

Retrieve supported blockchain networks for bridging and swapping, including chain IDs, names, and native currencies. Use to resolve chain names before initiating cross-chain transactions.

Instructions

List all blockchain networks supported by Relay for bridging and swapping. Returns chain IDs, names, native currencies, and status. Use this to resolve chain names to chain IDs before calling other tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vmTypeNoFilter by virtual machine type (e.g. "evm", "svm"). Omit for all chains.

Implementation Reference

  • Complete implementation of the get_supported_chains tool. Contains the register function that defines the tool with its schema and async handler. The handler fetches chains from the Relay API, filters by vmType if provided, and returns simplified chain information including chainId, name, vmType, nativeCurrency, depositEnabled, and explorerUrl.
    export function register(server: McpServer) {
      server.tool(
        "get_supported_chains",
        "List all blockchain networks supported by Relay for bridging and swapping. Returns chain IDs, names, native currencies, and status. Use this to resolve chain names to chain IDs before calling other tools.",
        {
          vmType: z
            .string()
            .optional()
            .describe(
              'Filter by virtual machine type (e.g. "evm", "svm"). Omit for all chains.'
            ),
        },
        async ({ vmType }) => {
          const { chains } = await getChains();
    
          let filtered = chains.filter((c: Chain) => !c.disabled);
          if (vmType) {
            filtered = filtered.filter(
              (c: Chain) => c.vmType.toLowerCase() === vmType.toLowerCase()
            );
          }
    
          const simplified = filtered.map((c: Chain) => ({
            chainId: c.id,
            name: c.displayName,
            vmType: c.vmType,
            nativeCurrency: c.currency.symbol,
            depositEnabled: c.depositEnabled,
            explorerUrl: c.explorerUrl,
          }));
    
          const summary = `Found ${simplified.length} supported chain${simplified.length !== 1 ? "s" : ""}${vmType ? ` (${vmType})` : ""}. Examples: ${simplified
            .slice(0, 5)
            .map((c) => `${c.name} (${c.chainId})`)
            .join(", ")}${simplified.length > 5 ? "..." : ""}.`;
    
          return {
            content: [
              { type: "text", text: summary },
              { type: "text", text: JSON.stringify(simplified, null, 2) },
            ],
          };
        }
      );
    }
  • Zod schema definition for the tool's input parameters. Defines an optional 'vmType' string parameter that can be used to filter chains by virtual machine type (e.g., 'evm', 'svm').
      vmType: z
        .string()
        .optional()
        .describe(
          'Filter by virtual machine type (e.g. "evm", "svm"). Omit for all chains.'
        ),
    },
  • src/index.ts:4-4 (registration)
    Import statement that imports the register function from the get-supported-chains module.
    import { register as registerGetSupportedChains } from "./tools/get-supported-chains.js";
  • src/index.ts:20-20 (registration)
    Registration call that registers the get_supported_chains tool with the MCP server instance.
    registerGetSupportedChains(server);
  • Type definitions for the Chain interface and ChainsResponse, along with the getChains API function. The Chain interface defines the structure of chain data returned by the Relay API, including properties like id, displayName, vmType, currency, and depositEnabled status.
    export interface Chain {
      id: number;
      name: string;
      displayName: string;
      httpRpcUrl: string;
      explorerUrl: string;
      depositEnabled: boolean;
      disabled: boolean;
      vmType: string;
      iconUrl: string;
      currency: {
        id: string;
        symbol: string;
        name: string;
        address: string;
        decimals: number;
      };
    }
    
    export interface ChainsResponse {
      chains: Chain[];
    }
    
    export async function getChains(): Promise<ChainsResponse> {
      return relayApi<ChainsResponse>("/chains");
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses the return format ('Returns chain IDs, names, native currencies, and status') and the tool's purpose in the broader workflow. However, it doesn't mention potential rate limits, authentication needs, or pagination behavior.

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?

Two sentences with zero waste: the first states purpose and return values, the second provides explicit usage guidance. Every word earns its place, and key information is front-loaded.

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 simple read-only tool with no annotations and no output schema, the description provides adequate context about what it does and when to use it. However, without an output schema, it could benefit from more detail about the return structure beyond the listed fields.

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?

Schema description coverage is 100%, so the schema already documents the single optional parameter. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score for high schema coverage.

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 specific action ('List all blockchain networks'), the resource ('supported by Relay'), and the purpose ('for bridging and swapping'). It distinguishes from siblings by focusing on chain metadata rather than transactions, fees, or tokens.

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

Usage Guidelines5/5

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

Explicitly states when to use this tool: 'Use this to resolve chain names to chain IDs before calling other tools.' This provides clear guidance on its role in the workflow and distinguishes it from alternatives like get_supported_tokens or transaction-related tools.

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/relayprotocol/relay-mcp'

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