Skip to main content
Glama

Delete Chatmode

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)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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()
Behavior4/5

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

Annotations indicate this is a non-readOnly, non-idempotent operation, which the description aligns with by using 'Delete'. The description adds valuable context about file location and extension handling that annotations don't cover, though it doesn't specify deletion permanence or system effects.

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?

Single sentence efficiently conveys the core action, target, and location with zero wasted words. The description is front-loaded with the essential information and appropriately sized for a simple deletion tool.

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's destructive nature, annotations cover safety aspects, and an output schema exists, the description is reasonably complete. It could benefit from mentioning deletion consequences or error scenarios, but covers the essential what-and-where adequately.

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 coverage is 100% with clear parameter documentation, so the description adds minimal value beyond the schema. It mentions 'with or without extension' which slightly clarifies the filename parameter, but doesn't provide additional semantic context like format examples or constraints.

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 ('Delete') and resource ('.chatmode.md file from the prompts directory'), distinguishing it from siblings like 'create_chatmode', 'update_chatmode', and 'list_chatmodes'. It precisely identifies what gets deleted and where it's located.

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 a chatmode file needs removal, but provides no explicit guidance on when to use this versus alternatives like 'update_chatmode' or prerequisites. It doesn't mention error conditions or when deletion might fail.

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