Skip to main content
Glama

Create Chatmode

create_chatmode

Create a new VS Code chatmode file with custom instructions and tools to manage conversation workflows in development environments.

Instructions

Create a new VS Code .chatmode.md file with the specified description, content, and tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesThe filename for the new chatmode (with or without extension)
descriptionYesA brief description of what this chatmode does
contentYesThe main content/instructions for the chatmode in markdown format
toolsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function implementing the core logic for creating a chatmode file. It processes input parameters, checks read-only mode, parses the tools list, calls the ChatModeManager, and returns a formatted success or error message.
    def create_chatmode(
        filename: Annotated[str, "The filename for the new chatmode (with or without extension)"],
        description: Annotated[str, "A brief description of what this chatmode does"],
        content: Annotated[str, "The main content/instructions for the chatmode in markdown format"],
        tools: Annotated[Optional[str], "Optional comma-separated list of tool names"] = None,
    ) -> str:
        """Create a new VS Code .chatmode.md file with the specified description, content, and tools."""
        if read_only:
            return "Error: Server is running in read-only mode"
        try:
            tools_list = tools.split(",") if tools else None
            success = chatmode_manager.create_chatmode(filename, description, content, tools_list)
            if success:
                return f"Successfully created VS Code chatmode: {filename}"
            else:
                return f"Failed to create VS Code chatmode: {filename}"
        except Exception as e:
            return f"Error creating VS Code chatmode '{filename}': {str(e)}"
  • Registration of the 'create_chatmode' tool using the @app.tool decorator. Includes name, description, tags, detailed input/output schema in annotations.parameters and annotations.returns, and metadata.
    @app.tool(
        name="create_chatmode",
        description="Create a new VS Code .chatmode.md file with the specified description, content, and tools.",
        tags={"public", "chatmode"},
        annotations={
            "idempotentHint": False,
            "readOnlyHint": False,
            "title": "Create Chatmode",
            "parameters": {
                "filename": "The filename for the new chatmode. If .chatmode.md extension is not provided, it will be added automatically.",
                "description": "A brief description of what this chatmode does. This will be stored in the frontmatter.",
                "content": "The main content/instructions for the chatmode in markdown format.",
                "tools": "Optional comma-separated list of tool names that this chatmode should have access to.",
            },
            "returns": "Returns a success message if the chatmode was created, or an error message if the operation failed.",
        },
        meta={
            "category": "chatmode",
        },
    )
  • Type annotations and descriptions for the input parameters of the create_chatmode handler, providing schema validation hints.
    filename: Annotated[str, "The filename for the new chatmode (with or without extension)"],
    description: Annotated[str, "A brief description of what this chatmode does"],
    content: Annotated[str, "The main content/instructions for the chatmode in markdown format"],
    tools: Annotated[Optional[str], "Optional comma-separated list of tool names"] = None,
  • Supporting helper method in ChatModeManager class that handles the actual creation of the .chatmode.md file: adds extension if needed, checks for existence, constructs frontmatter dict, and writes the file using write_frontmatter_file utility.
    def create_chatmode(
        self,
        filename: str,
        description: str,
        content: str,
        tools: Optional[List[str]] = None,
    ) -> bool:
        """
        Create a new chatmode file.
    
        Args:
            filename: Name for the new .chatmode.md file
            description: Description of the chatmode
            content: Chatmode content/instructions
            tools: List of tools (optional)
    
        Returns:
            True if successful
    
        Raises:
            FileOperationError: If file cannot be created
        """
        # Ensure filename has correct extension
        if not filename.endswith(".chatmode.md"):
            filename += ".chatmode.md"
    
        file_path = self.prompts_dir / filename
    
        if file_path.exists():
            raise FileOperationError(f"Chatmode file already exists: {filename}")
    
        # Create frontmatter
        frontmatter: Dict[str, Any] = {"description": description}
    
        if tools:
            frontmatter["tools"] = tools
    
        try:
            success = write_frontmatter_file(file_path, frontmatter, content, create_backup=False)
            if success:
                logger.info(f"Created chatmode file: {filename}")
            return success
    
        except Exception as e:
            raise FileOperationError(f"Error creating chatmode file {filename}: {e}")
  • Central registration function that invokes register_chatmode_tools() among others to register all MCP tools with the server.
    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()
Behavior4/5

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

Annotations provide readOnlyHint=false and idempotentHint=false, indicating this is a write operation that's not idempotent. The description adds valuable context about what gets created (a VS Code .chatmode.md file) and what components it includes (description, content, tools), which goes beyond the annotations. However, it doesn't mention potential side effects, error conditions, or authentication requirements.

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 action and includes all essential components. Every word earns its place - 'Create', 'new VS Code .chatmode.md file', and the three parameter categories are all necessary information with zero waste.

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 that this tool has annotations (readOnlyHint=false, idempotentHint=false), an output schema exists, and schema description coverage is good (75%), the description is reasonably complete. It clearly states what the tool creates and the required components. The main gap is lack of explicit guidance on when to use this versus sibling tools like 'create_instruction' or 'update_chatmode'.

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?

With 75% schema description coverage (3 of 4 parameters have descriptions in the schema), the baseline is 3. The description mentions 'specified description, content, and tools' which aligns with parameter names but doesn't add meaningful semantics beyond what's already in the schema descriptions. The 'tools' parameter's optional nature is covered in the schema but not emphasized in the description.

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 ('Create a new VS Code .chatmode.md file') and specifies the resource being created. It distinguishes from sibling tools like 'update_chatmode', 'delete_chatmode', and 'get_chatmode' by focusing exclusively on creation rather than modification, retrieval, or deletion.

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 context (creating a chatmode file in VS Code) but doesn't explicitly state when to use this tool versus alternatives like 'update_chatmode' or 'create_instruction'. It mentions the file type (.chatmode.md) which provides some guidance, but lacks explicit when/when-not statements or named alternatives.

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