Skip to main content
Glama
jhanglim
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>; }

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