serialize_current_mindmap_to_mermaid
Converts the currently loaded mind map into Mermaid format, allowing flexible detail levels (full, content, text) and optional ID-only or turbo-mode export for streamlined use.
Instructions
Serializes the currently loaded mindmap to Mermaid format.
Args:
id_only (bool): If True, only include IDs without detailed attributes. Defaults to False.
mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'.
turbo_mode (bool): Enable turbo mode (text only). Defaults to False.
Returns:
Union[str, Dict[str, str]]: Mermaid formatted string or error dictionary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id_only | No | ||
| mode | No | full | |
| turbo_mode | No |
Input Schema (JSON Schema)
{
"properties": {
"id_only": {
"default": false,
"title": "Id Only",
"type": "boolean"
},
"mode": {
"default": "full",
"title": "Mode",
"type": "string"
},
"turbo_mode": {
"default": false,
"title": "Turbo Mode",
"type": "boolean"
}
},
"title": "serialize_current_mindmap_to_mermaidArguments",
"type": "object"
}
Implementation Reference
- mindm_mcp/server.py:281-306 (handler)The handler function decorated with @mcp.tool(), which registers and implements the tool. It wraps the helper _serialize_mermaid to produce Mermaid output from the current mindmap.@mcp.tool() async def serialize_current_mindmap_to_mermaid( id_only: bool = False, mode: str = 'full', turbo_mode: bool = False ) -> Union[str, Dict[str, str]]: """ Serializes the currently loaded mindmap to Mermaid format. Args: id_only (bool): If True, only include IDs without detailed attributes. Defaults to False. mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'. turbo_mode (bool): Enable turbo mode (text only). Defaults to False. Returns: Union[str, Dict[str, str]]: Mermaid formatted string or error dictionary. """ try: print(f"Serializing current mindmap to Mermaid (id_only={id_only}).", file=sys.stderr) text = _serialize_mermaid(id_only=id_only, mode=mode, turbo_mode=turbo_mode) print("Serialization to Mermaid successful.", file=sys.stderr) return text except Exception as e: print(f"ERROR during serialization to Mermaid: {e}", file=sys.stderr) return {"error": "Serialization Error", "message": f"Failed to serialize to Mermaid: {e}"}
- mindm_mcp/server.py:123-131 (helper)Core helper function that fetches the mindmap document, builds a GUID mapping, and serializes it to Mermaid format using external serialization module.def _serialize_mermaid(id_only=True, mode='content', turbo_mode=False): document = _get_document_instance(turbo_mode=turbo_mode) if document.get_mindmap(mode=mode): guid_mapping = {} serialization.build_mapping(document.mindmap, guid_mapping) mermaid = serialization.serialize_mindmap(document.mindmap, guid_mapping, id_only=id_only) return mermaid return None
- mindm_mcp/server.py:282-297 (schema)The function signature and docstring define the input schema (parameters with types/defaults) and output schema for the MCP tool.async def serialize_current_mindmap_to_mermaid( id_only: bool = False, mode: str = 'full', turbo_mode: bool = False ) -> Union[str, Dict[str, str]]: """ Serializes the currently loaded mindmap to Mermaid format. Args: id_only (bool): If True, only include IDs without detailed attributes. Defaults to False. mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'. turbo_mode (bool): Enable turbo mode (text only). Defaults to False. Returns: Union[str, Dict[str, str]]: Mermaid formatted string or error dictionary. """
- mindm_mcp/server.py:281-281 (registration)The @mcp.tool() decorator registers the function as an MCP tool.@mcp.tool()