fetch_spec_tool
Retrieve the official Ilograph specification to access structured property definitions, types, and requirements for validation and reference.
Instructions
Fetches the official Ilograph specification from https://www.ilograph.com/docs/spec/
This tool provides the authoritative reference for all Ilograph properties, types,
and requirements in a structured table format - perfect for validation and quick lookups.
Returns:
str: Complete specification in markdown format with:
- Top-level properties table
- Resource properties and types
- Perspective properties and types
- Relation, Sequence, Step definitions
- Context, Layout, Import specifications
- All property types and requirements
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The primary handler `async def fetch_spec_tool(ctx: Context) -> str` decorated with @mcp.tool. Fetches Ilograph spec from official source using get_fetcher().fetch_specification(), adds markdown header/footer, logs actions via ctx.info/error, and returns formatted content or error message.@mcp.tool( annotations={ "title": "Fetch Ilograph Specification", "readOnlyHint": True, "description": "Fetches the concise Ilograph specification with property definitions and types", } ) async def fetch_spec_tool(ctx: Context) -> str: """ Fetches the official Ilograph specification from https://www.ilograph.com/docs/spec/ This tool provides the authoritative reference for all Ilograph properties, types, and requirements in a structured table format - perfect for validation and quick lookups. Returns: str: Complete specification in markdown format with: - Top-level properties table - Resource properties and types - Perspective properties and types - Relation, Sequence, Step definitions - Context, Layout, Import specifications - All property types and requirements """ try: # Log the request await ctx.info("Fetching Ilograph specification from official source") # Get fetcher instance fetcher = get_fetcher() # Fetch specification content content = await fetcher.fetch_specification() if content is None: error_msg = "Failed to fetch Ilograph specification. The content may be temporarily unavailable." await ctx.error(error_msg) return f"Error: {error_msg}" # Add metadata header to the content content_with_header = f"""# Ilograph Specification **Source:** https://www.ilograph.com/docs/spec/ **Description:** Official Ilograph YAML format specification with complete property definitions **Last Updated:** Fetched on demand from official Ilograph documentation This specification provides the authoritative reference for all Ilograph diagram properties, types, and requirements. Use this for validation, quick property lookups, and understanding the complete Ilograph schema. --- {content} --- *This specification was fetched from the official Ilograph website and converted to markdown format for easy consumption. For the most up-to-date information, visit https://www.ilograph.com/docs/spec/* """ await ctx.info( f"Successfully fetched Ilograph specification ({len(content)} characters)" ) return content_with_header except Exception as e: error_msg = f"Unexpected error fetching Ilograph specification: {str(e)}" await ctx.error(error_msg) return f"Error: An unexpected error occurred while fetching the specification. Please try again later." @mcp.tool(
- @mcp.tool decorator annotations defining tool metadata: title 'Fetch Ilograph Specification', readOnlyHint True, description of purpose.@mcp.tool( annotations={ "title": "Fetch Ilograph Specification", "readOnlyHint": True, "description": "Fetches the concise Ilograph specification with property definitions and types", } )
- src/ilograph_mcp/server.py:64-65 (registration)Explicit registration call `register_fetch_spec_tool(mcp)` in create_server() function, followed by log confirmation.register_fetch_spec_tool(mcp) logger.info("Registered fetch_spec_tool")
- get_tool_info() returns dict with 'name': 'fetch_spec_tool', description, and tools list including 'fetch_spec_tool' and 'check_spec_health'.def get_tool_info() -> dict: """Get information about the specification tools for registration.""" return { "name": "fetch_spec_tool", "description": "Fetches the official Ilograph specification with structured property definitions", "tools": [ "fetch_spec_tool", "check_spec_health", ], }
- src/ilograph_mcp/tools/register_fetch_spec_tool.py:18-20 (registration)def register_fetch_spec_tool(mcp: FastMCP) -> None: the function that defines/registers the tool(s) when called.def register_fetch_spec_tool(mcp: FastMCP) -> None: """Register the fetch specification tool with the FastMCP server."""