Skip to main content
Glama
andybrandt

MCP Simple OpenAI Assistant

by andybrandt

Update Managed Thread

update_thread

Modify the name or description of a saved conversation thread to organize and identify discussions clearly.

Instructions

Updates the name and/or description of a locally saved conversation thread. Both the local database and the OpenAI thread object will be updated.

The thread ID can be retrieved from the list_threads tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thread_idYes
nameNo
descriptionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler implementation for 'update_thread'. This is the entry point decorated with @app.tool that validates inputs and delegates to AssistantManager.
    @app.tool(annotations={"title": "Update Managed Thread", "readOnlyHint": False})
    async def update_thread(
        thread_id: str, name: Optional[str] = None, description: Optional[str] = None
    ) -> str:
        """
        Updates the name and/or description of a locally saved conversation thread.
        Both the local database and the OpenAI thread object will be updated.
    
        The thread ID can be retrieved from the list_threads tool.
        """
        if not manager:
            raise ToolError("AssistantManager not initialized.")
        if not name and not description:
            raise ToolError("You must provide either a new name or a new description.")
        try:
            await manager.update_thread(thread_id, name, description)
            return f"Successfully updated thread {thread_id}."
        except Exception as e:
            raise ToolError(f"Failed to update thread {thread_id}: {e}")
  • Core business logic method in AssistantManager that updates the thread metadata both on OpenAI servers and in the local ThreadStore database.
    async def update_thread(
        self, thread_id: str, name: Optional[str], description: Optional[str]
    ):
        """Update the metadata of a thread on OpenAI and in the local DB."""
        metadata = {
            "name": name,
            "description": description or ""
        }
        # First, update the thread on OpenAI's servers
        updated_thread = self.client.beta.threads.update(
            thread_id=thread_id,
            metadata=metadata
        )
        # Then, update the local database
        self.thread_store.update_thread_metadata(thread_id, name, description)
        return updated_thread
  • ThreadStore method that persists the thread metadata updates in the local SQLite database.
    def update_thread_metadata(self, thread_id: str, name: str, description: str | None):
        """Updates the name and description of a specific thread.
    
        Args:
            thread_id: The ID of the thread to update.
            name: The new name for the thread.
            description: The new description for the thread.
        """
        conn = self._get_connection()
        cursor = conn.cursor()
        cursor.execute("""
            UPDATE threads
            SET name = ?, description = ?, last_used_at = ?
            WHERE thread_id = ?
        """, (name, description, datetime.now(timezone.utc), thread_id))
        conn.commit()
Behavior3/5

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

Annotations indicate readOnlyHint=false, confirming this is a mutation tool, which aligns with the description's 'Updates' action. The description adds useful context about dual updates to 'both the local database and the OpenAI thread object,' which goes beyond annotations. However, it lacks details on permissions, error handling, or rate limits, leaving some behavioral aspects unclear.

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 additional context in a concise second sentence. Every sentence adds value: the first defines the action and scope, the second explains the dual update effect, and the third provides a usage prerequisite. No wasted words.

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

Completeness4/5

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

Given the tool has an output schema (implied by 'Has output schema: true'), the description need not detail return values. It covers the mutation purpose, scope, and a usage hint adequately. However, with 0% schema coverage and no annotations beyond readOnlyHint, it could benefit from more parameter guidance or behavioral details to be fully complete.

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?

Schema description coverage is 0%, so the description carries full burden. It mentions 'name and/or description' as updatable fields, which maps to two parameters, and notes 'thread_id' as required for retrieval from 'list_threads.' However, it does not explain the optional nature of 'name' and 'description' (nullable with defaults) or provide format examples, leaving gaps in parameter understanding.

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 specific action ('Updates'), the target resource ('name and/or description of a locally saved conversation thread'), and the scope of the update ('Both the local database and the OpenAI thread object'). It distinguishes this from sibling tools like 'delete_thread' or 'list_threads' by focusing on modification rather than deletion or listing.

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 provides clear context for when to use this tool: to modify existing threads, with a prerequisite noted ('The thread ID can be retrieved from the list_threads tool'). However, it does not explicitly state when not to use it or name alternatives (e.g., vs. 'create_new_assistant_thread' for new threads), which prevents a perfect score.

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