mcpforunityserver 8.7.1__py3-none-any.whl → 9.0.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.
Files changed (53) hide show
  1. main.py +4 -3
  2. {mcpforunityserver-8.7.1.dist-info → mcpforunityserver-9.0.1.dist-info}/METADATA +2 -2
  3. mcpforunityserver-9.0.1.dist-info/RECORD +72 -0
  4. {mcpforunityserver-8.7.1.dist-info → mcpforunityserver-9.0.1.dist-info}/top_level.txt +0 -1
  5. services/custom_tool_service.py +13 -8
  6. services/resources/active_tool.py +1 -1
  7. services/resources/custom_tools.py +2 -2
  8. services/resources/editor_state.py +283 -30
  9. services/resources/gameobject.py +243 -0
  10. services/resources/layers.py +1 -1
  11. services/resources/prefab_stage.py +1 -1
  12. services/resources/project_info.py +1 -1
  13. services/resources/selection.py +1 -1
  14. services/resources/tags.py +1 -1
  15. services/resources/unity_instances.py +1 -1
  16. services/resources/windows.py +1 -1
  17. services/state/external_changes_scanner.py +3 -4
  18. services/tools/batch_execute.py +24 -9
  19. services/tools/debug_request_context.py +8 -2
  20. services/tools/execute_custom_tool.py +6 -1
  21. services/tools/execute_menu_item.py +6 -3
  22. services/tools/find_gameobjects.py +89 -0
  23. services/tools/find_in_file.py +26 -19
  24. services/tools/manage_asset.py +13 -44
  25. services/tools/manage_components.py +131 -0
  26. services/tools/manage_editor.py +9 -8
  27. services/tools/manage_gameobject.py +115 -79
  28. services/tools/manage_material.py +80 -31
  29. services/tools/manage_prefabs.py +7 -1
  30. services/tools/manage_scene.py +30 -13
  31. services/tools/manage_script.py +62 -19
  32. services/tools/manage_scriptable_object.py +22 -10
  33. services/tools/manage_shader.py +8 -1
  34. services/tools/manage_vfx.py +738 -0
  35. services/tools/preflight.py +15 -12
  36. services/tools/read_console.py +11 -4
  37. services/tools/refresh_unity.py +24 -14
  38. services/tools/run_tests.py +162 -53
  39. services/tools/script_apply_edits.py +15 -7
  40. services/tools/set_active_instance.py +12 -7
  41. services/tools/utils.py +60 -6
  42. transport/legacy/port_discovery.py +2 -2
  43. transport/legacy/unity_connection.py +1 -1
  44. transport/plugin_hub.py +24 -16
  45. transport/unity_instance_middleware.py +4 -3
  46. transport/unity_transport.py +2 -1
  47. mcpforunityserver-8.7.1.dist-info/RECORD +0 -71
  48. routes/__init__.py +0 -0
  49. services/resources/editor_state_v2.py +0 -270
  50. services/tools/test_jobs.py +0 -94
  51. {mcpforunityserver-8.7.1.dist-info → mcpforunityserver-9.0.1.dist-info}/WHEEL +0 -0
  52. {mcpforunityserver-8.7.1.dist-info → mcpforunityserver-9.0.1.dist-info}/entry_points.txt +0 -0
  53. {mcpforunityserver-8.7.1.dist-info → mcpforunityserver-9.0.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,94 +0,0 @@
1
- """Async Unity Test Runner jobs: start + poll."""
2
- from __future__ import annotations
3
-
4
- from typing import Annotated, Any, Literal
5
-
6
- from fastmcp import Context
7
-
8
- from models import MCPResponse
9
- from services.registry import mcp_for_unity_tool
10
- from services.tools import get_unity_instance_from_context
11
- from services.tools.preflight import preflight
12
- import transport.unity_transport as unity_transport
13
- from transport.legacy.unity_connection import async_send_command_with_retry
14
-
15
-
16
- @mcp_for_unity_tool(description="Starts a Unity test run asynchronously and returns a job_id immediately. Preferred over run_tests for long-running suites. Poll with get_test_job for progress.")
17
- async def run_tests_async(
18
- ctx: Context,
19
- mode: Annotated[Literal["EditMode", "PlayMode"], "Unity test mode to run"] = "EditMode",
20
- test_names: Annotated[list[str] | str, "Full names of specific tests to run"] | None = None,
21
- group_names: Annotated[list[str] | str, "Same as test_names, except it allows for Regex"] | None = None,
22
- category_names: Annotated[list[str] | str, "NUnit category names to filter by"] | None = None,
23
- assembly_names: Annotated[list[str] | str, "Assembly names to filter tests by"] | None = None,
24
- include_failed_tests: Annotated[bool, "Include details for failed/skipped tests only (default: false)"] = False,
25
- include_details: Annotated[bool, "Include details for all tests (default: false)"] = False,
26
- ) -> dict[str, Any] | MCPResponse:
27
- unity_instance = get_unity_instance_from_context(ctx)
28
-
29
- gate = await preflight(ctx, requires_no_tests=True, wait_for_no_compile=True, refresh_if_dirty=True)
30
- if isinstance(gate, MCPResponse):
31
- return gate
32
-
33
- def _coerce_string_list(value) -> list[str] | None:
34
- if value is None:
35
- return None
36
- if isinstance(value, str):
37
- return [value] if value.strip() else None
38
- if isinstance(value, list):
39
- result = [str(v).strip() for v in value if v and str(v).strip()]
40
- return result if result else None
41
- return None
42
-
43
- params: dict[str, Any] = {"mode": mode}
44
- if (t := _coerce_string_list(test_names)):
45
- params["testNames"] = t
46
- if (g := _coerce_string_list(group_names)):
47
- params["groupNames"] = g
48
- if (c := _coerce_string_list(category_names)):
49
- params["categoryNames"] = c
50
- if (a := _coerce_string_list(assembly_names)):
51
- params["assemblyNames"] = a
52
- if include_failed_tests:
53
- params["includeFailedTests"] = True
54
- if include_details:
55
- params["includeDetails"] = True
56
-
57
- response = await unity_transport.send_with_unity_instance(
58
- async_send_command_with_retry,
59
- unity_instance,
60
- "run_tests_async",
61
- params,
62
- )
63
-
64
- if isinstance(response, dict) and not response.get("success", True):
65
- return MCPResponse(**response)
66
- return response if isinstance(response, dict) else MCPResponse(success=False, error=str(response)).model_dump()
67
-
68
-
69
- @mcp_for_unity_tool(description="Polls an async Unity test job by job_id.")
70
- async def get_test_job(
71
- ctx: Context,
72
- job_id: Annotated[str, "Job id returned by run_tests_async"],
73
- include_failed_tests: Annotated[bool, "Include details for failed/skipped tests only (default: false)"] = False,
74
- include_details: Annotated[bool, "Include details for all tests (default: false)"] = False,
75
- ) -> dict[str, Any] | MCPResponse:
76
- unity_instance = get_unity_instance_from_context(ctx)
77
-
78
- params: dict[str, Any] = {"job_id": job_id}
79
- if include_failed_tests:
80
- params["includeFailedTests"] = True
81
- if include_details:
82
- params["includeDetails"] = True
83
-
84
- response = await unity_transport.send_with_unity_instance(
85
- async_send_command_with_retry,
86
- unity_instance,
87
- "get_test_job",
88
- params,
89
- )
90
- if isinstance(response, dict) and not response.get("success", True):
91
- return MCPResponse(**response)
92
- return response if isinstance(response, dict) else MCPResponse(success=False, error=str(response)).model_dump()
93
-
94
-