enable_docset_fts
Activate full-text search functionality for a specific documentation set in Dash, allowing comprehensive content searches within that docset.
Instructions
Enable full-text search for a specific docset.
Args:
identifier: The docset identifier (from list_installed_docsets)
Returns:
True if FTS was successfully enabled, False otherwise
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes |
Implementation Reference
- src/dash_mcp_server/server.py:366-405 (handler)The handler function for the 'enable_docset_fts' MCP tool, registered via @mcp.tool() decorator. It validates the identifier, retrieves the Dash API base URL using a helper function, and sends a GET request to enable full-text search (FTS) for the specified docset. Handles various errors and returns True on success.@mcp.tool() async def enable_docset_fts(ctx: Context, identifier: str) -> bool: """ Enable full-text search for a specific docset. Args: identifier: The docset identifier (from list_installed_docsets) Returns: True if FTS was successfully enabled, False otherwise """ if not identifier.strip(): await ctx.error("Docset identifier cannot be empty") return False try: base_url = await working_api_base_url(ctx) if base_url is None: return False await ctx.debug(f"Enabling FTS for docset: {identifier}") with httpx.Client(timeout=30.0) as client: response = client.get(f"{base_url}/docsets/enable_fts", params={"identifier": identifier}) response.raise_for_status() result = response.json() except httpx.HTTPStatusError as e: if e.response.status_code == 400: await ctx.error(f"Bad request: {e.response.text}") return False elif e.response.status_code == 404: await ctx.error(f"Docset not found: {identifier}") return False await ctx.error(f"HTTP error: {e}") return False except Exception as e: await ctx.error(f"Failed to enable FTS: {e}") return False return True
- src/dash_mcp_server/server.py:27-62 (helper)Helper function used by the tool to obtain the Dash API base URL. Ensures Dash is running, retrieves or enables the API port, and returns the URL or None if unavailable.async def working_api_base_url(ctx: Context) -> Optional[str]: dash_running = await ensure_dash_running(ctx) if not dash_running: return None port = await get_dash_api_port(ctx) if port is None: # Try to automatically enable the Dash API Server await ctx.info("The Dash API Server is not enabled. Attempting to enable it automatically...") try: subprocess.run( ["defaults", "write", "com.kapeli.dashdoc", "DHAPIServerEnabled", "YES"], check=True, timeout=10 ) subprocess.run( ["defaults", "write", "com.kapeli.dash-setapp", "DHAPIServerEnabled", "YES"], check=True, timeout=10 ) # Wait a moment for Dash to pick up the change import time time.sleep(2) # Try to get the port again port = await get_dash_api_port(ctx) if port is None: await ctx.error("Failed to enable Dash API Server automatically. Please enable it manually in Dash Settings > Integration") return None else: await ctx.info("Successfully enabled Dash API Server") except Exception as e: await ctx.error("Failed to enable Dash API Server automatically. Please enable it manually in Dash Settings > Integration") return None return f"http://127.0.0.1:{port}"