Skip to main content
Glama
z9905080

MCP Server for Slack

by z9905080

slack_get_user_profile

Retrieve detailed profile information for a specific Slack user by providing their user ID.

Instructions

Get detailed profile information for a specific user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYesThe ID of the user

Implementation Reference

  • Core handler function in SlackClient that performs the API call to retrieve detailed user profile information from Slack's users.profile.get endpoint.
    async getUserProfile(user_id: string): Promise<any> {
      const params = new URLSearchParams({
        user: user_id,
        include_labels: "true",
      });
    
      const response = await fetch(
        `https://slack.com/api/users.profile.get?${params}`,
        { headers: this.botHeaders },
      );
    
      return response.json();
    }
  • Tool dispatch handler in the CallToolRequest that validates arguments and calls the SlackClient.getUserProfile method.
    case "slack_get_user_profile": {
      const args = request.params
        .arguments as unknown as GetUserProfileArgs;
      if (!args.user_id) {
        throw new Error("Missing required argument: user_id");
      }
      const response = await slackClient.getUserProfile(args.user_id);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Tool schema definition including name, description, and input schema for validation.
    const getUserProfileTool: Tool = {
      name: "slack_get_user_profile",
      description: "Get detailed profile information for a specific user",
      inputSchema: {
        type: "object",
        properties: {
          user_id: {
            type: "string",
            description: "The ID of the user",
          },
        },
        required: ["user_id"],
      },
    };
  • index.ts:567-582 (registration)
    Registration of the tool in the ListToolsRequest handler, making it discoverable by clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.log("Received ListToolsRequest");
      return {
        tools: [
          listChannelsTool,
          postMessageTool,
          replyToThreadTool,
          addReactionTool,
          getChannelHistoryTool,
          getThreadRepliesTool,
          getUsersTool,
          getUserProfileTool,
          lookupUserByEmailTool,
        ],
      };
    });
  • TypeScript interface defining the expected arguments for the tool.
    interface GetUserProfileArgs {
      user_id: string;
    }

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/z9905080/mcp-slack'

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