Skip to main content
Glama

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

NameRequiredDescriptionDefault
id_onlyNo
modeNofull
turbo_modeNo

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

  • 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}"}
  • 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
  • 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. """
  • The @mcp.tool() decorator registers the function as an MCP tool.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/robertZaufall/mindm-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server