Skip to main content
Glama

Get Chatmode

get_chatmode
Read-onlyIdempotent

Retrieve raw content from VS Code .chatmode.md files to access and manage chatmode configurations for development workflows.

Instructions

Get the raw content of a VS Code .chatmode.md file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesThe filename of the chatmode to retrieve (with or without extension)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that executes the 'get_chatmode' tool logic, retrieving raw content via chatmode_manager.
    def get_chatmode(
        filename: Annotated[str, "The filename of the chatmode to retrieve (with or without extension)"],
    ) -> str:
        """Get the raw content of a VS Code .chatmode.md file."""
        try:
            if not filename.endswith(".chatmode.md"):
                filename += ".chatmode.md"
            raw_content = chatmode_manager.get_raw_chatmode(filename)
            return raw_content
        except Exception as e:
            return f"Error getting VS Code chatmode '{filename}': {str(e)}"
  • Registers the 'get_chatmode' tool with the MCP app, defining its metadata, description, parameters, and return info.
    @app.tool(
        name="get_chatmode",
        description="Get the raw content of a VS Code .chatmode.md file.",
        tags={"public", "chatmode"},
        annotations={
            "idempotentHint": True,
            "readOnlyHint": True,
            "title": "Get Chatmode",
            "parameters": {
                "filename": "The filename of the chatmode to retrieve. 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 the raw markdown content of the specified chatmode file, or an error message if not found. Display recommendation: If the file is longer than 40 lines, show the first 10 lines, then '........', then the last 10 lines.",
        },
        meta={
            "category": "chatmode",
        },
    )
  • Core helper method in ChatModeManager that reads the raw content of a .chatmode.md file from disk.
    def get_raw_chatmode(self, filename: str) -> str:
        """
        Get the raw file content of a specific chatmode file without any processing.
    
        Args:
            filename: Name of the .chatmode.md file
    
        Returns:
            Raw file content as string
    
        Raises:
            FileOperationError: If file cannot be read
        """
        # 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:
            with open(file_path, "r", encoding="utf-8") as f:
                return f.read()
    
        except Exception as e:
            raise FileOperationError(f"Error reading raw chatmode file {filename}: {e}")
Behavior4/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, indicating safe, repeatable reads. The description adds useful context beyond annotations by specifying it retrieves 'raw content' (not processed or summarized) and clarifies the file type (VS Code .chatmode.md), which helps the agent understand what to expect. No contradiction with annotations exists.

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 with zero wasted words. It's front-loaded with the core purpose ('Get the raw content'), and every element (file type, action, resource) earns its place without redundancy or fluff.

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 low complexity (single parameter, read-only), high schema coverage (100%), presence of annotations (readOnlyHint, idempotentHint), and an output schema (implied by 'Has output schema: true'), the description is reasonably complete. It could slightly improve by hinting at the return format (e.g., 'raw content' suggests text), but annotations and output schema reduce this need.

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%, with the parameter 'filename' fully documented in the schema. The description doesn't add any parameter-specific details beyond what the schema provides (e.g., no examples of valid filenames or extension handling). Baseline 3 is appropriate as the schema carries the full parameter documentation burden.

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 ('Get the raw content') and target resource ('a VS Code .chatmode.md file'), distinguishing it from siblings like 'list_chatmodes' (which lists files) and 'create_chatmode' (which creates files). The verb 'Get' precisely indicates retrieval rather than modification.

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 for retrieving content of a specific chatmode file, but provides no explicit guidance on when to use this versus alternatives like 'list_chatmodes' (for browsing) or 'get_instruction' (for different file types). It doesn't mention prerequisites or exclusions, leaving usage context inferred rather than stated.

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