Skip to main content
Glama

register_style_convention

Define and store coding style conventions for consistency across projects. Specify name, description, language, examples, and metadata to standardize code formatting practices.

Instructions

Register a coding style convention.

Args: name: Name of the convention description: Description of the convention language: Programming language examples: Example code snippets demonstrating the convention metadata: Additional metadata as key-value pairs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYes
examplesNo
languageNo
metadataNo
nameYes

Implementation Reference

  • The handler function decorated as an MCP tool that registers a style convention by calling KnowledgeGraph.add_style_convention and saves the knowledge graph if a storage path is configured.
    @self.mcp.tool()
    def register_style_convention(
        name: str,
        description: str,
        language: str | None = None,
        examples: list[str] | None = None,
        metadata: dict[str, Any] | None = None,
    ) -> str:
        """Register a coding style convention.
    
        Args:
            name: Name of the convention
            description: Description of the convention
            language: Programming language
            examples: Example code snippets demonstrating the convention
            metadata: Additional metadata as key-value pairs
        """
        convention_id = self.knowledge.add_style_convention(
            name=name,
            description=description,
            language=language,
            examples=examples,
            metadata=metadata,
        )
    
        # Save knowledge if storage path is set
        if self.storage_path:
            self.knowledge.save_to_file(self.storage_path)
    
        return f"Style convention registered with ID: {convention_id}"
  • Dataclass defining the structure and fields for StyleConvention objects stored in the knowledge graph.
    class StyleConvention:
        """A coding style convention identified in the codebase."""
    
        # Basic identification
        convention_id: str
        name: str
        description: str
    
        # Convention details
        language: str | None = None
        examples: list[str] = field(default_factory=list)
    
        # Metadata
        metadata: dict[str, Any] = field(default_factory=dict)
    
        # Timestamps
        created_at: float = field(default_factory=time.time)
        updated_at: float = field(default_factory=time.time)
  • KnowledgeGraph method that implements the core logic for adding a style convention to the graph by instantiating a StyleConvention and storing it in self.style_conventions.
    def add_style_convention(
        self,
        name: str,
        description: str,
        language: str | None = None,
        examples: list[str] | None = None,
        metadata: dict[str, Any] | None = None,
    ) -> str:
        """Add a style convention to the knowledge graph.
    
        Args:
            name: The name of the convention
            description: Description of the convention
            language: The programming language
            examples: Examples of the convention
            metadata: Additional metadata
    
        Returns:
            The ID of the new convention
        """
        convention_id = self._generate_id("convention")
    
        convention = StyleConvention(
            convention_id=convention_id,
            name=name,
            description=description,
            language=language,
            examples=examples or [],
            metadata=metadata or {},
        )
    
        self.style_conventions[convention_id] = convention
        return convention_id
  • The @self.mcp.tool() decorator registers the register_style_convention function as an MCP tool within the _setup_tools method.
    # Style convention registration tool
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action ('register') which implies a write/mutation operation, but doesn't disclose any behavioral traits: no information about permissions needed, whether registration is permanent or reversible, what happens on duplicate names, rate limits, or what the tool returns. For a mutation tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with a clear purpose statement followed by parameter documentation. The structure is front-loaded with the main purpose first. However, the parameter documentation uses a simple list format without grouping or prioritization, and some sentences could be more efficient (e.g., 'Additional metadata as key-value pairs' is slightly redundant).

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

Completeness2/5

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

Given a mutation tool with 5 parameters, 0% schema description coverage, no annotations, and no output schema, the description is incomplete. It covers basic parameter identification but lacks crucial context: no information about what happens after registration, error conditions, return values, or how this tool integrates with the broader system (especially given siblings like query_style_conventions).

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 0%, so the description must compensate. It lists all 5 parameters with brief explanations that add meaning beyond the schema's property names. However, the explanations are minimal (e.g., 'Name of the convention' for 'name') and don't provide format requirements, constraints, or examples of valid values. The description adds some value but doesn't fully compensate for the 0% schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Register a coding style convention' with a specific verb ('register') and resource ('coding style convention'). It distinguishes from most siblings (e.g., query_style_conventions, register_entity, register_pattern) by focusing on style conventions specifically. However, it doesn't explicitly differentiate from register_pattern which might be conceptually similar.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use register_style_convention versus register_pattern, or how it relates to query_style_conventions. There's no context about prerequisites, typical use cases, or when not to use this tool.

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

Related 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/sarathsp06/sourcesage'

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