getUser
Retrieve user information from Snapshot.org by providing an Ethereum address to access profile data and activity details.
Instructions
Get information about a Snapshot user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Ethereum address of the user |
Implementation Reference
- src/services/snapshotService.ts:282-296 (handler)The core handler function that executes the tool logic by querying the Snapshot GraphQL API for user data using the provided Ethereum address.async getUser(address: string): Promise<User> { const query = ` query { users(first: 1, where: { id_in: ["${address}"] }) { id name about avatar } } `; const result = await this.queryGraphQL(query); return result.users[0]; }
- src/server.ts:104-114 (registration)Registration of the getUser tool in the ListTools handler, including name, description, and inputSchema.{ name: "getUser", description: "Get information about a Snapshot user", inputSchema: { // Changed from parameters to inputSchema type: "object", properties: { address: { type: "string", description: "Ethereum address of the user" } }, required: ["address"] } },
- src/server.ts:32-34 (schema)Zod validation schema for getUser tool input parameters.const UserParamsSchema = z.object({ address: z.string() });
- src/server.ts:182-190 (handler)MCP CallTool handler case for getUser, which parses arguments, invokes the service handler, and returns formatted JSON response.case "getUser": { const parsedArgs = UserParamsSchema.parse(args); const user = await this.snapshotService.getUser(parsedArgs.address); return { content: [{ type: "text", text: JSON.stringify(user, null, 2) }] };
- TypeScript interface defining the structure of the User object returned by the getUser handler.interface User { id: string; name?: string; about?: string; avatar?: string; }