Skip to main content
Glama

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

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()

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