Skip to main content
Glama

get_user_stats

Retrieve statistics for a WebSim user to analyze their activity and performance within the platform.

Instructions

Get statistics for a specific WebSim user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userYesUsername

Implementation Reference

  • The handler function for the 'get_user_stats' MCP tool. It validates the input arguments using UserParamsSchema, calls the apiClient.getUserStats method to fetch data from the WebSim API, and returns a formatted text content response with the results.
    handler: async (args) => {
      const { user } = UserParamsSchema.parse(args);
      const result = await apiClient.getUserStats(user);
      return {
        content: [{
          type: "text",
          text: JSON.stringify({
            success: true,
            data: result,
            message: `Successfully retrieved statistics for user ${user}`
          }, null, 2)
        }]
      };
  • The inputSchema definition for the 'get_user_stats' tool, specifying the required 'user' parameter as a string.
    inputSchema: {
      type: "object",
      properties: {
        user: {
          type: "string",
          description: "Username"
        }
      },
      required: ["user"]
    },
  • server.js:502-528 (registration)
    The complete tool registration object for 'get_user_stats' within the tools array, which is used by the MCP server's ListToolsRequestHandler and CallToolRequestHandler.
    {
      name: "get_user_stats",
      description: "Get statistics 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.getUserStats(user);
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              success: true,
              data: result,
              message: `Successfully retrieved statistics for user ${user}`
            }, null, 2)
          }]
        };
      }
  • Supporting utility method in the WebSimAPIClient class that performs the HTTP request to retrieve user statistics from the WebSim API endpoint.
    async getUserStats(user) {
      return this.makeRequest(`/api/v1/users/${user}/stats`);
    }
  • Zod validation schema for user parameters, used in the handler for input parsing.
    const UserParamsSchema = z.object({
      user: z.string().describe('Username')
    });

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