Skip to main content
Glama

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
NameRequiredDescriptionDefault
addressYesEthereum address of the user

Implementation Reference

  • 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"]
      }
    },
  • Zod validation schema for getUser tool input parameters.
    const UserParamsSchema = z.object({
      address: z.string()
    });
  • 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;
    }

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/crazyrabbitLTC/mcp-snapshot-server'

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