Skip to main content
Glama

list_chatmodes

Access and list all .chatmode.md files from the prompts directory in VS Code to manage and organize chat modes and instructions efficiently within the Mode Manager MCP server.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler function 'list_chatmodes' that fetches chatmodes from the ChatModeManager and formats a user-friendly string output listing names, descriptions, sizes, and previews.
    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)}"
  • The @app.tool decorator that registers the 'list_chatmodes' tool, including its name, description, tags, schema annotations (parameters/returns), 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", }, )
  • The core helper method in ChatModeManager that lists all .chatmode.md files by scanning the prompts directory, parsing frontmatter and content previews, and returning a sorted 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

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