Skip to main content
Glama

get-token

Retrieve detailed token information by providing the token address and chain ID, enabling secure blockchain interactions through MetaMask MCP.

Instructions

Fetch the token information.

Input Schema

NameRequiredDescriptionDefault
addressYesAddress to get token for.
chainIdNoID of chain to use when fetching data.

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "address": { "description": "Address to get token for.", "type": "string" }, "chainId": { "description": "ID of chain to use when fetching data.", "type": "number" } }, "required": [ "address" ], "type": "object" }

Implementation Reference

  • Primary registration of the 'get-token' MCP tool via server.addTool, defining name, description, parameters schema, and execute handler.
    server.addTool({ name: "get-token", description: "Fetch the token information.", parameters: z.object({ address: Address.describe("Address to get token for."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }), execute: async (args) => { const result = await getToken(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; }, });
  • The core handler logic: invokes wagmi's getToken function with config and args, stringifies the result as JSON, and returns it as text content.
    execute: async (args) => { const result = await getToken(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; },
  • Zod schema defining input parameters: required 'address' (Address type) and optional 'chainId' (coerced number).
    parameters: z.object({ address: Address.describe("Address to get token for."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }),

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/Xiawpohr/metamask-mcp'

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