get_thread
Retrieve complete Slack thread content and linked resources using a thread timestamp, providing full context after search results.
Instructions
Retrieve all chunks for a specific Slack thread, including any linked resources.
Use this after search() to get the full thread context.
Args: thread_ts: The thread timestamp (from search result metadata). channel_id: Optional channel ID to narrow the lookup.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_ts | Yes | ||
| channel_id | No |
Implementation Reference
- server.py:203-244 (handler)The complete handler implementation for the get_thread tool. It retrieves all chunks for a specific Slack thread from the vector store, separates thread chunks from linked resources, sorts them, and returns them organized in a structured response.
@mcp.tool() def get_thread(thread_ts: str, channel_id: str | None = None) -> dict: """Retrieve all chunks for a specific Slack thread, including any linked resources. Use this after search() to get the full thread context. Args: thread_ts: The thread timestamp (from search result metadata). channel_id: Optional channel ID to narrow the lookup. """ store = _get_store() where: Dict[str, Any] = {"thread_ts": thread_ts} if channel_id: where = {"$and": [{"thread_ts": thread_ts}, {"channel_id": channel_id}]} results = store.get(where=where, include=["documents", "metadatas"]) thread_chunks = [] link_chunks = [] for doc_id, text, meta in zip( results["ids"], results["documents"], results["metadatas"] ): entry = {"id": doc_id, "text": text, "metadata": meta} if meta.get("source") == "slack_thread": thread_chunks.append(entry) else: link_chunks.append(entry) thread_chunks.sort(key=lambda x: x["metadata"].get("chunk_index", 0)) link_chunks.sort( key=lambda x: ( x["metadata"].get("url", ""), x["metadata"].get("chunk_index", 0), ) ) return { "thread_ts": thread_ts, "thread_chunks": thread_chunks, "linked_resources": link_chunks, } - server.py:204-212 (schema)Function signature and docstring defining the input schema for get_thread tool. Accepts thread_ts (required string) and channel_id (optional string), returns a dict with thread_chunks and linked_resources.
def get_thread(thread_ts: str, channel_id: str | None = None) -> dict: """Retrieve all chunks for a specific Slack thread, including any linked resources. Use this after search() to get the full thread context. Args: thread_ts: The thread timestamp (from search result metadata). channel_id: Optional channel ID to narrow the lookup. """ - server.py:203-204 (registration)The @mcp.tool() decorator registers the get_thread function as an MCP tool with the FastMCP server instance.
@mcp.tool() def get_thread(thread_ts: str, channel_id: str | None = None) -> dict: