From 79544bb42d534491be6e66fb9ee73b9d57d037af Mon Sep 17 00:00:00 2001 From: Adeel Ahmad Date: Sun, 4 Oct 2026 14:59:45 +0000 Subject: [PATCH] fix(notes): narrow read_note's draft page so mypy passes Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XZQXJtCvJgbG1Z2H312KcS --- fastapi_backend/app/api/mcp_tools.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fastapi_backend/app/api/mcp_tools.py b/fastapi_backend/app/api/mcp_tools.py index c181a0d58..1b0af940b 100644 --- a/fastapi_backend/app/api/mcp_tools.py +++ b/fastapi_backend/app/api/mcp_tools.py @@ -32,6 +32,7 @@ from app.domain import topics as topicmod from app.domain.store import DB from app.schemas.entities import EntityList +from app.schemas.notebook import NotePage from app.schemas.search import SearchResults R = store.R @@ -1207,9 +1208,10 @@ def read_note(ctx: Context, note_id: int | None, about: str | None) -> dict[str, kind, _, key = str(about).partition(":") if not key.isdigit(): raise ToolError('about is a thing like "recording:12"') - p = note_routes.page_about(kind, int(key), ctx.user, ctx.acl, ctx.db) - if p.id is None: - return {"page_of": about, "note": None, "title": p.title, "linked_from": [b.title for b in p.backlinks] or None} + page = note_routes.page_about(kind, int(key), ctx.user, ctx.acl, ctx.db) + if not isinstance(page, NotePage): # a draft: nobody has written on it yet + return {"page_of": about, "note": None, "title": page.title, "linked_from": [b.title for b in page.backlinks] or None} + p = page return store.clean( { "note_id": p.id,