serialize_current_mindmap_to_json
Convert the active mindmap into a structured JSON object with ID mapping, customizable detail levels, and options to ignore RTF content or enable text-only mode.
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 | content | |
| turbo_mode | No |
Implementation Reference
- mindm_mcp/server.py:335-360 (handler)The @mcp.tool()-decorated handler function for 'serialize_current_mindmap_to_json'. It invokes the _serialize_json helper to produce a JSON serialization of the current MindManager mindmap, handling errors and logging.@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)Helper function that instantiates a MindmapDocument, retrieves the mindmap in the specified mode, and serializes it to a simple JSON object using mindmap.serialization.serialize_object_simple, optionally ignoring RTF content.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
- mindm_mcp/server.py:87-102 (helper)Helper function to create a MindmapDocument instance with specified parameters, used by serialization helpers to access the current MindManager document.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:335-335 (registration)The @mcp.tool() decorator registers the serialize_current_mindmap_to_json function as an MCP tool.@mcp.tool()
- mindm_mcp/server.py:336-351 (schema)Function signature and docstring define the input schema (parameters: ignore_rtf, mode, turbo_mode) and output schema (JSON dict or error dict).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. """