get_user_followers
Retrieve follower lists for WebSim users to analyze community connections and engagement patterns.
Instructions
Get followers of a specific WebSim user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | Yes | Username | |
| limit | No | Number of users to return (default: 20) | |
| offset | No | Number of users to skip (default: 0) |
Implementation Reference
- server.js:629-641 (handler)The MCP tool handler for 'get_user_followers' that validates arguments using UserParamsSchema, fetches data via apiClient, and returns a standardized JSON response.handler: async (args) => { const { user, limit = 20, offset = 0 } = UserParamsSchema.parse(args); const result = await apiClient.getUserFollowers(user, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved ${result.items?.length || 0} followers of ${user}` }, null, 2) }] };
- server.js:609-627 (schema)Input schema definition for the 'get_user_followers' tool, specifying parameters user (required), limit, and offset with descriptions and defaults.inputSchema: { type: "object", properties: { user: { type: "string", description: "Username" }, limit: { type: "number", description: "Number of users to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of users to skip (default: 0)", default: 0 } }, required: ["user"]
- server.js:159-162 (helper)Helper method in WebSimAPIClient class that constructs and sends HTTP request to retrieve followers for a given user from the WebSim API.async getUserFollowers(user, limit = 20, offset = 0) { const params = new URLSearchParams({ limit: limit.toString(), offset: offset.toString() }); return this.makeRequest(`/api/v1/users/${user}/followers?${params}`); }
- server.js:37-39 (schema)Zod schema used for input validation in the 'get_user_followers' handler (and other user-related tools), requiring a 'user' string.const UserParamsSchema = z.object({ user: z.string().describe('Username') });
- server.js:606-642 (registration)Full tool registration object added to the 'tools' array, which is used by the MCP server for tool listing and execution.{ name: "get_user_followers", description: "Get followers of a specific WebSim user", inputSchema: { type: "object", properties: { user: { type: "string", description: "Username" }, limit: { type: "number", description: "Number of users to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of users to skip (default: 0)", default: 0 } }, required: ["user"] }, handler: async (args) => { const { user, limit = 20, offset = 0 } = UserParamsSchema.parse(args); const result = await apiClient.getUserFollowers(user, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved ${result.items?.length || 0} followers of ${user}` }, null, 2) }] }; }