Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
userYesUsername
limitNoNumber of users to return (default: 20)
offsetNoNumber of users to skip (default: 0)

Implementation Reference

  • 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)
        }]
      };
    }
  • 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"]
    },
  • 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)
          }]
        };
      }
    },
  • Shared Zod schema used in the handler for parsing the 'user' parameter.
    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