Skip to main content
Glama
jhanglim

Mattermost MCP Server

by jhanglim

get_user_info

Retrieve user details from Mattermost using a user ID to access username, display name, nickname, and other profile information.

Instructions

사용자 ID로 사용자의 상세 정보를 조회합니다. username, 이름, 닉네임 등을 확인할 수 있습니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes조회할 사용자의 ID

Implementation Reference

  • Handler implementation for the 'get_user_info' tool. It retrieves user information by ID using MattermostClient.getUser, handles not found cases, and returns formatted JSON response.
    case "get_user_info": {
      const userId = args.user_id as string;
      const user = await client.getUser(userId);
      
      if (!user) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: "User not found",
                user_id: userId,
              }, null, 2),
            },
          ],
        };
      }
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              id: user.id,
              username: user.username,
              email: user.email || "",
              first_name: user.first_name || "",
              last_name: user.last_name || "",
              nickname: user.nickname || "",
              full_name: `${user.first_name} ${user.last_name}`.trim() || user.nickname || user.username,
            }, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the 'get_user_info' tool, specifying the required 'user_id' parameter.
    inputSchema: {
      type: "object",
      properties: {
        user_id: {
          type: "string",
          description: "조회할 사용자의 ID",
        },
      },
      required: ["user_id"],
    },
  • src/index.ts:192-205 (registration)
    Registration of the 'get_user_info' tool in the ListTools response, including name, description, and input schema.
    {
      name: "get_user_info",
      description: "사용자 ID로 사용자의 상세 정보를 조회합니다. username, 이름, 닉네임 등을 확인할 수 있습니다.",
      inputSchema: {
        type: "object",
        properties: {
          user_id: {
            type: "string",
            description: "조회할 사용자의 ID",
          },
        },
        required: ["user_id"],
      },
    },
  • MattermostClient.getUser helper method, which fetches user data from Mattermost API with caching, used by the get_user_info handler.
    async getUser(userId: string) {
      // 캐시 확인
      if (this.userCache.has(userId)) {
        return this.userCache.get(userId);
      }
    
      try {
        const user = await this.request(`/users/${userId}`);
        this.userCache.set(userId, user);
        return user;
      } catch (e) {
        return null;
      }
    }

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/jhanglim/mattermost-mcp-server'

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