Skip to main content
Glama

List Chatmodes

list_chatmodes
Read-onlyIdempotent

Discover available VS Code chat modes by listing all .chatmode.md files in the prompts directory for easy selection and management.

Instructions

List all VS Code .chatmode.md files in the prompts directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main tool handler function that lists all .chatmode.md files by calling the chatmode_manager, formats the output as a readable string with name, file, description, size, and preview.
    def list_chatmodes() -> str:
        """List all VS Code .chatmode.md files in the prompts directory."""
        try:
            chatmodes = chatmode_manager.list_chatmodes()
            if not chatmodes:
                return "No VS Code chatmode files found in the prompts directory"
            result = f"Found {len(chatmodes)} VS Code chatmode(s):\n\n"
            for cm in chatmodes:
                result += f"Name: {cm['name']}\n"
                result += f"   File: {cm['filename']}\n"
                if cm["description"]:
                    result += f"   Description: {cm['description']}\n"
                result += f"   Size: {cm['size']} bytes\n"
                if cm["content_preview"]:
                    result += f"   Preview: {cm['content_preview'][:100]}...\n"
                result += "\n"
            return result
        except Exception as e:
            return f"Error listing VS Code chatmodes: {str(e)}"
  • Registers the 'list_chatmodes' tool with the MCP app, including description, tags, annotations for schema/hints, and metadata.
    @app.tool(
        name="list_chatmodes",
        description="List all VS Code .chatmode.md files in the prompts directory.",
        tags={"public", "chatmode"},
        annotations={
            "idempotentHint": True,
            "readOnlyHint": True,
            "title": "List Chatmodes",
            "returns": "Returns a formatted list of all chatmode files with their names, descriptions, sizes, and content previews. If no chatmodes are found, returns an informational message.",
        },
        meta={
            "category": "chatmode",
        },
    )
  • Schema annotations defining the tool's behavior hints, title, and return description (no input parameters).
    annotations={
        "idempotentHint": True,
        "readOnlyHint": True,
        "title": "List Chatmodes",
        "returns": "Returns a formatted list of all chatmode files with their names, descriptions, sizes, and content previews. If no chatmodes are found, returns an informational message.",
    },
  • Underlying helper method in ChatModeManager class that scans the prompts directory for .chatmode.md files, parses frontmatter and content previews, and returns a list of structured dictionaries.
    def list_chatmodes(self) -> List[Dict[str, Any]]:
        """
        List all .chatmode.md files in the prompts directory.
    
        Returns:
            List of chatmode file information
        """
        chatmodes: List[Dict[str, Any]] = []
    
        if not self.prompts_dir.exists():
            return chatmodes
    
        for file_path in self.prompts_dir.glob("*.chatmode.md"):
            try:
                frontmatter, content = parse_frontmatter_file(file_path)
    
                # Get preview of content (first 100 chars)
                content_preview = content.strip()[:100] if content.strip() else ""
    
                chatmode_info = {
                    "filename": file_path.name,
                    "name": file_path.stem.replace(".chatmode", ""),
                    "path": str(file_path),
                    "description": frontmatter.get("description", ""),
                    "tools": frontmatter.get("tools", []),
                    "frontmatter": frontmatter,
                    "content_preview": content_preview,
                    "size": file_path.stat().st_size,
                    "modified": file_path.stat().st_mtime,
                }
    
                chatmodes.append(chatmode_info)
    
            except Exception as e:
                logger.warning(f"Error reading chatmode file {file_path}: {e}")
                continue
    
        # Sort by name
        chatmodes.sort(key=lambda x: x["name"].lower())
        return chatmodes
Behavior4/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, indicating a safe, repeatable read operation. The description adds value by specifying the scope ('all' files in the 'prompts directory') and file type ('.chatmode.md'), which are not covered by annotations, enhancing behavioral context without contradiction.

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 key action ('List all') and resource details, with zero wasted words. Every element earns its place by clarifying the tool's purpose and scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, read-only/idempotent annotations, and an output schema), the description is complete. It specifies what is listed (files), where (prompts directory), and the file format, providing sufficient context without needing to explain return values or complex behaviors.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0 parameters and 100% schema description coverage, the baseline is 4 as there are no parameters to document. The description does not need to compensate for any parameter gaps, and it appropriately focuses on the tool's action and scope.

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 verb ('List') and resource ('all VS Code .chatmode.md files in the prompts directory'), making the purpose specific and unambiguous. It distinguishes from siblings like 'get_chatmode' (singular retrieval) and 'browse_mode_library' (external library exploration).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving all chatmode files in a specific directory, providing clear context. However, it does not explicitly state when to use this versus alternatives like 'browse_mode_library' for external sources or 'get_chatmode' for a single file, missing explicit exclusions or comparisons.

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