Skip to main content
Glama

Update Chatmode

update_chatmode

Modify existing VS Code chatmode files by updating descriptions, content, or tool configurations to maintain accurate development workflows.

Instructions

Update an existing VS Code .chatmode.md file with new description, content, or tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesThe filename of the chatmode to update (with or without extension)
descriptionNo
contentNo
toolsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function that executes the 'update_chatmode' logic. It constructs frontmatter from optional inputs and calls the ChatModeManager's update method.
    def update_chatmode(
        filename: Annotated[str, "The filename of the chatmode to update (with or without extension)"],
        description: Annotated[Optional[str], "Optional new description for the chatmode"] = None,
        content: Annotated[Optional[str], "Optional new content for the chatmode"] = None,
        tools: Annotated[Optional[str], "Optional new comma-separated list of tool names"] = None,
    ) -> str:
        """Update an existing VS Code .chatmode.md file with new description, content, or tools."""
        if read_only:
            return "Error: Server is running in read-only mode"
        try:
            frontmatter = {}
            if description is not None:
                frontmatter["description"] = description
            if isinstance(tools, str):
                frontmatter["tools"] = tools
            success = chatmode_manager.update_chatmode(filename, frontmatter if frontmatter else None, content)
            if success:
                return f"Successfully updated VS Code chatmode: {filename}"
            else:
                return f"Failed to update VS Code chatmode: {filename}"
        except Exception as e:
            return f"Error updating VS Code chatmode '{filename}': {str(e)}"
  • Core helper method in ChatModeManager that performs the actual file update by merging new frontmatter/content with existing and writing with backup.
    def update_chatmode(
        self,
        filename: str,
        frontmatter: Optional[Dict[str, Any]] = None,
        content: Optional[str] = None,
    ) -> bool:
        """
        Update an existing chatmode file.
    
        Args:
            filename: Name of the .chatmode.md file
            frontmatter: New frontmatter (optional)
            content: New content (optional)
    
        Returns:
            True if successful
    
        Raises:
            FileOperationError: If file cannot be updated
        """
        # Ensure filename has correct extension
        if not filename.endswith(".chatmode.md"):
            filename += ".chatmode.md"
    
        file_path = self.prompts_dir / filename
    
        if not file_path.exists():
            raise FileOperationError(f"Chatmode file not found: {filename}")
    
        try:
            # Read current content
            current_frontmatter, current_content = parse_frontmatter_file(file_path)
    
            # Use provided values or keep current ones
            new_frontmatter = frontmatter if frontmatter is not None else current_frontmatter
            new_content = content if content is not None else current_content
    
            success = write_frontmatter_file(file_path, new_frontmatter, new_content, create_backup=True)
            if success:
                logger.info(f"Updated chatmode file with backup: {filename}")
            return success
    
        except Exception as e:
            raise FileOperationError(f"Error updating chatmode file {filename}: {e}")
  • The @app.tool decorator defining the tool schema, including input parameter descriptions and return description.
    @app.tool(
        name="update_chatmode",
        description="Update an existing VS Code .chatmode.md file with new description, content, or tools.",
        tags={"public", "chatmode"},
        annotations={
            "idempotentHint": False,
            "readOnlyHint": False,
            "title": "Update Chatmode",
            "parameters": {
                "filename": "The filename of the chatmode to update. If .chatmode.md extension is not provided, it will be added automatically.",
                "description": "Optional new description for the chatmode. If not provided, the existing description will be kept.",
                "content": "Optional new content for the chatmode. If not provided, the existing content will be kept.",
                "tools": "Optional new comma-separated list of tool names. If not provided, the existing tools will be kept.",
            },
            "returns": "Returns a success message if the chatmode was updated, or an error message if the operation failed.",
        },
        meta={
            "category": "chatmode",
        },
    )
  • Top-level registration call to register_all_tools(), which includes register_chatmode_tools() defining the update_chatmode tool.
    register_all_tools()
Behavior3/5

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

Annotations indicate this is a write operation (readOnlyHint=false) and not idempotent (idempotentHint=false). The description adds context about updating specific fields in a file, but doesn't disclose behavioral traits like whether the file must exist, what happens on partial updates, error conditions, or authentication requirements. It doesn't contradict annotations but adds minimal value beyond them.

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 a single, efficient sentence that front-loads the core purpose. Every word contributes to understanding the tool's function without redundancy or unnecessary elaboration, making it appropriately sized for its complexity.

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

Completeness3/5

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

Given the tool has annotations and an output schema, the description covers the basic update operation. However, for a mutation tool with low schema coverage and multiple parameters, it lacks details on error handling, file existence requirements, and field-specific behaviors. The presence of an output schema reduces the need to explain returns, but more context on usage would improve completeness.

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 low (25%), with only 'filename' documented. The description mentions 'description, content, or tools' which maps to three parameters, adding some semantic meaning beyond the schema. However, it doesn't explain parameter formats, constraints, or interactions, leaving gaps in understanding the four parameters.

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 action ('Update') and resource ('existing VS Code .chatmode.md file'), specifying what fields can be modified ('new description, content, or tools'). It distinguishes from 'create_chatmode' by focusing on updates, though it doesn't explicitly differentiate from 'update_chatmode_from_source' which handles updates from external sources.

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

Usage Guidelines3/5

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

The description implies usage when modifying an existing chatmode file, but provides no explicit guidance on when to use this versus alternatives like 'update_chatmode_from_source' or 'create_chatmode'. It mentions what can be updated but doesn't specify prerequisites, constraints, or when-not-to-use scenarios.

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/NiclasOlofsson/mode-manager-mcp'

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