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
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Address to get token for. | |
| chainId | No | ID of chain to use when fetching data. |
Implementation Reference
- src/tools/get-token.ts:9-27 (registration)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), }, ], }; }, });
- src/tools/get-token.ts:16-26 (handler)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), }, ], }; },
- src/tools/get-token.ts:12-15 (schema)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."), }),