Skip to content

Commit 6b76e4f

Browse files
Merge pull request #25 from brs96/fix-name-match-and-cleanup
Fix name match and cleanup
2 parents 3ac6bd6 + a75ec30 commit 6b76e4f

File tree

6 files changed

+13
-4
lines changed

6 files changed

+13
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
### Bug Fixes
77
1. Fix a bug where disconnected nodes were not projected.
8+
2. Fix a bug where multiple nodes containing the identifying name could be nondeterministically matched. The user must now specify the exact name.
9+
3. Support weighted degree centrality.
810

911
### Other Changes
1012

mcp_server/src/mcp_server_neo4j_gds/centrality_algorithm_handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def execute(self, arguments: Dict[str, Any]) -> Any:
213213
nodes=arguments.get("nodes"),
214214
nodeIdentifierProperty=arguments.get("nodeIdentifierProperty"),
215215
orientation=arguments.get("orientation"),
216+
relationshipWeightProperty=arguments.get("relationshipWeightProperty"),
216217
)
217218

218219

mcp_server/src/mcp_server_neo4j_gds/centrality_algorithm_specs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@
190190
"type": "string",
191191
"description": "The orientation used to compute node degrees. Supported orientations are NATURAL (for out-degree), REVERSE (for in-degree) and UNDIRECTED (for both in-degree and out-degree) ",
192192
},
193+
"relationshipWeightProperty": {
194+
"type": "string",
195+
"description": "Property of the relationship to use for weighting. If not specified, all relationships are treated equally.",
196+
},
193197
},
194198
"required": [],
195199
},

mcp_server/src/mcp_server_neo4j_gds/node_translator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def translate_identifiers_to_ids(
1515
query = f"""
1616
UNWIND $names AS name
1717
MATCH (s)
18-
WHERE toLower(s.{node_identifier_property}) CONTAINS toLower(name)
18+
WHERE toLower(s.{node_identifier_property}) = toLower(name)
1919
RETURN id(s) as node_id
2020
"""
2121
df = gds.run_cypher(
@@ -30,7 +30,7 @@ def translate_identifiers_to_ids(
3030
# Handle single node name
3131
query = f"""
3232
MATCH (s)
33-
WHERE toLower(s.{node_identifier_property}) CONTAINS toLower($name)
33+
WHERE toLower(s.{node_identifier_property}) = toLower($name)
3434
RETURN id(s) as node_id
3535
"""
3636
df = gds.run_cypher(
@@ -77,7 +77,7 @@ def filter_identifiers(
7777
query = f"""
7878
UNWIND $names AS name
7979
MATCH (s)
80-
WHERE toLower(s.{node_identifier_property}) CONTAINS toLower(name)
80+
WHERE toLower(s.{node_identifier_property}) = toLower(name)
8181
RETURN id(s) as node_id
8282
"""
8383
df = gds.run_cypher(

mcp_server/src/mcp_server_neo4j_gds/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async def handle_call_tool(
134134
write_stream,
135135
InitializationOptions(
136136
server_name="neo4j_gds",
137-
server_version="0.1.0",
137+
server_version="0.3.0",
138138
capabilities=server.get_capabilities(
139139
notification_options=NotificationOptions(),
140140
experimental_capabilities={},

mcp_server/tests/test_centrality_algorithms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ async def test_degree_centrality(mcp_client):
239239
{
240240
"nodes": ["King's Cross St. Pancras", "Oxford Circus"],
241241
"nodeIdentifierProperty": "name",
242+
"orientation": "NATURAL",
243+
"relationshipWeightProperty": "distance",
242244
},
243245
)
244246

0 commit comments

Comments
 (0)