create_mindmap_from_mermaid_simple
Convert Mermaid mindmap text to a MindManager mindmap using simplified syntax. Deserializes Mermaid diagrams for visual mind mapping.
Instructions
Deserializes a Mermaid mindmap in simplified syntax and creates a MindManager mindmap from it.
Args:
mermaid (str): Mermaid text describing the desired mindmap.
turbo_mode (bool): Enable turbo mode (text-only operations). Defaults to True.
Returns:
Dict[str, str]: Status dictionary indicating success or error details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mermaid | Yes | ||
| turbo_mode | No |
Implementation Reference
- mindm_mcp/server.py:397-422 (handler)The primary handler for the 'create_mindmap_from_mermaid_simple' tool. It validates input, calls the helper to deserialize and create the mindmap, handles errors, and returns status.@mcp.tool() async def create_mindmap_from_mermaid_simple( mermaid: str, turbo_mode: bool = True ) -> Dict[str, str]: """ Deserializes a Mermaid mindmap in simplified syntax and creates a MindManager mindmap from it. Args: mermaid (str): Mermaid text describing the desired mindmap. turbo_mode (bool): Enable turbo mode (text-only operations). Defaults to True. Returns: Dict[str, str]: Status dictionary indicating success or error details. """ if not mermaid or not mermaid.strip(): return {"error": "Invalid Input", "message": "Mermaid content is required."} try: print("Creating mindmap from Mermaid diagram (simple).", file=sys.stderr) _deserialize_mermaid_simple(mermaid=mermaid, turbo_mode=turbo_mode) print("Mindmap created from Mermaid diagram (simple).", file=sys.stderr) return {"status": "success", "message": "Mindmap created from Mermaid diagram (simple)."} except Exception as e: return _handle_mindmanager_error("create_mindmap_from_mermaid_simple", e)
- mindm_mcp/server.py:140-145 (helper)Key helper function that performs the deserialization of simple Mermaid input into a MindmapDocument and creates the mindmap in MindManager.def _deserialize_mermaid_simple(mermaid="", turbo_mode=True): deserialized = serialization.deserialize_mermaid_simple(mermaid) document = _get_document_instance(turbo_mode=turbo_mode) document.mindmap = deserialized document.create_mindmap() return None
- mindm_mcp/server.py:72-81 (helper)Helper function used by the tool handler to format and return MindManager-related errors in a standardized MCP response format.def _handle_mindmanager_error(func_name: str, e: Exception) -> Dict[str, str]: """Formats MindManager errors for MCP response.""" error_message = f"Error during MindManager operation '{func_name}': {e}" print(f"ERROR: {error_message}", file=sys.stderr) # Check for specific known errors from mindm.mindmanager if possible if "No document found" in str(e): return {"error": "MindManager Error", "message": "No document found or MindManager not running."} # Add more specific error checks here based on mindm library return {"error": "MindManager Error", "message": f"An error occurred: {e}"}
- mindm_mcp/server.py:397-397 (registration)The @mcp.tool() decorator registers this function as an MCP tool with the name 'create_mindmap_from_mermaid_simple' in FastMCP.@mcp.tool()