Skip to main content
Glama

delete_chatmode

Remove a VS Code chatmode file from the prompts directory to manage custom chat configurations and maintain organized workspace settings.

Instructions

Delete a VS Code .chatmode.md file from the prompts directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesThe filename of the chatmode to delete (with or without extension)

Implementation Reference

  • The MCP tool handler for 'delete_chatmode'. Checks read-only mode, calls ChatModeManager.delete_chatmode, and returns formatted success or error message.
    def delete_chatmode(
        filename: Annotated[str, "The filename of the chatmode to delete (with or without extension)"],
    ) -> str:
        """Delete a VS Code .chatmode.md file from the prompts directory."""
        if read_only:
            return "Error: Server is running in read-only mode"
        try:
            success = chatmode_manager.delete_chatmode(filename)
            if success:
                return f"Successfully deleted VS Code chatmode: {filename}"
            else:
                return f"Failed to delete VS Code chatmode: {filename}"
        except Exception as e:
            return f"Error deleting VS Code chatmode '{filename}': {str(e)}"
  • Registration decorator for the 'delete_chatmode' tool, specifying name, description, tags, input/output schema via annotations, and metadata.
    @app.tool(
        name="delete_chatmode",
        description="Delete a VS Code .chatmode.md file from the prompts directory.",
        tags={"public", "chatmode"},
        annotations={
            "idempotentHint": False,
            "readOnlyHint": False,
            "title": "Delete Chatmode",
            "parameters": {
                "filename": "The filename of the chatmode to delete. If a full filename is provided, it will be used as-is. Otherwise, .chatmode.md will be appended automatically. You can provide just the name (e.g. my-chatmode) or the full filename (e.g. my-chatmode.chatmode.md)."
            },
            "returns": "Returns a success message if the chatmode was deleted, or an error message if the operation failed or the file was not found.",
        },
        meta={
            "category": "chatmode",
        },
    )
  • Underlying helper method in ChatModeManager class that implements the file deletion logic, appending extension if needed, checking existence, and calling safe_delete_file with backup.
    def delete_chatmode(self, filename: str) -> bool:
        """
        Delete a chatmode file with automatic backup.
    
        Args:
            filename: Name of the .chatmode.md file
    
        Returns:
            True if successful
    
        Raises:
            FileOperationError: If file cannot be deleted
        """
        # 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:
            # Use safe delete which creates backup automatically
            safe_delete_file(file_path, create_backup=True)
            logger.info(f"Deleted chatmode file with backup: {filename}")
            return True
    
        except Exception as e:
            raise FileOperationError(f"Error deleting chatmode file {filename}: {e}")
  • Call to register_chatmode_tools() within register_all_tools(), which triggers the registration of all chatmode tools including delete_chatmode.
    register_chatmode_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