get_user_following
Retrieve the list of users a specific user follows on WebSim, with options to limit results and paginate through large datasets.
Instructions
Get users that a specific user is following
Input 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) |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"default": 20,
"description": "Number of users to return (default: 20)",
"type": "number"
},
"offset": {
"default": 0,
"description": "Number of users to skip (default: 0)",
"type": "number"
},
"user": {
"description": "Username",
"type": "string"
}
},
"required": [
"user"
],
"type": "object"
}
Implementation Reference
- server.js:591-604 (handler)The main handler function for the MCP tool 'get_user_following'. Validates input, calls the API client method, and returns formatted JSON response.handler: async (args) => { const { user, limit = 20, offset = 0 } = UserParamsSchema.parse(args); const result = await apiClient.getUserFollowing(user, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved ${result.items?.length || 0} users followed by ${user}` }, null, 2) }] }; }
- server.js:571-590 (schema)Input schema for the 'get_user_following' tool defining parameters: user (required), limit, and offset.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:154-157 (helper)WebSimAPIClient helper method that performs the HTTP request to retrieve the list of users followed by the given user.async getUserFollowing(user, limit = 20, offset = 0) { const params = new URLSearchParams({ limit: limit.toString(), offset: offset.toString() }); return this.makeRequest(`/api/v1/users/${user}/following?${params}`); }
- server.js:568-605 (registration)The complete tool registration object added to the tools array, which defines the tool for MCP server.{ name: "get_user_following", description: "Get users that a specific user is following", 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.getUserFollowing(user, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Successfully retrieved ${result.items?.length || 0} users followed by ${user}` }, null, 2) }] }; } },
- server.js:37-39 (schema)Shared Zod schema used in the handler for parsing the 'user' parameter.const UserParamsSchema = z.object({ user: z.string().describe('Username') });