Skip to main content
Glama

Delete Instruction

delete_instruction

Remove a VS Code instruction file from the prompts directory to manage your development environment's custom commands and workflows.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instruction_nameYesThe name of the instruction to delete (with or without extension)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary MCP tool handler for 'delete_instruction'. It performs read-only checks, delegates to InstructionManager.delete_instruction(), and formats the response message.
    def delete_instruction(
        instruction_name: Annotated[str, "The name of the instruction to delete (with or without extension)"],
    ) -> str:
        """Delete a VS Code .instructions.md file from the prompts directory."""
        if read_only:
            return "Error: Server is running in read-only mode"
        try:
            success = instruction_manager.delete_instruction(instruction_name)
            if success:
                return f"Successfully deleted VS Code instruction: {instruction_name}"
            else:
                return f"Failed to delete VS Code instruction: {instruction_name}"
        except Exception as e:
            return f"Error deleting VS Code instruction '{instruction_name}': {str(e)}"
  • The schema definition in the tool annotations, specifying input parameters (instruction_name) and return description.
    annotations={
        "idempotentHint": False,
        "readOnlyHint": False,
        "title": "Delete Instruction",
        "parameters": {
            "instruction_name": "The name of the instruction to delete. If a full filename is provided, it will be used as-is. Otherwise, .instructions.md will be appended automatically. You can provide just the name (e.g. my-instruction) or the full filename (e.g. my-instruction.instructions.md)."
        },
        "returns": "Returns a success message if the instruction was deleted, or an error message if the operation failed or the file was not found.",
    },
  • The @app.tool decorator that registers the delete_instruction tool with the MCP server, including name, description, tags, and metadata.
    @app.tool(
        name="delete_instruction",
        description="Delete a VS Code .instructions.md file from the prompts directory.",
        tags={"public", "instruction"},
        annotations={
            "idempotentHint": False,
            "readOnlyHint": False,
            "title": "Delete Instruction",
            "parameters": {
                "instruction_name": "The name of the instruction to delete. If a full filename is provided, it will be used as-is. Otherwise, .instructions.md will be appended automatically. You can provide just the name (e.g. my-instruction) or the full filename (e.g. my-instruction.instructions.md)."
            },
            "returns": "Returns a success message if the instruction was deleted, or an error message if the operation failed or the file was not found.",
        },
        meta={
            "category": "instruction",
        },
    )
  • Core helper method in InstructionManager class that implements the file deletion logic: ensures extension, constructs path, checks existence, and calls safe_delete_file with backup.
    def delete_instruction(self, instruction_name: str) -> bool:
        """
        Delete an instruction file with automatic backup.
    
        Args:
            instruction_name: Name of the .instructions.md file
    
        Returns:
            True if successful
    
        Raises:
            FileOperationError: If file cannot be deleted
        """
    
        # Ensure filename has correct extension
        instruction_name = self._ensure_instruction_extension(instruction_name)
    
        file_path = self.prompts_dir / instruction_name
    
        if not file_path.exists():
            raise FileOperationError(f"Instruction file not found: {instruction_name}")
    
        try:
            # Use safe delete which creates backup automatically
            safe_delete_file(file_path, create_backup=True)
            logger.info(f"Deleted instruction file with backup: {instruction_name}")
            return True
    
        except Exception as e:
            raise FileOperationError(f"Error deleting instruction file {instruction_name}: {e}")
  • Top-level registration function that calls register_instruction_tools(), which in turn defines and registers the delete_instruction tool.
    def register_all_tools() -> None:
        """Register all tools with the server."""
        register_instruction_tools()
        register_chatmode_tools()
        register_library_tools()
        register_memory_tools()
        register_remember_tools()
Behavior3/5

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

Annotations indicate this is a non-readOnly, non-idempotent operation (deletion), which the description aligns with by stating 'Delete'. However, the description adds minimal behavioral context beyond annotations—it specifies the file type and location but doesn't detail effects like permanence, error handling, or confirmation requirements. With annotations covering basic safety, it earns a baseline score for slight added value.

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, direct sentence with zero wasted words—it front-loads the action and resource efficiently. Every element ('Delete', 'VS Code .instructions.md file', 'prompts directory') is essential and clearly structured, making it highly concise and easy to parse.

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?

For a deletion tool with one parameter, 100% schema coverage, and an output schema (which handles return values), the description is reasonably complete. It specifies the file type and directory, addressing key context. However, it could improve by mentioning sibling tools or deletion consequences, slightly limiting completeness for this complexity level.

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 100%, fully documenting the single parameter 'instruction_name'. The description adds no parameter-specific details beyond what the schema provides, such as examples or formatting nuances. Given high schema coverage, the baseline score of 3 is appropriate as the description doesn't enhance 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 ('Delete') and target resource ('a VS Code .instructions.md file from the prompts directory'), distinguishing it from siblings like 'delete_chatmode' which targets different resources. It precisely communicates what the tool does without ambiguity.

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 deleting instruction files, but provides no explicit guidance on when to use this versus alternatives like 'update_instruction' or prerequisites. It lacks context on exclusions or comparisons to sibling tools, leaving usage decisions to inference.

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