Skip to main content
Glama

list_examples

Browse available Ilograph example diagrams to learn diagram creation, with filtering by complexity level to find suitable starting points.

Instructions

Lists available Ilograph example diagrams, optionally filtering by category. Args: category: Filter examples by complexity ('beginner', 'intermediate', 'advanced'). Returns: A dictionary containing a list of available examples and a message guiding the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo

Implementation Reference

  • Registers the list_examples tool using the @mcp.tool decorator, specifying name, title, readOnlyHint, and description.
    @mcp.tool( name="list_examples", annotations={ "title": "List Available Example Diagrams", "readOnlyHint": True, "description": "Lists available Ilograph example diagrams with their categories and descriptions.", }, )
  • Implements the core logic of the list_examples tool: filters examples by optional category parameter, formats summaries, and returns list or error message.
    async def list_examples_tool( category: Optional[Literal["beginner", "intermediate", "advanced"]] = None, ) -> Dict[str, Any]: """ Lists available Ilograph example diagrams, optionally filtering by category. Args: category: Filter examples by complexity ('beginner', 'intermediate', 'advanced'). Returns: A dictionary containing a list of available examples and a message guiding the user. """ examples_to_list: List[ExampleMetadata] = list(EXAMPLES_DATABASE.values()) if category: examples_to_list = [ex for ex in examples_to_list if ex.category == category] if not examples_to_list: return { "message": f"No examples found for category '{category}'. Try again without a category to see all examples." } return { "examples": [_get_example_summary(ex) for ex in examples_to_list], "message": "To get the full content of an example, use the 'fetch_example' tool with its 'example_name'.", }
  • Pydantic BaseModel defining the structure of example metadata, used in the database and for serializing responses.
    class ExampleMetadata(BaseModel): """Defines the metadata structure for an Ilograph example.""" name: str category: Literal["beginner", "intermediate", "advanced"] description: str learning_objectives: List[str] = Field(default_factory=list) patterns_demonstrated: List[str] = Field(default_factory=list) @property def file_path(self) -> Path: """Returns the full path to the example file.""" return EXAMPLES_DIR / self.name
  • Utility function to generate a concise summary dictionary from ExampleMetadata instance.
    def _get_example_summary(metadata: ExampleMetadata) -> Dict[str, Any]: """Returns a concise summary of an example.""" return metadata.model_dump(include={"name", "category", "description"})
  • Calls register_example_tools(mcp) during server initialization to register the list_examples tool among others.
    register_example_tools(mcp)

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/QuincyMillerDev/ilograph-mcp-server'

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