Skip to main content
Glama

list_principles

Display configured principles from YAML/JSON files to guide AI decision-making and maintain alignment with established guidelines.

Instructions

List your configured principles. Principles are loaded from the YAML/JSON file specified in config.toml.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `list_principles` tool is defined within the `_register_principles` function in `brain_mcp/server/server.py`. It uses the `mcp.tool()` decorator for registration and reads principles via `get_principles()`.
    @mcp.tool()
    def list_principles() -> str:
        """
        List your configured principles.
        Principles are loaded from the YAML/JSON file specified in config.toml.
        """
        principles = get_principles()
    
        if not principles:
            return "No principles configured. Add a principles file to config.toml."
    
        # Support both flat list and nested dict formats
        section = principles.get("principles", principles)
    
        if isinstance(section, list):
            output = ["## Your Principles\n"]
            for i, p in enumerate(section, 1):
                if isinstance(p, dict):
                    name = p.get("name", f"Principle {i}")
                    desc = p.get("description", p.get("definition", ""))[:200]
                    output.append(f"**{i}. {name}**")
                    output.append(f"> {desc}\n")
                else:
                    output.append(f"**{i}.** {p}\n")
            return "\n".join(output)
    
        elif isinstance(section, dict):
            output = ["## Your Principles\n"]
            for key in sorted(section.keys()):
                principle = section[key]
                if isinstance(principle, dict):
                    name = principle.get("name", key)
                    definition = principle.get("definition", "")[:200]
                    output.append(f"**{key.upper()}. {name}**")
                    output.append(f"> {definition}\n")
                else:
                    output.append(f"**{key}**: {principle}\n")
            return "\n".join(output)
    
        return "Principles format not recognized."

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/mordechaipotash/brain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server