"""MCP tools for Fable projects.""" from __future__ import annotations from typing import Any from fable_mcp.client import FableClient async def list_projects(client: FableClient) -> dict[str, Any]: """List all projects for the authenticated user.""" return await client.get("/api/projects") async def get_project(client: FableClient, *, project_id: int) -> dict[str, Any]: """Fetch a project by ID (includes milestone summary).""" return await client.get(f"/api/projects/{project_id}") async def create_project( client: FableClient, *, title: str, description: str = "", goal: str | None = None, status: str = "active", color: str | None = None, ) -> dict[str, Any]: """Create a new project.""" payload: dict[str, Any] = {"title": title, "description": description, "status": status} if goal is not None: payload["goal"] = goal if color is not None: payload["color"] = color return await client.post("/api/projects", json=payload) async def update_project( client: FableClient, *, project_id: int, title: str | None = None, description: str | None = None, goal: str | None = None, status: str | None = None, color: str | None = None, ) -> dict[str, Any]: """Update an existing project.""" payload: dict[str, Any] = {} if title is not None: payload["title"] = title if description is not None: payload["description"] = description if goal is not None: payload["goal"] = goal if status is not None: payload["status"] = status if color is not None: payload["color"] = color return await client.patch(f"/api/projects/{project_id}", json=payload)