ydb_describe_path
Retrieve detailed information about a specific path in a YDB database to understand its schema, statistics, and properties.
Instructions
Get detailed information about a YDB path
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- ydb_mcp/tools.py:93-98 (handler)Handler function for ydb_describe_path tool. Calls server.describe_path(path) and serializes the result.
async def ydb_describe_path(path: str) -> list[TextContent]: """Get detailed information about a YDB path (table, directory, etc.).""" try: return [TextContent(type="text", text=serialize_ydb_response(await server.describe_path(path)))] except Exception as e: return [TextContent(type="text", text=json.dumps({"error": str(e)}, indent=2))] - ydb_mcp/tools.py:110-111 (registration)Registration of ydb_describe_path tool in the register_generic_tools loop at line 108.
if tool in enabled: server.add_tool(fn, name=tool.value, description=description) # type: ignore[arg-type] - ydb_mcp/tools.py:25-25 (schema)Enum definition YDBGenericTool.DESCRIBE_PATH = 'ydb_describe_path'.
DESCRIBE_PATH = "ydb_describe_path" - ydb_mcp/server.py:207-232 (helper)Server.describe_path() helper that calls YDB SDK scheme_client.describe_path() and also invokes _describe_table() for tables.
async def describe_path(self, path: str) -> dict: """Describe a YDB path (directory, table, etc.). Returns a metadata dict. For tables also includes column/index details. """ await self._ensure_connected() assert self._driver is not None response = await self._driver.scheme_client.describe_path(path) if response is None: return {"error": f"Path '{path}' not found"} entry_type = _ENTRY_TYPE_MAP.get(response.type, str(response.type)) result: dict[str, Any] = { "path": path, "type": entry_type, "name": response.name, "owner": response.owner, } if getattr(response, "permissions", None): result["permissions"] = [ {"subject": p.subject, "permission_names": list(p.permission_names)} for p in response.permissions ] if entry_type == "TABLE": result["table"] = await self._describe_table(path) return result - ydb_mcp/server.py:234-256 (helper)Helper that describes table columns, primary key, and indexes for TABLE type paths.
async def _describe_table(self, path: str) -> dict: assert self._driver is not None session = await self._driver.table_client.session().create() try: desc = await session.describe_table(path) return { "columns": [ {"name": col.name, "type": str(col.type), "family": col.family} for col in desc.columns ], "primary_key": list(desc.primary_key), "indexes": [ { "name": idx.name, "index_columns": list(idx.index_columns), "cover_columns": list(idx.cover_columns) if hasattr(idx, "cover_columns") else [], "index_type": str(idx.index_type) if hasattr(idx, "index_type") else None, } for idx in desc.indexes ], } finally: await session.delete()