refactor(mcp): drop fable_ prefix from tool names; rebrand to Scribe

MCP clients see tools namespaced by the server's local name already
(mcp__<server>__<tool>), so the fable_ prefix on every tool name was
redundant and ate tokens in the model's tool list.

Tools renamed (34 total):
  fable_search → search
  fable_list_notes / get_note / create_note / update_note / delete_note → list_notes / ...
  fable_list_tasks / get_task / create_task / update_task / add_task_log → list_tasks / ...
  fable_list_projects / get_project / create_project / update_project → list_projects / ...
  fable_list_milestones / create_milestone / update_milestone → list_milestones / ...
  fable_list_events / create_event / get_event / update_event / delete_event → list_events / ...
  fable_list_tags → list_tags
  fable_get_recent → get_recent
  fable_list_persons / create_person / update_person → list_persons / ...
  fable_list_places / create_place / update_place → list_places / ...
  fable_list_lists / create_list / update_list → list_lists / ...

Also rebranded in MCP scope:
  FastMCP("fable", ...) → FastMCP("scribe", ...)
  auth realm "fable-mcp" → "scribe-mcp"
  ASGI scope key fable_user_id → scribe_user_id
  ContextVar label fable_mcp_user_id → scribe_mcp_user_id
  Tool docstrings "in Fable" / "Fable task" → "in Scribe" / "Scribe task"
  Server _INSTRUCTIONS prose

Deliberately kept:
  - The internal Python package name `fabledassistant` (per project naming
    convention — internal stays).
  - "Fabled Scribe" as the official product/brand name (page footer,
    smtp_from_name default).
  - References to the legacy `fable-mcp/` standalone package in docstrings
    explaining what we ported from — accurate until that directory is
    deleted in Phase 10.

Client impact: existing MCP registrations need
  claude mcp remove <name> && claude mcp add ...
once with a freshly-copied snippet from Settings → MCP Access. Claude
Code then re-discovers tools on connect — old conversations that
referenced fable_* tool names will see "tool not found" on those calls
until updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 11:48:55 -04:00
parent 97c22941a8
commit 6aa84002b3
19 changed files with 191 additions and 190 deletions
+18 -18
View File
@@ -6,8 +6,8 @@ import pytest
from fabledassistant.mcp._context import _user_id_ctx
from fabledassistant.mcp.tools.tasks import (
fable_list_tasks, fable_get_task, fable_create_task,
fable_update_task, fable_add_task_log,
list_tasks, get_task, create_task,
update_task, add_task_log,
)
@@ -37,7 +37,7 @@ async def test_list_tasks_passes_is_task_true_and_repackages():
rows = [_fake_task(id=1), _fake_task(id=2)]
mock = AsyncMock(return_value=(rows, 2))
with patch("fabledassistant.mcp.tools.tasks.notes_svc.list_notes", mock):
out = await fable_list_tasks()
out = await list_tasks()
assert out["total"] == 2
assert len(out["tasks"]) == 2
assert mock.call_args.kwargs["is_task"] is True
@@ -47,7 +47,7 @@ async def test_list_tasks_passes_is_task_true_and_repackages():
async def test_list_tasks_status_filter():
mock = AsyncMock(return_value=([], 0))
with patch("fabledassistant.mcp.tools.tasks.notes_svc.list_notes", mock):
await fable_list_tasks(status="in_progress")
await list_tasks(status="in_progress")
assert mock.call_args.kwargs["status"] == "in_progress"
@@ -55,7 +55,7 @@ async def test_list_tasks_status_filter():
async def test_list_tasks_empty_status_means_no_filter():
mock = AsyncMock(return_value=([], 0))
with patch("fabledassistant.mcp.tools.tasks.notes_svc.list_notes", mock):
await fable_list_tasks(status="")
await list_tasks(status="")
assert mock.call_args.kwargs["status"] is None
@@ -66,20 +66,20 @@ async def test_get_task_with_no_parent_returns_null_parent_title():
"fabledassistant.mcp.tools.tasks.notes_svc.get_note",
AsyncMock(return_value=fake),
):
out = await fable_get_task(task_id=5)
out = await get_task(task_id=5)
assert out["parent_title"] is None
assert out["title"] == "solo"
@pytest.mark.asyncio
async def test_get_task_enriches_with_parent_title():
"""When parent_id is set, fable_get_task fetches the parent and adds parent_title."""
"""When parent_id is set, get_task fetches the parent and adds parent_title."""
child = _fake_task(id=10, title="child", parent_id=5)
parent = _fake_task(id=5, title="parent of 10", parent_id=None)
# get_note is called twice: once for child, once for parent
mock_get = AsyncMock(side_effect=[child, parent])
with patch("fabledassistant.mcp.tools.tasks.notes_svc.get_note", mock_get):
out = await fable_get_task(task_id=10)
out = await get_task(task_id=10)
assert out["parent_title"] == "parent of 10"
assert mock_get.await_count == 2
@@ -90,7 +90,7 @@ async def test_get_task_parent_missing_returns_null():
child = _fake_task(id=10, parent_id=5)
mock_get = AsyncMock(side_effect=[child, None])
with patch("fabledassistant.mcp.tools.tasks.notes_svc.get_note", mock_get):
out = await fable_get_task(task_id=10)
out = await get_task(task_id=10)
assert out["parent_title"] is None
@@ -101,7 +101,7 @@ async def test_get_task_raises_when_not_found():
AsyncMock(return_value=None),
):
with pytest.raises(ValueError, match="task 999 not found"):
await fable_get_task(task_id=999)
await get_task(task_id=999)
@pytest.mark.asyncio
@@ -109,7 +109,7 @@ async def test_create_task_passes_status():
fake = _fake_task()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.tasks.notes_svc.create_note", mock):
await fable_create_task(title="do x", status="todo")
await create_task(title="do x", status="todo")
assert mock.call_args.kwargs["status"] == "todo"
@@ -118,7 +118,7 @@ async def test_create_task_priority_empty_becomes_none():
fake = _fake_task()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.tasks.notes_svc.create_note", mock):
await fable_create_task(title="x", priority="")
await create_task(title="x", priority="")
assert mock.call_args.kwargs["priority"] is None
@@ -127,7 +127,7 @@ async def test_create_task_zero_id_sentinels_become_none():
fake = _fake_task()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.tasks.notes_svc.create_note", mock):
await fable_create_task(title="x", project_id=0, milestone_id=0, parent_id=0)
await create_task(title="x", project_id=0, milestone_id=0, parent_id=0)
assert mock.call_args.kwargs["project_id"] is None
assert mock.call_args.kwargs["milestone_id"] is None
assert mock.call_args.kwargs["parent_id"] is None
@@ -138,7 +138,7 @@ async def test_update_task_only_sends_non_default_fields():
fake = _fake_task()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.tasks.notes_svc.update_note", mock):
await fable_update_task(task_id=1, status="done")
await update_task(task_id=1, status="done")
args, kwargs = mock.call_args
assert args == (7, 1)
assert kwargs == {"status": "done"}
@@ -150,7 +150,7 @@ async def test_update_task_empty_priority_is_omitted():
fake = _fake_task()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.tasks.notes_svc.update_note", mock):
await fable_update_task(task_id=1, status="done", priority="")
await update_task(task_id=1, status="done", priority="")
assert "priority" not in mock.call_args.kwargs
@@ -161,7 +161,7 @@ async def test_update_task_raises_when_not_found():
AsyncMock(return_value=None),
):
with pytest.raises(ValueError, match="task 999 not found"):
await fable_update_task(task_id=999, status="done")
await update_task(task_id=999, status="done")
@pytest.mark.asyncio
@@ -177,7 +177,7 @@ async def test_add_task_log_returns_log_dict():
"fabledassistant.mcp.tools.tasks.task_logs_svc.create_log",
AsyncMock(return_value=log),
):
out = await fable_add_task_log(task_id=1, content="checkpoint")
out = await add_task_log(task_id=1, content="checkpoint")
assert out["id"] == 5
assert out["task_id"] == 1
assert out["content"] == "checkpoint"
@@ -192,4 +192,4 @@ async def test_add_task_log_propagates_value_error_when_task_missing():
AsyncMock(side_effect=ValueError("Task 999 not found")),
):
with pytest.raises(ValueError):
await fable_add_task_log(task_id=999, content="x")
await add_task_log(task_id=999, content="x")