You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Data modeling - allow JSON object and String as tool input (#231)
* first pass - works with middleware and union tool arg types
* replace middleware with utils fn
* update json parser docstring and error
* update json parsing fn name
* formatting
Copy file name to clipboardExpand all lines: servers/mcp-neo4j-data-modeling/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,10 @@
4
4
* Fix bug in Dockerfile where build would fail due to `LABEL` statement coming before `FROM` statement
5
5
6
6
### Changed
7
+
* Tools that received Pydantic objects as arguments now also accept JSON strings as input. This is for client applications that send JSON strings instead of objects for tool arguments. This is a workaround for client applications that don't adhere to the defined tool schemas and will be removed in the future once it is not needed.
7
8
8
9
### Added
10
+
* Added JSON string parsing utils function. This is for client applications that send JSON strings instead of objects for tool arguments. This is a workaround for client applications that don't adhere to the defined tool schemas and will be removed in the future once it is not needed.
"Validate a single relationship. Returns True if the relationship is valid, otherwise raises a ValueError. If return_validated is True, returns the validated relationship."
142
+
"""
143
+
Validate a single relationship.
144
+
Returns True if the relationship is valid, otherwise raises a ValueError.
145
+
If return_validated is True, returns the validated relationship.
146
+
Accepts either a Relationship object or a JSON string of the Relationship object.
147
+
"""
136
148
logger.info("Validating a single relationship.")
137
149
try:
150
+
# Parse the relationship argument (handles both JSON string and dict)
"Validate the entire data model. Returns True if the data model is valid, otherwise raises a ValueError. If return_validated is True, returns the validated data model."
168
+
"""
169
+
Validate the entire data model.
170
+
Returns True if the data model is valid, otherwise raises a ValueError.
171
+
If return_validated is True, returns the validated data model.
172
+
Accepts either a DataModel object or a JSON string of the DataModel object.
173
+
"""
155
174
logger.info("Validating the entire data model.")
156
175
try:
157
-
DataModel.model_validate(data_model, strict=True)
176
+
# Parse the data_model argument (handles both JSON string and dict)
description="The data model snippet that contains the relationship, start node and end node."
245
+
data_model: Union[str, DataModel]=Field(
246
+
description="The data model snippet that contains the relationship, start node and end node. Accepts either a DataModel object or a JSON string of the DataModel object."
208
247
),
209
248
relationship_type: str=Field(
210
249
description="The type of the relationship to get the Cypher query for."
"Get the Cypher queries to create constraints on the data model. This creates range indexes on the key properties of the nodes and relationships and enforces uniqueness and existence of the key properties."
0 commit comments