From 49c5043661b75f104e84d61f97abd22635815780 Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 1 Jan 2026 10:10:49 -0500 Subject: [PATCH] fix: use correct Grist API endpoint for modify_column The Grist API uses PATCH /tables/{table}/columns with a columns array in the body, not PATCH /tables/{table}/columns/{column_id}. Updated the endpoint to match the API spec. --- src/grist_mcp/grist_client.py | 3 ++- tests/unit/test_grist_client.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/grist_mcp/grist_client.py b/src/grist_mcp/grist_client.py index d4bc9e7..97468eb 100644 --- a/src/grist_mcp/grist_client.py +++ b/src/grist_mcp/grist_client.py @@ -160,7 +160,8 @@ class GristClient: if formula is not None: fields["formula"] = formula - await self._request("PATCH", f"/tables/{table}/columns/{column_id}", json={"fields": fields}) + payload = {"columns": [{"id": column_id, "fields": fields}]} + await self._request("PATCH", f"/tables/{table}/columns", json=payload) async def delete_column(self, table: str, column_id: str) -> None: """Delete a column from a table.""" diff --git a/tests/unit/test_grist_client.py b/tests/unit/test_grist_client.py index e08a72a..8cf39b3 100644 --- a/tests/unit/test_grist_client.py +++ b/tests/unit/test_grist_client.py @@ -160,7 +160,7 @@ async def test_add_column(client, httpx_mock: HTTPXMock): @pytest.mark.asyncio async def test_modify_column(client, httpx_mock: HTTPXMock): httpx_mock.add_response( - url="https://grist.example.com/api/docs/abc123/tables/Table1/columns/Amount", + url="https://grist.example.com/api/docs/abc123/tables/Table1/columns", method="PATCH", json={}, )