get_meme_info
Retrieve meme template details and text placeholder requirements to prepare content for meme generation.
Instructions
Get information about available memes and their text placeholder requirements.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meme_name | No | Optional: Get info for a specific meme |
Implementation Reference
- app/server.py:159-196 (handler)The handler and registration for the 'get_meme_info' tool. This async function retrieves meme configuration information, either for all available memes or a specific one, using the get_meme_configs() helper.@mcp.tool() async def get_meme_info( meme_name: Annotated[ str | None, Field(description="Optional: Get info for a specific meme") ] = None, ) -> dict: """Get information about available memes and their text placeholder requirements.""" meme_configs = get_meme_configs() if meme_name: if meme_name not in meme_configs: return {"status": "error", "message": f"Unknown meme type: {meme_name}"} config = meme_configs[meme_name] placeholder_names = list(config.placeholders.keys()) return { "status": "success", "meme_name": meme_name, "template_file": config.template_file, "placeholder_names": placeholder_names, "example_usage": { "meme_name": meme_name, "texts": {name: f"Example {name}" for name in placeholder_names}, }, } else: all_memes = {} for meme_type, config in meme_configs.items(): all_memes[meme_type] = { "placeholder_names": list(config.placeholders.keys()), "template_file": config.template_file, } return { "status": "success", "available_memes": all_memes, "total_memes": len(all_memes), }
- app/utils.py:65-76 (helper)Supporting utility function that loads meme configurations from JSON file and validates them using Pydantic MemeConfig model from types.py. Called by get_meme_info to fetch data.@cache def get_meme_configs() -> dict[str, MemeConfig]: if _dev_mode: config_path = get_bundle_dir() / "meme_configs.json" elif config_path := os.environ.get("MEME_GENERATOR_MCP_CONFIGS_PATH"): config_path = Path(config_path) else: config_path = get_config_dir() / "meme_configs.json" with open(config_path) as f: raw = json.load(f) return {name: MemeConfig.model_validate(config) for name, config in raw.items()}
- app/types.py:19-22 (schema)Pydantic model defining the structure of meme configurations used by get_meme_info via get_meme_configs().class MemeConfig(BaseModel): template_file: str placeholders: dict[str, TextPlaceholder]