fix: accept the 'local' compute id in compute tools

The compute_get/compute_images MCP tools typed compute_id as a UUID, so
passing 'local' (the actual id of the built-in compute, which the
compute_images description itself pointed to) was rejected by schema
validation. Both tools now take a string defaulting to 'local', and the
compute_get REST route resolves 'local' through the controller since the
local compute has no database entry.
This commit is contained in:
YueGuobin committed 2026-08-26 00:44:57 +08:00
1 parent 6703e50487
commit df25e037ea
5 files changed
+63 -16

No files matched your search

@@ -79,6 +79,16 @@ class TestComputeRoutes:
assert response.status_code == status.HTTP_200_OK
assert response.json()["compute_id"] == str(test_compute.compute_id)
async def test_compute_get_local(self, app: FastAPI, client: AsyncClient, controller) -> None:
await controller.add_compute(
compute_id="local", name="local", host="127.0.0.1", port=3080, force=True, connect=False)
response = await client.get(app.url_path_for("get_compute", compute_id="local"))
assert response.status_code == status.HTTP_200_OK
assert response.json()["compute_id"] == "local"
assert response.json()["name"] == "local"
async def test_compute_update(self, app: FastAPI, client: AsyncClient, test_compute: Compute) -> None:
params = {