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
+13 -13
View File
@@ -8,9 +8,9 @@ import pytest
from fabledassistant.mcp._context import _user_id_ctx
from fabledassistant.mcp.tools.entities import (
fable_list_persons, fable_create_person, fable_update_person,
fable_create_place, fable_update_place,
fable_create_list, fable_update_list,
list_persons, create_person, update_person,
create_place, update_place,
create_list, update_list,
)
@@ -39,7 +39,7 @@ def _fake_note(*, note_type="note", entity_meta=None, **overrides) -> MagicMock:
async def test_list_persons_calls_knowledge_with_person_type():
mock = AsyncMock(return_value=([{"id": 1, "title": "alice"}], 1))
with patch("fabledassistant.mcp.tools.entities.knowledge_svc.query_knowledge", mock):
out = await fable_list_persons(tag="work")
out = await list_persons(tag="work")
kwargs = mock.call_args.kwargs
assert kwargs["note_type"] == "person"
assert kwargs["tags"] == ["work"]
@@ -56,7 +56,7 @@ async def test_create_person_only_includes_provided_fields_in_meta():
fake = _fake_note(note_type="person")
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
await fable_create_person(name="Alice", email="a@x.com")
await create_person(name="Alice", email="a@x.com")
kwargs = mock.call_args.kwargs
assert kwargs["title"] == "Alice"
assert kwargs["note_type"] == "person"
@@ -69,7 +69,7 @@ async def test_create_person_all_empty_meta_is_none():
fake = _fake_note(note_type="person")
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
await fable_create_person(name="Bob")
await create_person(name="Bob")
assert mock.call_args.kwargs["entity_meta"] is None
@@ -78,7 +78,7 @@ async def test_create_place_categories_into_meta():
fake = _fake_note(note_type="place")
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
await fable_create_place(name="Cafe X", address="123 Main", category="coffee")
await create_place(name="Cafe X", address="123 Main", category="coffee")
meta = mock.call_args.kwargs["entity_meta"]
assert meta == {"address": "123 Main", "category": "coffee"}
@@ -88,7 +88,7 @@ async def test_create_list_translates_strings_to_unchecked_items():
fake = _fake_note(note_type="list")
mock = AsyncMock(return_value=fake)
with patch("fabledassistant.mcp.tools.entities.notes_svc.create_note", mock):
await fable_create_list(name="shopping", items=["milk", "bread"])
await create_list(name="shopping", items=["milk", "bread"])
meta = mock.call_args.kwargs["entity_meta"]
assert meta["list_items"] == [
{"text": "milk", "checked": False},
@@ -114,7 +114,7 @@ async def test_update_person_merges_meta_preserving_other_fields():
), patch(
"fabledassistant.mcp.tools.entities.notes_svc.update_note", update_mock,
):
await fable_update_person(person_id=5, email="new@x.com")
await update_person(person_id=5, email="new@x.com")
new_meta = update_mock.call_args.kwargs["entity_meta"]
assert new_meta == {"email": "new@x.com", "phone": "555-1234"}
@@ -133,7 +133,7 @@ async def test_update_person_no_typed_fields_keeps_meta_unchanged():
"fabledassistant.mcp.tools.entities.notes_svc.update_note",
AsyncMock(return_value=updated),
) as update_mock:
await fable_update_person(person_id=5, name="New Name")
await update_person(person_id=5, name="New Name")
# entity_meta unchanged, but still passed (service gets the full new dict)
assert update_mock.call_args.kwargs["entity_meta"] == {"email": "a@x.com"}
assert update_mock.call_args.kwargs["title"] == "New Name"
@@ -148,7 +148,7 @@ async def test_update_person_rejects_wrong_type():
AsyncMock(return_value=wrong_type),
):
with pytest.raises(ValueError, match="person 5 not found"):
await fable_update_person(person_id=5, email="x@x.com")
await update_person(person_id=5, email="x@x.com")
@pytest.mark.asyncio
@@ -166,7 +166,7 @@ async def test_update_list_items_empty_list_clears_items():
"fabledassistant.mcp.tools.entities.notes_svc.update_note",
AsyncMock(return_value=updated),
) as update_mock:
await fable_update_list(list_id=5, items=[])
await update_list(list_id=5, items=[])
assert update_mock.call_args.kwargs["entity_meta"]["list_items"] == []
@@ -184,7 +184,7 @@ async def test_update_list_items_none_leaves_items_unchanged():
"fabledassistant.mcp.tools.entities.notes_svc.update_note",
AsyncMock(return_value=updated),
) as update_mock:
await fable_update_list(list_id=5, name="renamed")
await update_list(list_id=5, name="renamed")
# Existing items intact in the merged meta
assert update_mock.call_args.kwargs["entity_meta"]["list_items"] == [
{"text": "keep", "checked": False},