Skip to main content
Glama
z9905080

MCP Server for Slack

by z9905080

lookup_user_by_email

Find Slack users by email address to identify team members, retrieve user details, or verify account information within your workspace.

Instructions

Lookup a user by their email address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesThe email address of the user

Implementation Reference

  • Core handler function in SlackClient class that fetches user information from Slack API using the provided email address.
    async lookupUserByEmail(email: string): Promise<any> {
    
      const params = new URLSearchParams({
        email: email,
      });
    
      const response = await fetch(`https://slack.com/api/users.lookupByEmail?${params}`, {
        method: "GET",
        headers: this.botHeaders,
      });
    
      return response.json();
    }
  • Tool schema definition specifying name, description, and input schema requiring an 'email' parameter.
    const lookupUserByEmailTool: Tool = {
      name: "lookup_user_by_email",
      description: "Lookup a user by their email address",
      inputSchema: {
        type: "object",
        properties: {
          email: {
            type: "string",
            description: "The email address of the user",
          },
        },
        required: ["email"],
      },
    };
  • index.ts:570-580 (registration)
    Registration of the tool in the list of available tools returned by ListToolsRequest handler.
    tools: [
      listChannelsTool,
      postMessageTool,
      replyToThreadTool,
      addReactionTool,
      getChannelHistoryTool,
      getThreadRepliesTool,
      getUsersTool,
      getUserProfileTool,
      lookupUserByEmailTool,
    ],
  • Dispatch handler in CallToolRequest that extracts email argument and calls the SlackClient lookupUserByEmail method.
    case "lookup_user_by_email": {
      const args = request.params.arguments as { email: string };
      const response = await slackClient.lookupUserByEmail(args.email);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }

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