Skip to main content
Glama

resolve_asset

Convert CAIP-19 asset identifiers into detailed token metadata including address, decimals, symbol, name, network, chainId, and registration status for blockchain operations.

Instructions

Resolve a CAIP-19 asset identifier to token metadata. Returns address, decimals, symbol, name, network, chainId, isNative, isRegistered.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asset_idYesCAIP-19 asset identifier (e.g., "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "eip155:1/slip44:60")

Implementation Reference

  • Implementation of the 'resolve_asset' tool handler. It parses CAIP-19 asset IDs and queries the daemon's registry for metadata.
    server.tool(
      'resolve_asset',
      'Resolve a CAIP-19 asset identifier to token metadata. Returns address, decimals, symbol, name, network, chainId, isNative, isRegistered.',
      {
        asset_id: z.string().describe(
          'CAIP-19 asset identifier (e.g., "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "eip155:1/slip44:60")',
        ),
      },
      async (args) => {
        const parsed = parseAssetIdLocal(args.asset_id);
        if (!parsed) {
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({
                error: true,
                code: 'INVALID_CAIP19',
                message: `Invalid CAIP-19 format: "${args.asset_id}". Expected format: {chainId}/{namespace}:{reference}`,
              }),
            }],
            isError: true,
          };
        }
    
        const { chainId, isNative, address } = parsed;
    
        // For native assets, we can return immediately without registry lookup
        if (isNative) {
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({
                assetId: args.asset_id,
                chainId,
                network: chainId,
                address: null,
                decimals: null,
                symbol: null,
                name: null,
                isNative: true,
                isRegistered: false,
              }),
            }],
          };
        }
    
        // Query the daemon's token registry using the CAIP-2 chainId as network
        const registryResult = await apiClient.get(
          `/v1/tokens?network=${encodeURIComponent(chainId)}`,
        );
    
        if (!registryResult.ok) {
          // Registry lookup failed -- return partial info from CAIP-19 parsing
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({
                assetId: args.asset_id,
                chainId,
                network: chainId,
                address,
                decimals: null,
                symbol: null,
                name: null,
                isNative: false,
                isRegistered: false,
              }),
            }],
          };
        }
    
        // Search registry for matching token by address
        const data = registryResult.data as {
          tokens?: Array<{
            address: string;
            symbol: string;
            name: string;
            decimals: number;
            [key: string]: unknown;
          }>;
        };
    
        const tokens = data.tokens ?? [];
        const normalizedAddress = address?.toLowerCase() ?? '';
        const match = tokens.find(
          (t) => t.address.toLowerCase() === normalizedAddress,
        );
    
        if (match) {
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({
                assetId: args.asset_id,
                chainId,
                network: chainId,
                address: match.address,
                decimals: match.decimals,
                symbol: match.symbol,
                name: match.name,
                isNative: false,
                isRegistered: true,
              }),
            }],
          };
        }
    
        // Token not found in registry
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({
              assetId: args.asset_id,
              chainId,
              network: chainId,
              address,
              decimals: null,
              symbol: null,
              name: null,
              isNative: false,
              isRegistered: false,
            }),
          }],
        };
      },
    );
  • Registration function for the 'resolve_asset' tool.
    export function registerResolveAsset(server: McpServer, apiClient: ApiClient): void {
Behavior3/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 compensates for the missing output schema by listing return fields (address, decimals, symbol, etc.), which is helpful. However, it lacks disclosure of read-only safety, error behaviors, or rate limits.

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 efficiently structured: first states the transformation, second lists return values. No redundant words; every element earns its place given the lack of output schema.

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 single-parameter lookup tool, the description is reasonably complete. It documents the input transformation and output structure (compensating for no output schema). Missing only error handling details.

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 coverage is 100% with 'asset_id' fully documented including examples. The description mentions 'CAIP-19 asset identifier' but adds no additional syntax, validation rules, or format guidance beyond what the schema already provides. Baseline 3 is appropriate given high schema coverage.

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?

Clear verb ('Resolve'), resource ('CAIP-19 asset identifier'), and output ('token metadata'). However, it does not explicitly differentiate from siblings like 'get_assets' or 'get_tokens' which also retrieve asset information.

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?

No guidance on when to use this tool versus alternatives like 'get_assets' or 'get_tokens'. No mention of error cases (e.g., invalid CAIP-19 format) or prerequisites.

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/minhoyoo-iotrust/WAIaaS'

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