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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.6/5.0
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It does not mention whether the tool overwrites existing conventions, side effects, persistence, authorization needs, or return behavior. 'Register' implies creation but lacks specifics.

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

Conciseness3/5

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

The description is concise but the Args list repeats information already clear from the parameter names and required status. It could be more compact by removing redundant individual descriptions.

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?

With 5 parameters, no output schema, and no annotations, the description fails to explain return values, error conditions, or side effects. It is insufficient for an agent to use confidently without additional context.

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

Parameters2/5

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

Schema description coverage is 0%, yet the description's parameter explanations (e.g., 'Name of the convention') are trivial and add no meaning beyond the parameter names in the schema. They do not provide types, constraints, formats, or usage examples.

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 'Register a coding style convention' with a specific verb and resource. However, it does not explicitly differentiate from sibling registration tools like register_entity or register_pattern beyond the resource name.

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 vs alternatives (e.g., register_entity, query_style_conventions). It does not mention prerequisites, exclusions, or that query_style_conventions is for retrieval.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.