Skip to main content
Glama

query_style_conventions

Retrieve coding style conventions from SourceSage’s knowledge graph by specifying language or convention name. Simplify adherence to code standards across projects.

Instructions

Query coding style conventions in the knowledge graph.

Args: language: Filter by programming language convention_name: Filter by convention name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
convention_nameNo
languageNo

Implementation Reference

  • The MCP tool handler function for 'query_style_conventions'. Registered via @self.mcp.tool() decorator. Implements the core logic: queries the KnowledgeGraph helper method, formats results into a readable string output.
    @self.mcp.tool()
    def query_style_conventions(
        language: str | None = None, convention_name: str | None = None
    ) -> str:
        """Query coding style conventions in the knowledge graph.
    
        Args:
            language: Filter by programming language
            convention_name: Filter by convention name
        """
        conventions = self.knowledge.find_style_conventions(
            name=convention_name, language=language
        )
    
        if not conventions:
            return "No style conventions found matching the query criteria"
    
        # Format results
        output = f"Found {len(conventions)} style conventions:\n\n"
    
        for convention in conventions:
            output += f"Name: {convention.name}\n"
    
            if convention.language:
                output += f"Language: {convention.language}\n"
    
            output += f"Description: {convention.description}\n"
    
            if convention.examples:
                output += "Examples:\n"
                for i, example in enumerate(convention.examples):
                    output += f"Example {i + 1}:\n"
                    output += "```\n"
                    output += example
                    output += "\n```\n"
    
            output += "\n"
    
        return output
  • Helper method in KnowledgeGraph class that retrieves style conventions matching the given name and/or language filters. Called by the tool handler to fetch the data.
    def find_style_conventions(
        self, name: str | None = None, language: str | None = None
    ) -> list[StyleConvention]:
        """Find style conventions by name and/or language.
    
        Args:
            name: Optional convention name to search for
            language: Optional language to filter by
    
        Returns:
            List of matching conventions
        """
        results = []
    
        for convention in self.style_conventions.values():
            if (name is None or convention.name == name) and (
                language is None or convention.language == language
            ):
                results.append(convention)
    
        return results

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool queries conventions but does not disclose behaviors like read-only nature, potential limits, or side effects. The description is too minimal to provide adequate transparency.

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 extremely concise, using a single sentence to state the purpose and two lines for parameter explanations. No unnecessary words or repetition, earning its place.

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

Completeness3/5

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

For a query tool with two optional parameters and no output schema, the description covers the basic purpose and filter options but omits what the return data looks like or any default behavior. Some context is missing.

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

Parameters4/5

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

The input schema has no descriptions for parameters (0% coverage), but the description adds 'Filter by' semantics for both 'language' and 'convention_name'. This provides functional meaning beyond type definitions, though it could be more detailed.

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 'Query coding style conventions in the knowledge graph', specifying the action (query) and resource (coding style conventions). It distinguishes itself from sibling tools like query_entities and query_patterns by targeting a specific resource type.

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 like query_entities or query_patterns. It does not mention prerequisites or context for usage, leaving the agent to infer from the name alone.

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