Skip to main content
Glama

get_user

Retrieve user profile information from WebSim's public API by providing a username to access details and manage user data.

Instructions

Get details for a specific WebSim user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userYesUsername

Implementation Reference

  • The handler function for the 'get_user' MCP tool. It validates the input using UserParamsSchema, fetches the user data using apiClient.getUser(user), and returns a structured response containing the JSON-formatted user data.
    handler: async (args) => {
      const { user } = UserParamsSchema.parse(args);
      const result = await apiClient.getUser(user);
      return {
        content: [{
          type: "text",
          text: JSON.stringify({
            success: true,
            data: result,
            message: `Successfully retrieved user ${user}`
          }, null, 2)
        }]
      };
    }
  • Input schema definition for the 'get_user' tool, specifying the required 'user' parameter as a string.
    inputSchema: {
      type: "object",
      properties: {
        user: {
          type: "string",
          description: "Username"
        }
      },
      required: ["user"]
    },
  • Zod validation schema used by the 'get_user' handler to parse and validate the input argument 'user'.
    const UserParamsSchema = z.object({
      user: z.string().describe('Username')
    });
  • Helper method in WebSimAPIClient that performs the HTTP request to fetch user details from the WebSim API endpoint.
    async getUser(user) {
      return this.makeRequest(`/api/v1/users/${user}`);
    }
  • server.js:474-501 (registration)
    Registration of the 'get_user' tool in the tools array, including name, description, input schema, and handler. This array is used by the MCP server request handlers for tool listing and execution.
    {
      name: "get_user",
      description: "Get details for a specific WebSim user",
      inputSchema: {
        type: "object",
        properties: {
          user: {
            type: "string",
            description: "Username"
          }
        },
        required: ["user"]
      },
      handler: async (args) => {
        const { user } = UserParamsSchema.parse(args);
        const result = await apiClient.getUser(user);
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              success: true,
              data: result,
              message: `Successfully retrieved user ${user}`
            }, null, 2)
          }]
        };
      }
    },

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/gigachadtrey/websimm'

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