Skip to main content
Glama

get-token

Retrieve token details from blockchain networks using MetaMask MCP server. Provide token address and chain ID to fetch information.

Instructions

Fetch the token information.

Input Schema

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

Implementation Reference

  • The execute handler for the "get-token" tool. Fetches token information using Wagmi's getToken function with the provided wagmiConfig and args, then returns the result as a standardized text content block using JSONStringify to handle serialization.
    execute: async (args) => { const result = await getToken(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; },
  • Input schema for the "get-token" tool using Zod. Requires an 'address' of type Address, optionally accepts 'chainId' as a 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."), }),
  • The registration function that defines and registers the "get-token" tool on the FastMCP server, including name, description, schema, and handler.
    export function registerGetTokenTools(server: FastMCP, wagmiConfig: Config): void { 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), }, ], }; }, }); };
  • Call to register the "get-token" tool as part of the central registerTools function.
    registerGetTokenTools(server, wagmiConfig);

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