Skip to main content
Glama
AdamikHQ

Adamik MCP Server

Official

getTokenDetails

Retrieve token metadata including decimals for converting raw blockchain balances to human-readable values. Essential for displaying accurate token amounts from getAccountState() across multiple chains.

Instructions

Fetches information about a non-native token (ERC-20, TRC-20, SPL, etc.) - not the chain's native currency. CRITICAL: This provides the 'decimals' field needed to convert raw token amounts from getAccountState() to human-readable values. Always call this for each token when displaying balances: human_readable = raw_amount ÷ 10^token_decimals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdYes
tokenIdYes

Implementation Reference

  • The handler function that executes the getTokenDetails tool logic: makes an API request to fetch token details and returns the JSON-stringified response.
    async ({ chainId, tokenId }) => {
      const details = await makeApiRequest<GetTokenDetailsResponse>(
        `${ADAMIK_API_BASE_URL}/${chainId}/token/${tokenId}`,
        ADAMIK_API_KEY
      );
      const text = JSON.stringify(details);
      return {
        content: [
          {
            type: "text",
            text,
          },
        ],
      };
    }
  • src/module.ts:261-287 (registration)
    Registration of the 'getTokenDetails' tool on the McpServer instance, specifying name, description, input schema, and handler function.
    server.tool(
      "getTokenDetails",
      [
        "Fetches information about a non-native token (ERC-20, TRC-20, SPL, etc.) - not the chain's native currency.",
        "CRITICAL: This provides the 'decimals' field needed to convert raw token amounts from getAccountState() to human-readable values.",
        "Always call this for each token when displaying balances: human_readable = raw_amount ÷ 10^token_decimals",
      ].join(" "),
      {
        chainId: ChainIdSchema,
        tokenId: z.string(),
      },
      async ({ chainId, tokenId }) => {
        const details = await makeApiRequest<GetTokenDetailsResponse>(
          `${ADAMIK_API_BASE_URL}/${chainId}/token/${tokenId}`,
          ADAMIK_API_KEY
        );
        const text = JSON.stringify(details);
        return {
          content: [
            {
              type: "text",
              text,
            },
          ],
        };
      }
    );
  • Zod schemas defining the structure of the GetTokenDetailsResponse (including TokenInfoSchema), used for type safety in the handler's API response.
    export const TokenInfoSchema = z.object({
      type: TokenTypeSchema,
      id: z.string(),
      name: z.string(),
      ticker: z.string(),
      decimals: z.string(),
      contractAddress: z.string().optional(),
    });
    
    export const GetTokenDetailsResponseSchema = z.object({
      token: TokenInfoSchema,
    });
    export type GetTokenDetailsResponse = z.infer<typeof GetTokenDetailsResponseSchema>;
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing critical behavioral context: it fetches token metadata (not native currency), provides the 'decimals' field, and explains how to use the output for balance conversion. It doesn't mention error conditions, rate limits, or authentication needs, but covers the core functionality thoroughly.

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?

Three sentences with zero waste: first states purpose, second emphasizes critical field and use case, third provides exact conversion formula. Each sentence adds unique value, and the 'CRITICAL' flag effectively front-loads the most important information.

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 2-parameter tool with no annotations and no output schema, the description is highly complete: it explains what the tool does, when to use it, and how to interpret the output. The only minor gap is not explicitly describing the return structure beyond the 'decimals' field, but the conversion example effectively communicates the output's purpose.

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?

Schema description coverage is 0%, so the description must compensate. While it doesn't explicitly name the parameters (chainId, tokenId), it provides essential semantic context: 'non-native token' implies tokenId identifies a specific token, and the context suggests chainId specifies the blockchain. This adds meaningful interpretation beyond the bare schema.

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 'fetches' and the resource 'information about a non-native token', specifying it excludes the chain's native currency. It distinguishes from siblings like getAccountState by focusing on token metadata rather than account balances or transaction details.

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: 'Always call this for each token when displaying balances' and provides a concrete example of converting raw amounts to human-readable values. It distinguishes from getAccountState by explaining this tool provides the decimals needed to interpret getAccountState's raw amounts.

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/AdamikHQ/adamik-mcp-server'

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