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
@@ -5,8 +5,8 @@ import pytest
from fabledassistant.mcp._context import _user_id_ctx
from fabledassistant.mcp.tools.notes import (
fable_list_notes, fable_get_note, fable_create_note,
fable_update_note, fable_delete_note,
list_notes, get_note, create_note,
update_note, delete_note,
)
@@ -32,7 +32,7 @@ async def test_list_notes_repackages_tuple_into_dict():
"fabledassistant.mcp.tools.notes.notes_svc.list_notes",
AsyncMock(return_value=(rows, 2)),
):
out = await fable_list_notes()
out = await list_notes()
assert out["total"] == 2
assert len(out["notes"]) == 2
@@ -41,7 +41,7 @@ async def test_list_notes_repackages_tuple_into_dict():
async def test_list_notes_passes_is_task_false():
mock = AsyncMock(return_value=([], 0))
with patch("fabledassistant.mcp.tools.notes.notes_svc.list_notes", mock):
await fable_list_notes()
await list_notes()
assert mock.call_args.kwargs["is_task"] is False
@@ -50,7 +50,7 @@ async def test_list_notes_tag_filter_maps_to_list():
"""The single-tag string param maps to a one-element list at the service layer."""
mock = AsyncMock(return_value=([], 0))
with patch("fabledassistant.mcp.tools.notes.notes_svc.list_notes", mock):
await fable_list_notes(tag="ops")
await list_notes(tag="ops")
assert mock.call_args.kwargs["tags"] == ["ops"]
@@ -58,7 +58,7 @@ async def test_list_notes_tag_filter_maps_to_list():
async def test_list_notes_empty_tag_means_no_filter():
mock = AsyncMock(return_value=([], 0))
with patch("fabledassistant.mcp.tools.notes.notes_svc.list_notes", mock):
await fable_list_notes(tag="")
await list_notes(tag="")
assert mock.call_args.kwargs["tags"] is None
@@ -66,7 +66,7 @@ async def test_list_notes_empty_tag_means_no_filter():
async def test_list_notes_search_text_maps_to_q():
mock = AsyncMock(return_value=([], 0))
with patch("fabledassistant.mcp.tools.notes.notes_svc.list_notes", mock):
await fable_list_notes(search_text="kafka")
await list_notes(search_text="kafka")
assert mock.call_args.kwargs["q"] == "kafka"
@@ -74,7 +74,7 @@ async def test_list_notes_search_text_maps_to_q():
async def test_list_notes_limit_clamped():
mock = AsyncMock(return_value=([], 0))
with patch("fabledassistant.mcp.tools.notes.notes_svc.list_notes", mock):
await fable_list_notes(limit=9999)
await list_notes(limit=9999)
assert mock.call_args.kwargs["limit"] == 100
@@ -85,7 +85,7 @@ async def test_get_note_returns_dict():
"fabledassistant.mcp.tools.notes.notes_svc.get_note",
AsyncMock(return_value=fake),
):
out = await fable_get_note(note_id=5)
out = await get_note(note_id=5)
assert out["id"] == 5
assert out["title"] == "found"
@@ -97,7 +97,7 @@ async def test_get_note_raises_when_not_found():
AsyncMock(return_value=None),
):
with pytest.raises(ValueError, match="note 999 not found"):
await fable_get_note(note_id=999)
await get_note(note_id=999)
@pytest.mark.asyncio
@@ -105,7 +105,7 @@ async def test_create_note_passes_through():
fake = _fake_note(id=10, title="new")
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.notes.notes_svc.create_note", mock):
out = await fable_create_note(title="new", body="x", tags=["a"], project_id=5)
out = await create_note(title="new", body="x", tags=["a"], project_id=5)
assert out["id"] == 10
assert mock.call_args.kwargs["title"] == "new"
assert mock.call_args.kwargs["project_id"] == 5
@@ -117,7 +117,7 @@ async def test_create_note_project_zero_becomes_none():
fake = _fake_note()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.notes.notes_svc.create_note", mock):
await fable_create_note(title="t", project_id=0)
await create_note(title="t", project_id=0)
assert mock.call_args.kwargs["project_id"] is None
@@ -128,7 +128,7 @@ async def test_update_note_only_sends_non_default_fields():
fake = _fake_note()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.notes.notes_svc.update_note", mock):
await fable_update_note(note_id=1, title="new title")
await update_note(note_id=1, title="new title")
# Service got user_id, note_id positional + only the title kwarg
args, kwargs = mock.call_args
assert args == (7, 1)
@@ -141,7 +141,7 @@ async def test_update_note_empty_tags_clears_explicitly():
fake = _fake_note()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.notes.notes_svc.update_note", mock):
await fable_update_note(note_id=1, tags=[])
await update_note(note_id=1, tags=[])
assert mock.call_args.kwargs == {"tags": []}
@@ -150,7 +150,7 @@ async def test_update_note_tags_none_means_omit():
fake = _fake_note()
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.notes.notes_svc.update_note", mock):
await fable_update_note(note_id=1, tags=None)
await update_note(note_id=1, tags=None)
assert "tags" not in mock.call_args.kwargs
@@ -161,7 +161,7 @@ async def test_update_note_raises_when_not_found():
AsyncMock(return_value=None),
):
with pytest.raises(ValueError, match="note 999 not found"):
await fable_update_note(note_id=999, title="x")
await update_note(note_id=999, title="x")
@pytest.mark.asyncio
@@ -170,7 +170,7 @@ async def test_delete_note_returns_confirmation_string():
"fabledassistant.mcp.tools.notes.notes_svc.delete_note",
AsyncMock(return_value=True),
):
result = await fable_delete_note(note_id=7)
result = await delete_note(note_id=7)
assert result == "Note 7 deleted."
@@ -181,4 +181,4 @@ async def test_delete_note_raises_when_not_found():
AsyncMock(return_value=False),
):
with pytest.raises(ValueError, match="note 999 not found"):
await fable_delete_note(note_id=999)
await delete_note(note_id=999)