get_mindmap
Retrieve mind map structures from MindManager to analyze content, extract text, or export to formats like Mermaid, Markdown, and JSON.
Instructions
Retrieves the current mind map structure from MindManager.
Args:
mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'.
turbo_mode (bool): Enable turbo mode (text only). Defaults to False.
Returns:
Dict[str, Any]: Serialized mind map structure or error dictionary.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | full | |
| turbo_mode | No |
Implementation Reference
- mindm_mcp/server.py:171-193 (handler)The @mcp.tool()-decorated async function that implements the core logic of the 'get_mindmap' MCP tool. It fetches the mindmap from MindManager using helper functions, serializes it, and handles errors.@mcp.tool() async def get_mindmap( mode: str = 'full', turbo_mode: bool = False ) -> Dict[str, Any]: """ Retrieves the current mind map structure from MindManager. Args: mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'. turbo_mode (bool): Enable turbo mode (text only). Defaults to False. Returns: Dict[str, Any]: Serialized mind map structure or error dictionary. """ try: print(f"Calling get_mindmap(mode={mode}, turbo_mode={turbo_mode})", file=sys.stderr) mindmap = _get_mindmap_content(mode=mode, turbo_mode=turbo_mode) print("get_mindmap successful, returning serialized mindmap.", file=sys.stderr) return _serialize_result(mindmap) except Exception as e: return _handle_mindmanager_error("get_mindmap", e)
- mindm_mcp/server.py:117-122 (helper)Helper function that creates a MindmapDocument instance and retrieves the mindmap content by calling document.get_mindmap().def _get_mindmap_content(mode='content', turbo_mode=False): document = _get_document_instance(turbo_mode=turbo_mode) if document.get_mindmap(mode=mode): return document.mindmap return None
- mindm_mcp/server.py:87-102 (helper)Helper function that instantiates the MindmapDocument required for interacting with MindManager.def _get_document_instance( charttype: str = 'auto', turbo_mode: bool = False, inline_editing_mode: bool = False, mermaid_mode: bool = True, macos_access: str = MACOS_ACCESS_METHOD ) -> MindmapDocument: document = MindmapDocument( charttype=charttype, turbo_mode=turbo_mode, inline_editing_mode=inline_editing_mode, mermaid_mode=mermaid_mode, macos_access=macos_access ) return document
- mindm_mcp/server.py:57-71 (helper)Helper function used to serialize the mindmap data into JSON-compatible format for the MCP response.def _serialize_result(data: Any) -> Union[Dict, List, str, int, float, bool, None]: """Helper to serialize results, especially MindmapTopic structures.""" if isinstance(data, (MindmapTopic, list)): # Use simple serialization for MCP results unless full detail is needed return serialization.serialize_object_simple(data) elif isinstance(data, tuple): # Tuples are often JSON serializable directly if elements are return list(data) # Convert to list for guaranteed JSON compatibility elif isinstance(data, (dict, str, int, float, bool, type(None))): return data else: # Attempt string conversion for unknown types print(f"Warning: Serializing unknown type {type(data)} as string.", file=sys.stderr) return str(data)