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
| 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:16-26 (handler)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), }, ], }; },
- src/tools/get-token.ts:12-15 (schema)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."), }),
- src/tools/get-token.ts:8-28 (registration)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), }, ], }; }, }); };
- src/tools/register-tools.ts:48-48 (registration)Call to register the "get-token" tool as part of the central registerTools function.registerGetTokenTools(server, wagmiConfig);