get_selection
Retrieve currently selected topics from MindManager mind maps with configurable detail levels for integration and export workflows.
Instructions
Retrieves the currently selected topics in MindManager.
Args:
mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'.
turbo_mode (bool): Enable turbo mode (text only). Defaults to False.
Returns:
Union[List[Dict[str, Any]], Dict[str, str]]: List of serialized selected topics or error dictionary.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | full | |
| turbo_mode | No |
Implementation Reference
- mindm_mcp/server.py:195-217 (handler)The primary MCP tool handler for 'get_selection'. It invokes the internal _get_selection helper, serializes the result using _serialize_result, and handles exceptions with _handle_mindmanager_error. The decorator @mcp.tool() registers it as an MCP tool. The function signature and docstring define the input schema.@mcp.tool() async def get_selection( mode: str = 'full', turbo_mode: bool = False ) -> Union[List[Dict[str, Any]], Dict[str, str]]: """ Retrieves the currently selected topics in MindManager. Args: mode (str): Detail level ('full', 'content', 'text'). Defaults to 'full'. turbo_mode (bool): Enable turbo mode (text only). Defaults to False. Returns: Union[List[Dict[str, Any]], Dict[str, str]]: List of serialized selected topics or error dictionary. """ try: print(f"Calling get_selection(mode={mode}, turbo_mode={turbo_mode})", file=sys.stderr) selection = _get_selection(mode=mode, turbo_mode=turbo_mode) print("get_selection successful, returning serialized selection.", file=sys.stderr) return _serialize_result(selection) except Exception as e: return _handle_mindmanager_error("get_selection", e)
- mindm_mcp/server.py:103-108 (helper)Helper function containing the core logic for fetching the selection: creates a MindmapDocument instance and calls its get_selection() method after ensuring the mindmap is loaded.def _get_selection(mode='content', turbo_mode=False): document = _get_document_instance(turbo_mode=turbo_mode) if document.get_mindmap(mode=mode): selection = document.get_selection() return selection return None