Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions mcp_server/src/mcp_server_neo4j_gds/gds.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ def get_relationship_properties_keys(gds: GraphDataScience, relationshipTypes=No
return df["properties_keys"].iloc[0]


def get_relationship_types(gds: GraphDataScience, node_labels=None):
if node_labels is None:
node_labels = []
def get_relationship_types(gds: GraphDataScience):
node_labels = []
type_extractor = """
WITH type(r) AS type
WITH DISTINCT type
Expand Down
13 changes: 1 addition & 12 deletions mcp_server/src/mcp_server_neo4j_gds/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,6 @@ async def handle_list_tools() -> list[types.Tool]:
description="""Get relationship types in the database.""",
inputSchema={
"type": "object",
"properties": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing node label filtering since for ["A", "B"] it will return all rel types satisfying A<->A, B<->B, A->B, B<-A with no information about source/target types (not triplets). The filtering does not provide anything benefit in most cases.

"nodeLabels": {
"type": "array",
"items": {"type": "string"},
"description": "Ignore relationships whose source and target node is not in the specified node labels. To use this parameter, use get_node_labels first.",
},
},
"required": [],
},
),
]
Expand Down Expand Up @@ -151,10 +143,7 @@ async def handle_call_tool(
result = get_node_labels(gds)
return [types.TextContent(type="text", text=serialize_result(result))]
elif name == "get_relationship_types":
if "nodeLabels" in arguments:
result = get_relationship_types(gds, arguments["nodeLabels"])
else:
result = get_relationship_types(gds)
result = get_relationship_types(gds)
return [types.TextContent(type="text", text=serialize_result(result))]

else:
Expand Down
11 changes: 11 additions & 0 deletions mcp_server/tests/test_basic_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,14 @@ async def test_get_node_labels(mcp_client):
properties_keys = json.loads(result_text)

assert properties_keys == ["UndergroundStation"]


@pytest.mark.asyncio
async def test_get_relationship_types(mcp_client):
result = await mcp_client.call_tool("get_relationship_types")

assert len(result) == 1
result_text = result[0]["text"]
properties_keys = json.loads(result_text)

assert properties_keys == ["LINK"]