Skip to main content
Glama
ggerve

Coding Standards MCP Server

by ggerve

list_templates

Access and browse coding style templates grouped by type and language to enforce consistent standards across Java, Python, and React projects.

Instructions

List all available templates grouped by type and language

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.py:32-58 (handler)
    The handler function for the 'list_templates' tool. It scans the 'templates' directory, categorizes Markdown files by language and type (style_guides or best_practices) using get_template_info, sorts the lists, and returns a structured dictionary or error.
    @mcp.tool() def list_templates() -> Dict[str, Dict[str, List[str]]]: """List all available templates grouped by type and language""" template_dir = os.path.join(os.path.dirname(__file__), "templates") templates = { "style_guides": {"languages": [], "files": []}, "best_practices": {"languages": [], "files": []} } try: for filename in os.listdir(template_dir): if filename.endswith('.md'): template_info = get_template_info(filename) if template_info: template_type = template_info["type"] templates[template_type]["languages"].append(template_info["language"]) templates[template_type]["files"].append(filename) # Sort the lists for consistent output for template_type in templates: templates[template_type]["languages"].sort() templates[template_type]["files"].sort() return templates except Exception as e: return {"error": f"Failed to list templates: {str(e)}"}
  • Helper function used by list_templates to parse filename and determine the language and type (style_guides or best_practices) using a regex pattern.
    def get_template_info(filename: str) -> Optional[Dict[str, str]]: """Extract template type and language from filename""" pattern = r"^(\w+)_(style_guide|best_practices)\.md$" match = re.match(pattern, filename) if match: language, template_type = match.groups() return { "language": language, "type": "style_guides" if template_type == "style_guide" else "best_practices" } return None
  • server.py:32-32 (registration)
    The @mcp.tool() decorator registers the list_templates function as an MCP tool.
    @mcp.tool()

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/ggerve/coding-standards-mcp'

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