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
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 it's a query operation, implying read-only behavior, but doesn't disclose any behavioral traits like what happens if no filters are provided (e.g., returns all conventions), potential rate limits, authentication needs, or the format of results. This leaves significant gaps for a tool with no annotation coverage.

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 two sentences: one stating the purpose and another listing parameters. It's front-loaded with the main action, though the parameter explanations are brief and could be more structured. There's minimal waste, earning a high score for efficiency.

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 the complexity of querying a knowledge graph, no annotations, no output schema, and low schema coverage (0%), the description is incomplete. It doesn't explain what the tool returns (e.g., a list of conventions, details), how results are formatted, or any error conditions, making it inadequate for effective use by an AI agent.

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?

The description lists two parameters ('language' and 'convention_name') with brief explanations ('Filter by programming language' and 'Filter by convention name'), adding meaning beyond the schema which has 0% description coverage. However, it doesn't provide details like expected formats, examples, or whether these are required or optional, leaving room for improvement given the low 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 verb ('Query') and resource ('coding style conventions in the knowledge graph'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'query_entities' or 'query_patterns', which might also query the knowledge graph for different types of information.

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. With sibling tools like 'query_entities' and 'query_patterns' that also query the knowledge graph, there's no indication of what distinguishes this tool for style conventions from those for entities or patterns.

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