mcpforunityserver 9.3.0b20260129104751__py3-none-any.whl → 9.3.0b20260129121506__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcpforunityserver
3
- Version: 9.3.0b20260129104751
3
+ Version: 9.3.0b20260129121506
4
4
  Summary: MCP for Unity Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP).
5
5
  Author-email: Marcus Sanatan <msanatan@gmail.com>, David Sarno <david.sarno@gmail.com>, Wu Shutong <martinwfire@gmail.com>
6
6
  License-Expression: MIT
@@ -34,7 +34,7 @@ core/config.py,sha256=kE7yg_89QQck3zScWNjvrq7CnfYt6uLS0VdxK7AJ70o,1453
34
34
  core/logging_decorator.py,sha256=D9CD7rFvQz-MBG-G4inizQj0Ivr6dfc9RBmTrw7q8mI,1383
35
35
  core/telemetry.py,sha256=zIjmQKUNW0S822SSlkXyjjCIuX0ZpSTaZP4pAU0rCjw,20426
36
36
  core/telemetry_decorator.py,sha256=ycSTrzVNCDQHSd-xmIWOpVfKFURPxpiZe_XkOQAGDAo,6705
37
- mcpforunityserver-9.3.0b20260129104751.dist-info/licenses/LICENSE,sha256=bv5lDJZQEqxBgjjc1rkRbkEwpSIHF-8N-1Od0VnEJFw,1066
37
+ mcpforunityserver-9.3.0b20260129121506.dist-info/licenses/LICENSE,sha256=bv5lDJZQEqxBgjjc1rkRbkEwpSIHF-8N-1Od0VnEJFw,1066
38
38
  models/__init__.py,sha256=JlscZkGWE9TRmSoBi99v_LSl8OAFNGmr8463PYkXin4,179
39
39
  models/models.py,sha256=heXuvdBtdats1SGwW8wKFFHM0qR4hA6A7qETn5s9BZ0,1827
40
40
  models/unity_response.py,sha256=oJ1PTsnNc5VBC-9OgM59C0C-R9N-GdmEdmz_yph4GSU,1454
@@ -71,7 +71,7 @@ services/tools/manage_components.py,sha256=2_nKPk9iPAf5VyYiXuRxSkN8U76VNQbMtE68U
71
71
  services/tools/manage_editor.py,sha256=ShvlSBQRfoNQ0DvqBWak_Hi3MB7tv2WkMKEhrKQipk0,3279
72
72
  services/tools/manage_gameobject.py,sha256=SP-y3_7Ckw12JO6bLJy01Jrx303JXF-7RMROaQuA1kU,14154
73
73
  services/tools/manage_material.py,sha256=LSn9Kp-cSMZ5caU6Ux0M_OSMghCtZgOKkmvwf0xLTFE,4311
74
- services/tools/manage_prefabs.py,sha256=VKm6D9wR3B3wkyXUVBD__CqUpyzgFu1dUDYsVX6tbKE,7661
74
+ services/tools/manage_prefabs.py,sha256=7K-6kTavqu2-oxbA49Ug-vTh1Jt39ua02lWcijwM1DI,10163
75
75
  services/tools/manage_scene.py,sha256=-ARtRuj7ZNk_14lmMSORnQs0qTAYKBTPtUfk0sNDo6A,5370
76
76
  services/tools/manage_script.py,sha256=tT8JmhTtAYgW8CQla71cfn6IjiUw-tiPjBWVd4ipuCE,28551
77
77
  services/tools/manage_scriptable_object.py,sha256=tezG_mbGzPLNpL3F7l5JJLyyjJN3rJi1thGMU8cpOC4,3659
@@ -96,8 +96,8 @@ transport/legacy/stdio_port_registry.py,sha256=j4iARuP6wetppNDG8qKeuvo1bJKcSlgEh
96
96
  transport/legacy/unity_connection.py,sha256=FE9ZQfYMhHvIxBycr_DjI3BKvuEdORXuABnCE5Q2tjQ,36733
97
97
  utils/focus_nudge.py,sha256=0MCOms-SxUW7sN2hT3syy1epMdli2zc-6UHBICAfBSM,21330
98
98
  utils/module_discovery.py,sha256=My48ofB1BUqxiBoAZAGbEaLQYdsrDhMm8MayBP_bUSQ,2005
99
- mcpforunityserver-9.3.0b20260129104751.dist-info/METADATA,sha256=EpQqY2ZImvDyHMV7D16RFaKgDsSBd8DDvlgKWbCfoKs,6750
100
- mcpforunityserver-9.3.0b20260129104751.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
101
- mcpforunityserver-9.3.0b20260129104751.dist-info/entry_points.txt,sha256=pPm70RXQvkt3uBhPOtViDa47ZTA03RaQ6rwXvyi8oiI,70
102
- mcpforunityserver-9.3.0b20260129104751.dist-info/top_level.txt,sha256=3-A65WsmBO6UZYH8O5mINdyhhZ63SDssr8LncRd1PSQ,46
103
- mcpforunityserver-9.3.0b20260129104751.dist-info/RECORD,,
99
+ mcpforunityserver-9.3.0b20260129121506.dist-info/METADATA,sha256=NhUC2AYe0dyaYPjuAkHQN1wksQiDGTHHM_8k8IvcEw4,6750
100
+ mcpforunityserver-9.3.0b20260129121506.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
101
+ mcpforunityserver-9.3.0b20260129121506.dist-info/entry_points.txt,sha256=pPm70RXQvkt3uBhPOtViDa47ZTA03RaQ6rwXvyi8oiI,70
102
+ mcpforunityserver-9.3.0b20260129121506.dist-info/top_level.txt,sha256=3-A65WsmBO6UZYH8O5mINdyhhZ63SDssr8LncRd1PSQ,46
103
+ mcpforunityserver-9.3.0b20260129121506.dist-info/RECORD,,
@@ -25,6 +25,10 @@ REQUIRED_PARAMS = {
25
25
  "Manages Unity Prefab assets via headless operations (no UI, no prefab stages). "
26
26
  "Actions: get_info, get_hierarchy, create_from_gameobject, modify_contents. "
27
27
  "Use modify_contents for headless prefab editing - ideal for automated workflows. "
28
+ "Use create_child parameter with modify_contents to add child GameObjects to a prefab "
29
+ "(single object or array for batch creation in one save). "
30
+ "Example: create_child=[{\"name\": \"Child1\", \"primitive_type\": \"Sphere\", \"position\": [1,0,0]}, "
31
+ "{\"name\": \"Child2\", \"primitive_type\": \"Cube\", \"parent\": \"Child1\"}]. "
28
32
  "Use manage_asset action=search filterType=Prefab to list prefabs."
29
33
  ),
30
34
  annotations=ToolAnnotations(
@@ -59,6 +63,7 @@ async def manage_prefabs(
59
63
  parent: Annotated[str, "New parent object name/path within prefab for modify_contents."] | None = None,
60
64
  components_to_add: Annotated[list[str], "Component types to add in modify_contents."] | None = None,
61
65
  components_to_remove: Annotated[list[str], "Component types to remove in modify_contents."] | None = None,
66
+ create_child: Annotated[dict[str, Any] | list[dict[str, Any]], "Create child GameObject(s) in the prefab. Single object or array of objects, each with: name (required), parent (optional, defaults to target), primitive_type (optional: Cube, Sphere, Capsule, Cylinder, Plane, Quad), position, rotation, scale, components_to_add, tag, layer, set_active."] | None = None,
62
67
  ) -> dict[str, Any]:
63
68
  # Back-compat: map 'name' → 'target' for create_from_gameobject (Unity accepts both)
64
69
  if action == "create_from_gameobject" and target is None and name is not None:
@@ -143,6 +148,36 @@ async def manage_prefabs(
143
148
  params["componentsToAdd"] = components_to_add
144
149
  if components_to_remove is not None:
145
150
  params["componentsToRemove"] = components_to_remove
151
+ if create_child is not None:
152
+ # Normalize vector fields within create_child (handles single object or array)
153
+ def normalize_child_params(child: Any, index: int | None = None) -> tuple[dict | None, str | None]:
154
+ prefix = f"create_child[{index}]" if index is not None else "create_child"
155
+ if not isinstance(child, dict):
156
+ return None, f"{prefix} must be a dict with child properties (name, primitive_type, position, etc.), got {type(child).__name__}"
157
+ child_params = dict(child)
158
+ for vec_field in ("position", "rotation", "scale"):
159
+ if vec_field in child_params and child_params[vec_field] is not None:
160
+ vec_val, vec_err = normalize_vector3(child_params[vec_field], f"{prefix}.{vec_field}")
161
+ if vec_err:
162
+ return None, vec_err
163
+ child_params[vec_field] = vec_val
164
+ return child_params, None
165
+
166
+ if isinstance(create_child, list):
167
+ # Array of children
168
+ normalized_children = []
169
+ for i, child in enumerate(create_child):
170
+ child_params, err = normalize_child_params(child, i)
171
+ if err:
172
+ return {"success": False, "message": err}
173
+ normalized_children.append(child_params)
174
+ params["createChild"] = normalized_children
175
+ else:
176
+ # Single child object
177
+ child_params, err = normalize_child_params(create_child)
178
+ if err:
179
+ return {"success": False, "message": err}
180
+ params["createChild"] = child_params
146
181
 
147
182
  # Send command to Unity
148
183
  response = await send_with_unity_instance(