Skip to main content
Glama
andybrandt

MCP Simple OpenAI Assistant

by andybrandt

List Managed Threads

list_threads
Read-only

Retrieve saved conversation threads with IDs, names, and timestamps to continue discussions using the ask_assistant_in_thread tool.

Instructions

Lists all locally saved conversation threads from the database. Returns a list of threads with their ID, name, description, and last used time. The thread ID can be used in the ask_assistant_in_thread tool to specify this thread to be continued.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for 'list_threads'. Calls manager.list_threads() and formats the thread list into a readable string output.
    @app.tool(annotations={"title": "List Managed Threads", "readOnlyHint": True})
    async def list_threads() -> str:
        """
        Lists all locally saved conversation threads from the database.
        Returns a list of threads with their ID, name, description, and last used time.
        The thread ID can be used in the ask_assistant_in_thread tool to specify this thread to be continued.
        """
        if not manager:
            raise ToolError("AssistantManager not initialized.")
        try:
            threads = manager.list_threads()
            if not threads:
                return "No managed threads found."
    
            thread_list = [
                dedent(f"""
                Thread ID: {t['thread_id']}
                Name: {t['name']}
                Description: {t['description']}
                Last Used: {t['last_used_at']}
                """)
                for t in threads
            ]
            return "Managed Threads:\\n\\n" + "\\n---\\n".join(thread_list)
        except Exception as e:
            raise ToolError(f"Failed to list threads: {e}")
  • Helper method in AssistantManager that delegates the list_threads call to the ThreadStore instance.
    def list_threads(self) -> list[sqlite3.Row]:
        """List all managed threads from the local database."""
        return self.thread_store.list_threads()
  • Core data access helper in ThreadStore that executes SQL query to fetch all threads ordered by last_used_at DESC.
    def list_threads(self) -> list[sqlite3.Row]:
        """Retrieves all thread records from the database.
    
        Returns:
            A list of rows, where each row is a dictionary-like object
            representing a thread.
        """
        conn = self._get_connection()
        cursor = conn.cursor()
        cursor.execute("SELECT * FROM threads ORDER BY last_used_at DESC")
        return cursor.fetchall()
Behavior4/5

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

Annotations already declare readOnlyHint=true, indicating a safe read operation. The description adds value by specifying that it returns a list with specific fields (ID, name, description, last used time) and mentions the thread ID's use in 'ask_assistant_in_thread', providing useful context beyond annotations. It does not disclose behavioral traits like pagination or sorting, but with annotations covering safety, this is acceptable.

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

Conciseness5/5

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

The description is front-loaded with the core purpose in the first sentence, followed by details on return values and usage in two additional sentences. Every sentence adds value without waste, making it efficient and well-structured.

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

Completeness5/5

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

Given the tool's simplicity (0 parameters, read-only operation), annotations provide safety context, and an output schema exists (implied by context signals), the description is complete. It explains what the tool does, what it returns, and how to use the output, covering all necessary aspects without redundancy.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately does not discuss parameters, focusing on output and usage. Baseline for 0 parameters is 4, as it avoids unnecessary details.

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

Purpose5/5

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

The description clearly states the verb 'lists' and the resource 'locally saved conversation threads from the database', specifying it returns a list with ID, name, description, and last used time. It distinguishes from siblings like 'list_assistants' by focusing on threads rather than assistants, and from 'delete_thread' or 'update_thread' by being a read operation.

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

Usage Guidelines4/5

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

The description explicitly mentions using the thread ID with 'ask_assistant_in_thread' to continue a thread, providing clear context for when to use this tool. However, it does not specify when not to use it or compare it to alternatives like 'list_assistants', leaving some guidance gaps.

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/andybrandt/mcp-simple-openai-assistant'

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