Skip to main content
Glama

DocAgent

by vinnyfds
render.pyโ€ข1.04 kB
"""Template rendering utilities for DocGen Suite""" from pathlib import Path from typing import Any, Dict from jinja2 import Environment, FileSystemLoader, StrictUndefined def render_template(template_name: str, data: Dict[str, Any]) -> str: """Render a Jinja2 template with strict undefined handling""" # Get the templates directory templates_dir = Path(__file__).parent.parent / "prompts" # Create Jinja2 environment with strict undefined env = Environment( loader=FileSystemLoader(str(templates_dir)), undefined=StrictUndefined, trim_blocks=True, lstrip_blocks=True ) # Load and render template template = env.get_template(template_name) return template.render(**data) def render_template_from_string(template_string: str, data: Dict[str, Any]) -> str: """Render a Jinja2 template from string content""" env = Environment( undefined=StrictUndefined, trim_blocks=True, lstrip_blocks=True ) template = env.from_string(template_string) return template.render(**data)

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/vinnyfds/docagent'

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