Skip to content

Commit 187f419

Browse files
committed
add list of tools to README.md; remove unused params from ydb_status tool
1 parent d29598c commit 187f419

File tree

3 files changed

+59
-5
lines changed

3 files changed

+59
-5
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,29 @@ To get started with YDB MCP, you'll need to configure your MCP client to communi
2828
}
2929
```
3030

31+
## Available tools
32+
33+
YDB MCP provides the following tools for interacting with YDB databases:
34+
35+
- `ydb_query`: Run a SQL query against a YDB database
36+
- Parameters:
37+
- `sql`: SQL query string to execute
38+
39+
- `ydb_query_with_params`: Run a parameterized SQL query with JSON parameters
40+
- Parameters:
41+
- `sql`: SQL query string with parameter placeholders
42+
- `params`: JSON string containing parameter values
43+
44+
- `ydb_list_directory`: List directory contents in YDB
45+
- Parameters:
46+
- `path`: YDB directory path to list
47+
48+
- `ydb_describe_path`: Get detailed information about a YDB path (table, directory, etc.)
49+
- Parameters:
50+
- `path`: YDB path to describe
51+
52+
- `ydb_status`: Get the current status of the YDB connection
53+
3154
## Development
3255

3356
The project uses [Make](https://www.gnu.org/software/make/) as its primary development tool, providing a consistent interface for common development tasks.

tests/integration/test_mcp_server_integration.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,3 +853,34 @@ async def test_describe_nonexistent_path_integration(mcp_server):
853853

854854
# Should contain an error message
855855
assert "Error" in item["text"], f"Expected error message, got: {item['text']}"
856+
857+
858+
async def test_ydb_status_integration(mcp_server):
859+
"""Test getting YDB connection status."""
860+
result = await call_mcp_tool(mcp_server, "ydb_status")
861+
862+
# Parse the JSON result
863+
assert isinstance(result, list), f"Expected list result, got {type(result)}"
864+
assert len(result) > 0, "Expected non-empty result list"
865+
866+
item = result[0]
867+
assert isinstance(item, dict), f"Expected dict item, got {type(item)}"
868+
assert "type" in item, f"Missing 'type' field in item: {item}"
869+
assert "text" in item, f"Missing 'text' field in item: {item}"
870+
871+
# Parse the JSON string within the text field
872+
status_data = json.loads(item["text"])
873+
874+
# Verify the structure
875+
assert "status" in status_data, f"Missing 'status' field in status_data: {status_data}"
876+
assert "ydb_endpoint" in status_data, f"Missing 'ydb_endpoint' field in status_data: {status_data}"
877+
assert "ydb_database" in status_data, f"Missing 'ydb_database' field in status_data: {status_data}"
878+
assert "auth_mode" in status_data, f"Missing 'auth_mode' field in status_data: {status_data}"
879+
assert "ydb_connection" in status_data, f"Missing 'ydb_connection' field in status_data: {status_data}"
880+
881+
# For a successful test run, we expect to be connected
882+
assert status_data["status"] == "running", f"Expected status to be 'running', got {status_data['status']}"
883+
assert status_data["ydb_connection"] == "connected", f"Expected ydb_connection to be 'connected', got {status_data['ydb_connection']}"
884+
assert status_data["error"] is None, f"Expected no error, got: {status_data.get('error')}"
885+
886+
logger.info(f"YDB status check successful: {status_data}")

ydb_mcp/server.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,9 @@ def register_tools(self):
575575
"description": "Get the current status of the YDB connection",
576576
"handler": self.get_connection_status, # Use real handler
577577
"parameters": {
578-
"properties": {"params": {"type": "string", "title": "params"}},
579-
"required": ["params"],
580578
"type": "object",
579+
"properties": {},
580+
"required": []
581581
},
582582
},
583583
{
@@ -614,7 +614,7 @@ def register_tools(self):
614614
parameters=spec.get("parameters"),
615615
)
616616

617-
async def get_connection_status(self, params) -> List[TextContent]:
617+
async def get_connection_status(self) -> List[TextContent]:
618618
"""Get the current status of the YDB connection.
619619
620620
Returns:
@@ -1039,8 +1039,8 @@ async def call_tool(self, tool_name: str, params: Dict[str, Any]) -> List[TextCo
10391039
result = await self.query(sql=params["sql"])
10401040
elif tool_name == "ydb_query_with_params" and "sql" in params and "params" in params:
10411041
result = await self.query_with_params(sql=params["sql"], params=params["params"])
1042-
elif tool_name == "ydb_status" and "params" in params:
1043-
result = await self.get_connection_status(params=params["params"])
1042+
elif tool_name == "ydb_status":
1043+
result = await self.get_connection_status()
10441044
elif tool_name == "ydb_list_directory" and "path" in params:
10451045
result = await self.list_directory(path=params["path"])
10461046
elif tool_name == "ydb_describe_path" and "path" in params:

0 commit comments

Comments
 (0)