show_dashboard
Display saved notes in a card grid for visual review after saving. Refreshes by reading notes.json on each call.
Instructions
Render saved notes as a Prefab card grid.
Call this AFTER saving notes via notes_file to display them visually
to the user. Reads notes.json fresh on each call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:127-162 (handler)The core handler function for the 'show_dashboard' tool. Loads notes from notes.json, builds a PrefabApp UI with a heading, summary text, and a card grid (or empty state). Returns the PrefabApp instance for rendering.
def show_dashboard() -> PrefabApp: """Render saved notes as a Prefab card grid. Call this AFTER saving notes via `notes_file` to display them visually to the user. Reads notes.json fresh on each call. """ notes = _load_notes() items = [{"key": k, "body": v[:400]} for k, v in sorted(notes.items())] if NOTES.exists(): ts = datetime.datetime.fromtimestamp(NOTES.stat().st_mtime) last_updated = ts.strftime("%Y-%m-%d %H:%M") else: last_updated = "never" state = { "notes": items, "count": len(items), "last_updated": last_updated, } with PrefabApp(state=state, css_class="p-6") as app: Heading("My Notes") Text("{{ count }} note(s) - last updated {{ last_updated }}") if items: with Grid(columns={"default": 1, "md": 2}, gap=4): with ForEach("notes"): with Card(): with CardContent(): Heading("{{ key }}") Text("{{ body }}") else: with Card(): with CardContent(): Text("No notes yet - call notes_file('create', ...) first.") return app - server.py:126-127 (registration)Registers 'show_dashboard' as an MCP tool using the @mcp.tool(app=True) decorator, indicating it returns a PrefabApp (not a plain string).
@mcp.tool(app=True) def show_dashboard() -> PrefabApp: - server.py:19-23 (helper)Helper function _load_notes() used by show_dashboard to read notes from the local notes.json file.
def _load_notes() -> dict[str, str]: if not NOTES.exists(): return {} raw = NOTES.read_text().strip() return json.loads(raw) if raw else {} - server.py:127-127 (schema)The tool takes no parameters (empty schema) and returns a PrefabApp. The docstring describes its purpose and when to call it.
def show_dashboard() -> PrefabApp: