Skip to main content
Glama
jhanglim

Mattermost MCP Server

by jhanglim

get_post_thread

Retrieve the complete thread of a specific Mattermost post, including author names and usernames for context.

Instructions

특정 게시물의 전체 스레드를 가져옵니다. 결과에는 자동으로 작성자의 이름(user_name)과 username이 포함됩니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_idYes게시물 ID

Implementation Reference

  • The main handler for the "get_post_thread" tool within the CallToolRequestSchema switch statement. It extracts post_id, fetches the thread using client.getPostThread, enriches each post with user details (username, user_name) using getUsersInfo, formats timestamps to KST, and returns a JSON-formatted response.
    case "get_post_thread": {
      const postId = args.post_id as string;
      const thread = await client.getPostThread(postId);
      
      // 고유한 user_id 추출 및 사용자 정보 조회
      const uniqueUserIds = [...new Set(thread.order?.map((postId: string) => thread.posts[postId].user_id) || [])];
      const userMap = await client.getUsersInfo(uniqueUserIds);
    
      const posts = thread.order?.map((postId: string) => {
        const post = thread.posts[postId];
        const createTime = formatTimestamp(post.create_at);
        const userInfo = userMap.get(post.user_id);
        
        return {
          id: post.id,
          message: post.message,
          user_id: post.user_id,
          username: userInfo?.username || "unknown",
          user_name: userInfo?.name || "Unknown User",
          create_at: createTime,
        };
      }) || [];
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              posts: posts,
            }, null, 2),
          },
        ],
      };
    }
  • src/index.ts:303-316 (registration)
    Registration of the "get_post_thread" tool in the tools list returned by the ListToolsRequestSchema handler. Includes name, description, and input schema.
    {
      name: "get_post_thread",
      description: "특정 게시물의 전체 스레드를 가져옵니다. 결과에는 자동으로 작성자의 이름(user_name)과 username이 포함됩니다.",
      inputSchema: {
        type: "object",
        properties: {
          post_id: {
            type: "string",
            description: "게시물 ID",
          },
        },
        required: ["post_id"],
      },
    },
  • MattermostClient helper method that performs the actual API request to fetch the post thread from the Mattermost server.
    async getPostThread(postId: string): Promise<MattermostPostsResult> {
      return await this.request(`/posts/${postId}/thread`) as MattermostPostsResult;
    }
  • TypeScript interface defining the structure of the post thread result returned by the Mattermost API.
    interface MattermostPostsResult {
      order: string[];
      posts: Record<string, MattermostPost>;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that results include the author's name and username automatically, which adds some context about output behavior. However, it lacks critical details such as whether this is a read-only operation, potential rate limits, authentication requirements, error handling, or pagination. For a tool with no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, consisting of two sentences that efficiently convey the tool's purpose and a key output feature. It is front-loaded with the main action and avoids unnecessary verbosity, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for effective tool use. It mentions output includes author details but doesn't cover other behavioral aspects like safety, performance, or error conditions. For a tool with no structured metadata, the description should provide more context to compensate, but it falls short.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description does not explicitly mention the 'post_id' parameter or provide additional semantic context beyond what the input schema already covers. Since the schema description coverage is 100% (with a clear description for 'post_id'), the baseline score is 3. The description adds no extra parameter details, but it doesn't need to compensate for low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '특정 게시물의 전체 스레드를 가져옵니다' (Get the entire thread of a specific post). It specifies the verb ('가져옵니다' - get/fetch) and resource ('게시물의 전체 스레드' - entire post thread), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_channel_messages' or 'search_messages', which might also retrieve message-related data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, exclusions, or comparisons to sibling tools such as 'get_channel_messages' or 'search_messages', which could be used for similar purposes. Users are left to infer usage based on the tool name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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