rossum-mcp 1.1.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rossum_mcp/__init__.py +1 -1
- rossum_mcp/tools/schemas/__init__.py +182 -0
- rossum_mcp/tools/schemas/models.py +151 -0
- rossum_mcp/tools/schemas/operations.py +183 -0
- rossum_mcp/tools/schemas/patching.py +202 -0
- rossum_mcp/tools/schemas/pruning.py +133 -0
- rossum_mcp/tools/schemas/validation.py +128 -0
- {rossum_mcp-1.1.0.dist-info → rossum_mcp-1.1.1.dist-info}/METADATA +1 -1
- {rossum_mcp-1.1.0.dist-info → rossum_mcp-1.1.1.dist-info}/RECORD +13 -8
- rossum_mcp/tools/schemas.py +0 -800
- {rossum_mcp-1.1.0.dist-info → rossum_mcp-1.1.1.dist-info}/WHEEL +0 -0
- {rossum_mcp-1.1.0.dist-info → rossum_mcp-1.1.1.dist-info}/entry_points.txt +0 -0
- {rossum_mcp-1.1.0.dist-info → rossum_mcp-1.1.1.dist-info}/licenses/LICENSE +0 -0
- {rossum_mcp-1.1.0.dist-info → rossum_mcp-1.1.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"""Schema patching utilities for Rossum MCP Server."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import copy
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
PatchOperation = Literal["add", "update", "remove"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _find_node_in_children(
|
|
12
|
+
children: list[dict], node_id: str, parent_node: dict | None = None
|
|
13
|
+
) -> tuple[dict | None, int | None, list[dict] | None, dict | None]:
|
|
14
|
+
"""Recursively find a node by ID in schema children.
|
|
15
|
+
|
|
16
|
+
Returns (node, index, parent_children_list, parent_node) or (None, None, None, None) if not found.
|
|
17
|
+
The parent_node is needed for multivalue's dict children where we need to modify the parent directly.
|
|
18
|
+
"""
|
|
19
|
+
for i, child in enumerate(children):
|
|
20
|
+
if child.get("id") == node_id:
|
|
21
|
+
return child, i, children, parent_node
|
|
22
|
+
|
|
23
|
+
nested_children = child.get("children")
|
|
24
|
+
if nested_children:
|
|
25
|
+
if isinstance(nested_children, list):
|
|
26
|
+
result = _find_node_in_children(nested_children, node_id, child)
|
|
27
|
+
if result[0] is not None:
|
|
28
|
+
return result
|
|
29
|
+
elif isinstance(nested_children, dict):
|
|
30
|
+
if nested_children.get("id") == node_id:
|
|
31
|
+
return nested_children, 0, None, child
|
|
32
|
+
if "children" in nested_children:
|
|
33
|
+
result = _find_node_in_children(nested_children["children"], node_id, nested_children)
|
|
34
|
+
if result[0] is not None:
|
|
35
|
+
return result
|
|
36
|
+
|
|
37
|
+
return None, None, None, None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _is_multivalue_node(node: dict) -> bool:
|
|
41
|
+
"""Check if a node is a multivalue (has dict children or category is multivalue)."""
|
|
42
|
+
return node.get("category") == "multivalue" or ("children" in node and isinstance(node["children"], dict))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _find_parent_children_list(content: list[dict], parent_id: str) -> tuple[list[dict] | None, bool]:
|
|
46
|
+
"""Find the children list of a parent node by its ID.
|
|
47
|
+
|
|
48
|
+
Returns (children_list, is_multivalue) tuple.
|
|
49
|
+
For multivalue nodes, returns (None, True) since they can't have children added.
|
|
50
|
+
"""
|
|
51
|
+
for section in content:
|
|
52
|
+
if section.get("id") == parent_id:
|
|
53
|
+
if _is_multivalue_node(section):
|
|
54
|
+
return None, True
|
|
55
|
+
children: list[dict] = section.setdefault("children", [])
|
|
56
|
+
return children, False
|
|
57
|
+
|
|
58
|
+
section_children = section.get("children")
|
|
59
|
+
if section_children is None:
|
|
60
|
+
continue
|
|
61
|
+
|
|
62
|
+
if isinstance(section_children, list):
|
|
63
|
+
node, _, _, _ = _find_node_in_children(section_children, parent_id)
|
|
64
|
+
else:
|
|
65
|
+
if section_children.get("id") == parent_id:
|
|
66
|
+
node = section_children
|
|
67
|
+
elif "children" in section_children:
|
|
68
|
+
node, _, _, _ = _find_node_in_children(section_children.get("children", []), parent_id)
|
|
69
|
+
else:
|
|
70
|
+
node = None
|
|
71
|
+
|
|
72
|
+
if node is not None:
|
|
73
|
+
if _is_multivalue_node(node):
|
|
74
|
+
return None, True
|
|
75
|
+
if "children" in node:
|
|
76
|
+
if isinstance(node["children"], list):
|
|
77
|
+
result: list[dict] = node["children"]
|
|
78
|
+
return result, False
|
|
79
|
+
else:
|
|
80
|
+
node["children"] = []
|
|
81
|
+
node_children: list[dict] = node["children"]
|
|
82
|
+
return node_children, False
|
|
83
|
+
|
|
84
|
+
return None, False
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _apply_add_operation(
|
|
88
|
+
content: list[dict], node_id: str, node_data: dict | None, parent_id: str | None, position: int | None
|
|
89
|
+
) -> list[dict]:
|
|
90
|
+
if node_data is None:
|
|
91
|
+
raise ValueError("node_data is required for 'add' operation")
|
|
92
|
+
if parent_id is None:
|
|
93
|
+
raise ValueError("parent_id is required for 'add' operation")
|
|
94
|
+
|
|
95
|
+
node_data = copy.deepcopy(node_data)
|
|
96
|
+
node_data["id"] = node_id
|
|
97
|
+
|
|
98
|
+
parent_children, is_multivalue = _find_parent_children_list(content, parent_id)
|
|
99
|
+
if is_multivalue:
|
|
100
|
+
raise ValueError(
|
|
101
|
+
f"Cannot add children to multivalue '{parent_id}'. "
|
|
102
|
+
"Multivalue nodes have a single child (tuple or datapoint). "
|
|
103
|
+
"Use 'update' to replace the multivalue's children, or add to the tuple inside it."
|
|
104
|
+
)
|
|
105
|
+
if parent_children is None:
|
|
106
|
+
raise ValueError(f"Parent node '{parent_id}' not found in schema")
|
|
107
|
+
|
|
108
|
+
if position is not None and 0 <= position <= len(parent_children):
|
|
109
|
+
parent_children.insert(position, node_data)
|
|
110
|
+
else:
|
|
111
|
+
parent_children.append(node_data)
|
|
112
|
+
return content
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _get_section_children_as_list(section: dict) -> list[dict]:
|
|
116
|
+
"""Get section children as a list, handling both list and dict (multivalue) cases."""
|
|
117
|
+
children = section.get("children")
|
|
118
|
+
if children is None:
|
|
119
|
+
return []
|
|
120
|
+
if isinstance(children, list):
|
|
121
|
+
return children
|
|
122
|
+
if isinstance(children, dict):
|
|
123
|
+
return [children]
|
|
124
|
+
return []
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _find_node_anywhere(
|
|
128
|
+
content: list[dict], node_id: str
|
|
129
|
+
) -> tuple[dict | None, int | None, list[dict] | None, dict | None]:
|
|
130
|
+
"""Find a node by ID anywhere in the schema content.
|
|
131
|
+
|
|
132
|
+
Returns (node, index, parent_children_list, parent_node).
|
|
133
|
+
"""
|
|
134
|
+
for section in content:
|
|
135
|
+
if section.get("id") == node_id:
|
|
136
|
+
return section, None, None, None
|
|
137
|
+
|
|
138
|
+
section_children = _get_section_children_as_list(section)
|
|
139
|
+
result = _find_node_in_children(section_children, node_id, section)
|
|
140
|
+
if result[0] is not None:
|
|
141
|
+
return result
|
|
142
|
+
|
|
143
|
+
return None, None, None, None
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _apply_update_operation(content: list[dict], node_id: str, node_data: dict | None) -> list[dict]:
|
|
147
|
+
if node_data is None:
|
|
148
|
+
raise ValueError("node_data is required for 'update' operation")
|
|
149
|
+
|
|
150
|
+
node, _, _, _ = _find_node_anywhere(content, node_id)
|
|
151
|
+
|
|
152
|
+
if node is None:
|
|
153
|
+
raise ValueError(f"Node '{node_id}' not found in schema")
|
|
154
|
+
|
|
155
|
+
node.update(node_data)
|
|
156
|
+
return content
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _apply_remove_operation(content: list[dict], node_id: str) -> list[dict]:
|
|
160
|
+
for section in content:
|
|
161
|
+
if section.get("id") == node_id and section.get("category") == "section":
|
|
162
|
+
raise ValueError("Cannot remove a section - sections must exist")
|
|
163
|
+
|
|
164
|
+
node, idx, parent_list, parent_node = _find_node_anywhere(content, node_id)
|
|
165
|
+
|
|
166
|
+
if node is None:
|
|
167
|
+
raise ValueError(f"Node '{node_id}' not found in schema")
|
|
168
|
+
|
|
169
|
+
if idx is None and parent_list is None:
|
|
170
|
+
if node.get("category") == "section":
|
|
171
|
+
raise ValueError("Cannot remove a section - sections must exist")
|
|
172
|
+
raise ValueError(f"Cannot determine how to remove node '{node_id}'")
|
|
173
|
+
|
|
174
|
+
if parent_list is not None and idx is not None:
|
|
175
|
+
parent_list.pop(idx)
|
|
176
|
+
elif parent_node is not None:
|
|
177
|
+
if parent_node.get("category") == "multivalue":
|
|
178
|
+
raise ValueError(f"Cannot remove '{node_id}' from multivalue - remove the multivalue instead")
|
|
179
|
+
raise ValueError(f"Cannot remove '{node_id}' - unexpected parent structure")
|
|
180
|
+
|
|
181
|
+
return content
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def apply_schema_patch(
|
|
185
|
+
content: list[dict],
|
|
186
|
+
operation: PatchOperation,
|
|
187
|
+
node_id: str,
|
|
188
|
+
node_data: dict | None = None,
|
|
189
|
+
parent_id: str | None = None,
|
|
190
|
+
position: int | None = None,
|
|
191
|
+
) -> list[dict]:
|
|
192
|
+
"""Apply a patch operation to schema content."""
|
|
193
|
+
content = copy.deepcopy(content)
|
|
194
|
+
|
|
195
|
+
if operation == "add":
|
|
196
|
+
return _apply_add_operation(content, node_id, node_data, parent_id, position)
|
|
197
|
+
if operation == "update":
|
|
198
|
+
return _apply_update_operation(content, node_id, node_data)
|
|
199
|
+
if operation == "remove":
|
|
200
|
+
return _apply_remove_operation(content, node_id)
|
|
201
|
+
|
|
202
|
+
return content
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"""Schema pruning utilities for Rossum MCP Server."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import copy
|
|
6
|
+
|
|
7
|
+
from rossum_mcp.tools.schemas.models import SchemaTreeNode
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _build_tree_node(node: dict) -> SchemaTreeNode:
|
|
11
|
+
"""Build a lightweight tree node from a schema node."""
|
|
12
|
+
category = node.get("category", "")
|
|
13
|
+
node_id = node.get("id", "")
|
|
14
|
+
label = node.get("label", "")
|
|
15
|
+
node_type = node.get("type") if category == "datapoint" else None
|
|
16
|
+
|
|
17
|
+
children_data = node.get("children")
|
|
18
|
+
children: list[SchemaTreeNode] | None = None
|
|
19
|
+
|
|
20
|
+
if children_data is not None:
|
|
21
|
+
if isinstance(children_data, list):
|
|
22
|
+
children = [_build_tree_node(child) for child in children_data]
|
|
23
|
+
elif isinstance(children_data, dict):
|
|
24
|
+
children = [_build_tree_node(children_data)]
|
|
25
|
+
|
|
26
|
+
return SchemaTreeNode(id=node_id, label=label, category=category, type=node_type, children=children)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _extract_schema_tree(content: list[dict]) -> list[dict]:
|
|
30
|
+
"""Extract lightweight tree structure from schema content."""
|
|
31
|
+
return [_build_tree_node(section).to_dict() for section in content]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _collect_all_field_ids(content: list[dict]) -> set[str]:
|
|
35
|
+
"""Collect all field IDs from schema content recursively."""
|
|
36
|
+
ids: set[str] = set()
|
|
37
|
+
|
|
38
|
+
def _traverse(node: dict) -> None:
|
|
39
|
+
node_id = node.get("id")
|
|
40
|
+
if node_id:
|
|
41
|
+
ids.add(node_id)
|
|
42
|
+
children = node.get("children")
|
|
43
|
+
if children is not None:
|
|
44
|
+
if isinstance(children, list):
|
|
45
|
+
for child in children:
|
|
46
|
+
_traverse(child)
|
|
47
|
+
elif isinstance(children, dict):
|
|
48
|
+
_traverse(children)
|
|
49
|
+
|
|
50
|
+
for section in content:
|
|
51
|
+
_traverse(section)
|
|
52
|
+
|
|
53
|
+
return ids
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _collect_ancestor_ids(content: list[dict], target_ids: set[str]) -> set[str]:
|
|
57
|
+
"""Collect all ancestor IDs for the given target field IDs.
|
|
58
|
+
|
|
59
|
+
Returns set of IDs for all parent containers (multivalue, tuple, section) of target fields.
|
|
60
|
+
"""
|
|
61
|
+
ancestors: set[str] = set()
|
|
62
|
+
|
|
63
|
+
def _find_ancestors(node: dict, path: list[str]) -> None:
|
|
64
|
+
node_id = node.get("id", "")
|
|
65
|
+
current_path = [*path, node_id] if node_id else path
|
|
66
|
+
|
|
67
|
+
if node_id in target_ids:
|
|
68
|
+
ancestors.update(current_path[:-1])
|
|
69
|
+
|
|
70
|
+
children = node.get("children")
|
|
71
|
+
if children is not None:
|
|
72
|
+
if isinstance(children, list):
|
|
73
|
+
for child in children:
|
|
74
|
+
_find_ancestors(child, current_path)
|
|
75
|
+
elif isinstance(children, dict):
|
|
76
|
+
_find_ancestors(children, current_path)
|
|
77
|
+
|
|
78
|
+
for section in content:
|
|
79
|
+
_find_ancestors(section, [])
|
|
80
|
+
|
|
81
|
+
return ancestors
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _remove_fields_from_content(content: list[dict], fields_to_remove: set[str]) -> tuple[list[dict], list[str]]:
|
|
85
|
+
"""Remove multiple fields from schema content.
|
|
86
|
+
|
|
87
|
+
Returns (modified_content, list_of_removed_field_ids).
|
|
88
|
+
Sections cannot be removed.
|
|
89
|
+
"""
|
|
90
|
+
content = copy.deepcopy(content)
|
|
91
|
+
removed: list[str] = []
|
|
92
|
+
|
|
93
|
+
def _filter_children(children: list[dict]) -> list[dict]:
|
|
94
|
+
result = []
|
|
95
|
+
for child in children:
|
|
96
|
+
child_id = child.get("id", "")
|
|
97
|
+
category = child.get("category", "")
|
|
98
|
+
|
|
99
|
+
if child_id in fields_to_remove and category != "section":
|
|
100
|
+
removed.append(child_id)
|
|
101
|
+
continue
|
|
102
|
+
|
|
103
|
+
nested = child.get("children")
|
|
104
|
+
if nested is not None:
|
|
105
|
+
if isinstance(nested, list):
|
|
106
|
+
child["children"] = _filter_children(nested)
|
|
107
|
+
elif isinstance(nested, dict):
|
|
108
|
+
nested_id = nested.get("id", "")
|
|
109
|
+
if nested_id in fields_to_remove:
|
|
110
|
+
removed.append(nested_id)
|
|
111
|
+
removed.append(child_id)
|
|
112
|
+
continue
|
|
113
|
+
nested_children = nested.get("children")
|
|
114
|
+
if isinstance(nested_children, list):
|
|
115
|
+
filtered_nested = _filter_children(nested_children)
|
|
116
|
+
if not filtered_nested:
|
|
117
|
+
removed.append(nested_id)
|
|
118
|
+
removed.append(child_id)
|
|
119
|
+
continue
|
|
120
|
+
nested["children"] = filtered_nested
|
|
121
|
+
result.append(child)
|
|
122
|
+
return result
|
|
123
|
+
|
|
124
|
+
for section in content:
|
|
125
|
+
section_children = section.get("children")
|
|
126
|
+
if isinstance(section_children, list):
|
|
127
|
+
section["children"] = _filter_children(section_children)
|
|
128
|
+
|
|
129
|
+
removed_sections = [s.get("id", "") for s in content if not s.get("children")]
|
|
130
|
+
removed.extend(removed_sections)
|
|
131
|
+
content = [s for s in content if s.get("children")]
|
|
132
|
+
|
|
133
|
+
return content, removed
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"""Schema validation utilities for Rossum MCP Server."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
MAX_ID_LENGTH = 50
|
|
6
|
+
VALID_DATAPOINT_TYPES = {"string", "number", "date", "enum", "button"}
|
|
7
|
+
VALID_UI_CONFIGURATION_TYPES = {"captured", "data", "manual", "formula", "reasoning", None}
|
|
8
|
+
VALID_UI_CONFIGURATION_EDIT = {"enabled", "enabled_without_warning", "disabled"}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SchemaValidationError(ValueError):
|
|
12
|
+
"""Raised when schema validation fails."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _sanitize_ui_configuration(node: dict) -> None:
|
|
16
|
+
"""Remove invalid ui_configuration.type values to prevent API errors."""
|
|
17
|
+
ui_config = node.get("ui_configuration")
|
|
18
|
+
if not isinstance(ui_config, dict):
|
|
19
|
+
return
|
|
20
|
+
if "type" in ui_config and ui_config["type"] not in VALID_UI_CONFIGURATION_TYPES:
|
|
21
|
+
del ui_config["type"]
|
|
22
|
+
if "edit" in ui_config and ui_config["edit"] not in VALID_UI_CONFIGURATION_EDIT:
|
|
23
|
+
del ui_config["edit"]
|
|
24
|
+
if not ui_config:
|
|
25
|
+
del node["ui_configuration"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def sanitize_schema_content(content: list[dict]) -> list[dict]:
|
|
29
|
+
"""Sanitize schema content by removing invalid ui_configuration values.
|
|
30
|
+
|
|
31
|
+
Recursively traverses all nodes and removes invalid ui_configuration.type
|
|
32
|
+
values that would cause API errors (e.g., 'area', 'textarea').
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def _traverse(node: dict) -> None:
|
|
36
|
+
_sanitize_ui_configuration(node)
|
|
37
|
+
children = node.get("children")
|
|
38
|
+
if children is not None:
|
|
39
|
+
if isinstance(children, list):
|
|
40
|
+
for child in children:
|
|
41
|
+
_traverse(child)
|
|
42
|
+
elif isinstance(children, dict):
|
|
43
|
+
_traverse(children)
|
|
44
|
+
|
|
45
|
+
for section in content:
|
|
46
|
+
_traverse(section)
|
|
47
|
+
return content
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _validate_id(node_id: str, context: str = "") -> None:
|
|
51
|
+
"""Validate node ID constraints."""
|
|
52
|
+
if not node_id:
|
|
53
|
+
raise SchemaValidationError(f"Node id is required{context}")
|
|
54
|
+
if len(node_id) > MAX_ID_LENGTH:
|
|
55
|
+
raise SchemaValidationError(f"Node id '{node_id}' exceeds {MAX_ID_LENGTH} characters{context}")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _validate_datapoint(node: dict, context: str = "") -> None:
|
|
59
|
+
"""Validate a datapoint node has required fields."""
|
|
60
|
+
if "label" not in node:
|
|
61
|
+
raise SchemaValidationError(f"Datapoint missing required 'label'{context}")
|
|
62
|
+
if "type" not in node:
|
|
63
|
+
raise SchemaValidationError(f"Datapoint missing required 'type'{context}")
|
|
64
|
+
if node["type"] not in VALID_DATAPOINT_TYPES:
|
|
65
|
+
raise SchemaValidationError(
|
|
66
|
+
f"Invalid datapoint type '{node['type']}'. Must be one of: {', '.join(VALID_DATAPOINT_TYPES)}{context}"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _validate_tuple(node: dict, node_id: str, context: str) -> None:
|
|
71
|
+
"""Validate a tuple node."""
|
|
72
|
+
if "label" not in node:
|
|
73
|
+
raise SchemaValidationError(f"Tuple missing required 'label'{context}")
|
|
74
|
+
if "id" not in node:
|
|
75
|
+
raise SchemaValidationError(f"Tuple missing required 'id'{context}")
|
|
76
|
+
children = node.get("children", [])
|
|
77
|
+
if not isinstance(children, list):
|
|
78
|
+
raise SchemaValidationError(f"Tuple children must be a list{context}")
|
|
79
|
+
for i, child in enumerate(children):
|
|
80
|
+
child_id = child.get("id", f"index {i}")
|
|
81
|
+
_validate_node(child, f" in tuple '{node_id}' child '{child_id}'")
|
|
82
|
+
if "id" not in child:
|
|
83
|
+
raise SchemaValidationError(f"Datapoint inside tuple must have 'id'{context} child index {i}")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _validate_multivalue(node: dict, node_id: str, context: str) -> None:
|
|
87
|
+
"""Validate a multivalue node."""
|
|
88
|
+
if "label" not in node:
|
|
89
|
+
raise SchemaValidationError(f"Multivalue missing required 'label'{context}")
|
|
90
|
+
children = node.get("children")
|
|
91
|
+
if children is None:
|
|
92
|
+
raise SchemaValidationError(f"Multivalue missing required 'children'{context}")
|
|
93
|
+
if isinstance(children, list):
|
|
94
|
+
raise SchemaValidationError(f"Multivalue 'children' must be a single object (dict), not a list{context}")
|
|
95
|
+
if isinstance(children, dict):
|
|
96
|
+
_validate_node(children, f" in multivalue '{node_id}' children")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _validate_section(node: dict, node_id: str, context: str) -> None:
|
|
100
|
+
"""Validate a section node."""
|
|
101
|
+
if "label" not in node:
|
|
102
|
+
raise SchemaValidationError(f"Section missing required 'label'{context}")
|
|
103
|
+
if "id" not in node:
|
|
104
|
+
raise SchemaValidationError(f"Section missing required 'id'{context}")
|
|
105
|
+
children = node.get("children", [])
|
|
106
|
+
if not isinstance(children, list):
|
|
107
|
+
raise SchemaValidationError(f"Section children must be a list{context}")
|
|
108
|
+
for child in children:
|
|
109
|
+
child_id = child.get("id", "unknown")
|
|
110
|
+
_validate_node(child, f" in section '{node_id}' child '{child_id}'")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _validate_node(node: dict, context: str = "") -> None:
|
|
114
|
+
"""Validate a schema node recursively."""
|
|
115
|
+
category = node.get("category")
|
|
116
|
+
node_id = node.get("id", "")
|
|
117
|
+
|
|
118
|
+
if node_id:
|
|
119
|
+
_validate_id(node_id, context)
|
|
120
|
+
|
|
121
|
+
if category == "datapoint":
|
|
122
|
+
_validate_datapoint(node, context)
|
|
123
|
+
elif category == "tuple":
|
|
124
|
+
_validate_tuple(node, node_id, context)
|
|
125
|
+
elif category == "multivalue":
|
|
126
|
+
_validate_multivalue(node, node_id, context)
|
|
127
|
+
elif category == "section":
|
|
128
|
+
_validate_section(node, node_id, context)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rossum-mcp
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: MCP server for AI-powered Rossum orchestration: document workflows, debug pipelines automatically, and configure intelligent document processing through natural language.
|
|
5
5
|
Author-email: "Dan Stancl (Rossum AI)" <daniel.stancl@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
rossum_mcp/__init__.py,sha256=
|
|
1
|
+
rossum_mcp/__init__.py,sha256=1kziDEWWbx1ItojN48mBY_ToABnNwVmR0VANUW2bQ1s,58
|
|
2
2
|
rossum_mcp/logging_config.py,sha256=OH5G6K4wH_g-m55FdRO1BYXIDtOop-lD9Ps_mTMQ8eY,4792
|
|
3
3
|
rossum_mcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
rossum_mcp/server.py,sha256=6UViyT90CP8LouYgaxwSrSEdgJY1h0tpUjuqPNvbRKk,2338
|
|
@@ -14,12 +14,17 @@ rossum_mcp/tools/hooks.py,sha256=v1yKA8TtWQiZQkY_LYUC5lm8WRX4qMSeIkI2Z8m1OK0,128
|
|
|
14
14
|
rossum_mcp/tools/queues.py,sha256=QtGCt6pSMDmARoa9_L1fSzWjeMGFJSQLoW_sgSoBbwA,11063
|
|
15
15
|
rossum_mcp/tools/relations.py,sha256=ko1_v6meM2zCEmnhaDQt-T4uX_XJcRV4-X-Pxsu_prQ,2016
|
|
16
16
|
rossum_mcp/tools/rules.py,sha256=T-yZM9xMtZNZilOdm_go-9gIF3B6pxHS_qsLI_9OsWU,8214
|
|
17
|
-
rossum_mcp/tools/schemas.py,sha256=9QTV24SaTrzKUPkzYuOjL1b9vmVVPJee-crbWWF7RRo,30230
|
|
18
17
|
rossum_mcp/tools/users.py,sha256=uVojYtUQs4KorQxgmmPRNJtExS4GbzyckZ1W4Y_0Qrk,3047
|
|
19
18
|
rossum_mcp/tools/workspaces.py,sha256=miV8XeJxdWQctx6RuYJXmnbNmNDL0SKcG-Senq6cWk0,3338
|
|
20
|
-
rossum_mcp
|
|
21
|
-
rossum_mcp
|
|
22
|
-
rossum_mcp
|
|
23
|
-
rossum_mcp
|
|
24
|
-
rossum_mcp
|
|
25
|
-
rossum_mcp
|
|
19
|
+
rossum_mcp/tools/schemas/__init__.py,sha256=lHnhEFGO5gvha8PGOeW-h7vaQLkpKVnEf2qa6QlCIUU,6192
|
|
20
|
+
rossum_mcp/tools/schemas/models.py,sha256=sDFA-whdMHO0BlfeRjOh2WGfN_AJGmgZ5WhOeIL2gBo,4754
|
|
21
|
+
rossum_mcp/tools/schemas/operations.py,sha256=CJyQEQlH8IG8PPMZdqWqkPAF1PwyZ_MOXHD0L7WyNKU,7099
|
|
22
|
+
rossum_mcp/tools/schemas/patching.py,sha256=8Qf1wC8l2y8liVe-LXgAooJ1UrJPrzgnq1dKYQ0CPGs,7499
|
|
23
|
+
rossum_mcp/tools/schemas/pruning.py,sha256=OafLiWMIiwZLVGYl-fouMbMV-7ayDnPSJ1mxGn7rg80,4718
|
|
24
|
+
rossum_mcp/tools/schemas/validation.py,sha256=u9TZ91QEUIRy7RECyV-WjSt2Cz0HVxLno0SHtZgecUE,5177
|
|
25
|
+
rossum_mcp-1.1.1.dist-info/licenses/LICENSE,sha256=5nqARgtmPvoIU-1o1az3i8Qi2WOHYIn03vD6haewvEI,1087
|
|
26
|
+
rossum_mcp-1.1.1.dist-info/METADATA,sha256=FY7FnUt4iozU7JyFszEfHmuuCI2J1Lus3TYvtFvTEno,9644
|
|
27
|
+
rossum_mcp-1.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
28
|
+
rossum_mcp-1.1.1.dist-info/entry_points.txt,sha256=eth2XELk0QGw9-_H3QL8PQ0OE-RDfzipbSvRy0EUc2c,54
|
|
29
|
+
rossum_mcp-1.1.1.dist-info/top_level.txt,sha256=cziqyWFE89hFhCfsq60Fk6JcwslNtgP01WHIJ5plMEM,11
|
|
30
|
+
rossum_mcp-1.1.1.dist-info/RECORD,,
|