serialize_current_mindmap_to_json
Convert the active mind map to structured JSON data with customizable detail levels for integration and analysis.
Instructions
Serializes the currently loaded mindmap to a detailed JSON object with ID mapping.
Args:
ignore_rtf (bool): Whether to ignore RTF content. Defaults to True.
mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'.
turbo_mode (bool): Enable turbo mode (text only). Defaults to False.
Returns:
Union[Dict[str, Any], Dict[str, str]]: JSON serializable dictionary or error dictionary.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ignore_rtf | No | ||
| mode | No | full | |
| turbo_mode | No |
Implementation Reference
- mindm_mcp/server.py:335-360 (handler)The primary FastMCP tool handler decorated with @mcp.tool(). It handles parameters, calls the internal _serialize_json helper, serializes the result, and manages errors. This is both the implementation and registration of the tool.@mcp.tool() async def serialize_current_mindmap_to_json( ignore_rtf: bool = True, mode: str = 'full', turbo_mode: bool = True ) -> Union[Dict[str, Any], Dict[str, str]]: """ Serializes the currently loaded mindmap to a detailed JSON object with ID mapping. Args: ignore_rtf (bool): Whether to ignore RTF content. Defaults to True. mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'. turbo_mode (bool): Enable turbo mode (text only). Defaults to False. Returns: Union[Dict[str, Any], Dict[str, str]]: JSON serializable dictionary or error dictionary. """ try: print(f"Serializing current mindmap to detailed JSON (ignore_rtf={ignore_rtf}).", file=sys.stderr) json_obj = _serialize_json(ignore_rtf=ignore_rtf, mode=mode, turbo_mode=turbo_mode) print("Serialization to detailed JSON successful.", file=sys.stderr) return json_obj except Exception as e: print(f"ERROR during serialization to JSON: {e}", file=sys.stderr) return {"error": "Serialization Error", "message": f"Failed to serialize to JSON: {e}"}
- mindm_mcp/server.py:154-159 (helper)Supporting helper function that creates a MindmapDocument instance, retrieves the mindmap, and uses serialization.serialize_object_simple to produce the JSON output.def _serialize_json(ignore_rtf=True, mode='content', turbo_mode=False): document = _get_document_instance(turbo_mode=turbo_mode) if document.get_mindmap(mode=mode): json_obj = serialization.serialize_object_simple(document.mindmap, ignore_rtf=ignore_rtf) return json_obj return None