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
+10 -10
View File
@@ -1,4 +1,4 @@
"""fable_search tool — proves the tool pattern (context + service call + dict shape).
"""search tool — proves the tool pattern (context + service call + dict shape).
Service call is mocked; no DB needed."""
from unittest.mock import AsyncMock, MagicMock, patch
@@ -6,7 +6,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from fabledassistant.mcp._context import _user_id_ctx
from fabledassistant.mcp.tools.search import fable_search
from fabledassistant.mcp.tools.search import search
@pytest.fixture(autouse=True)
@@ -31,7 +31,7 @@ def _fake_note(*, id: int, title: str, body: str = "",
@pytest.mark.asyncio
async def test_fable_search_raises_without_context():
with pytest.raises(RuntimeError, match="no MCP user context"):
await fable_search(q="anything")
await search(q="anything")
@pytest.mark.asyncio
@@ -43,7 +43,7 @@ async def test_fable_search_returns_repackaged_results():
"fabledassistant.mcp.tools.search.semantic_search_notes",
AsyncMock(return_value=[(0.93, fake)]),
):
out = await fable_search(q="kafka")
out = await search(q="kafka")
assert out["total"] == 1
assert len(out["results"]) == 1
@@ -65,7 +65,7 @@ async def test_fable_search_body_is_truncated_to_240_chars():
"fabledassistant.mcp.tools.search.semantic_search_notes",
AsyncMock(return_value=[(0.5, fake)]),
):
out = await fable_search(q="x")
out = await search(q="x")
assert len(out["results"][0]["body"]) == 240
@@ -75,15 +75,15 @@ async def test_fable_search_content_type_filters_at_service_layer():
_user_id_ctx.set(7)
mock_search = AsyncMock(return_value=[])
with patch("fabledassistant.mcp.tools.search.semantic_search_notes", mock_search):
await fable_search(q="x", content_type="task")
await search(q="x", content_type="task")
assert mock_search.call_args.kwargs["is_task"] is True
mock_search.reset_mock()
await fable_search(q="x", content_type="note")
await search(q="x", content_type="note")
assert mock_search.call_args.kwargs["is_task"] is False
mock_search.reset_mock()
await fable_search(q="x", content_type="all")
await search(q="x", content_type="all")
assert mock_search.call_args.kwargs["is_task"] is None
@@ -92,9 +92,9 @@ async def test_fable_search_limit_is_clamped():
_user_id_ctx.set(7)
mock_search = AsyncMock(return_value=[])
with patch("fabledassistant.mcp.tools.search.semantic_search_notes", mock_search):
await fable_search(q="x", limit=999)
await search(q="x", limit=999)
assert mock_search.call_args.kwargs["limit"] == 50
mock_search.reset_mock()
await fable_search(q="x", limit=0)
await search(q="x", limit=0)
assert mock_search.call_args.kwargs["limit"] == 1