fix: fable_add_task_log sends content not body to match API
The MCP tool was sending {"body": ...} but the task logs API route
expects {"content": ...}, causing 400 errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -298,7 +298,7 @@ async def fable_update_task(
|
|||||||
|
|
||||||
|
|
||||||
@mcp.tool()
|
@mcp.tool()
|
||||||
async def fable_add_task_log(task_id: int, body: str) -> dict:
|
async def fable_add_task_log(task_id: int, content: str) -> dict:
|
||||||
"""Append a timestamped progress log entry to a Fable task.
|
"""Append a timestamped progress log entry to a Fable task.
|
||||||
|
|
||||||
Use this to record work sessions, decisions, or status updates over time without
|
Use this to record work sessions, decisions, or status updates over time without
|
||||||
@@ -306,7 +306,7 @@ async def fable_add_task_log(task_id: int, body: str) -> dict:
|
|||||||
chronologically in the task view.
|
chronologically in the task view.
|
||||||
"""
|
"""
|
||||||
async with FableClient() as client:
|
async with FableClient() as client:
|
||||||
return await tasks.add_task_log(client, task_id=task_id, body=body)
|
return await tasks.add_task_log(client, task_id=task_id, content=content)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ async def add_task_log(
|
|||||||
client: FableClient,
|
client: FableClient,
|
||||||
*,
|
*,
|
||||||
task_id: int,
|
task_id: int,
|
||||||
body: str,
|
content: str,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""Append a log entry to a task."""
|
"""Append a log entry to a task."""
|
||||||
return await client.post(f"/api/tasks/{task_id}/logs", json={"body": body})
|
return await client.post(f"/api/tasks/{task_id}/logs", json={"content": content})
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ async def test_update_task_patches(client):
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_add_task_log_posts_to_logs_endpoint(client):
|
async def test_add_task_log_posts_to_logs_endpoint(client):
|
||||||
from fable_mcp.tools.tasks import add_task_log
|
from fable_mcp.tools.tasks import add_task_log
|
||||||
client.post = AsyncMock(return_value={"id": 1, "body": "progress"})
|
client.post = AsyncMock(return_value={"id": 1, "content": "progress"})
|
||||||
await add_task_log(client, task_id=9, body="progress")
|
await add_task_log(client, task_id=9, content="progress")
|
||||||
client.post.assert_called_once()
|
client.post.assert_called_once()
|
||||||
path = client.post.call_args[0][0]
|
path = client.post.call_args[0][0]
|
||||||
assert path == "/api/tasks/9/logs"
|
assert path == "/api/tasks/9/logs"
|
||||||
assert client.post.call_args[1]["json"]["body"] == "progress"
|
assert client.post.call_args[1]["json"]["content"] == "progress"
|
||||||
|
|||||||
Reference in New Issue
Block a user