docs(usability): enforce ID→name resolution in all tool docstrings (v1.4.3)
Add explicit guidance to resolve raw API IDs to human-readable names before user display. Affected tools: get_tasks, get_lists, get_activities, get_wall_posts, get_members, get_circles, get_categories, get_meal_plan. Add general usability rule to CLAUDE.md implementation section: never present raw numeric/metaIDs to the user. No breaking changes; docstring improvements only. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -146,7 +146,10 @@ def _extract_tasks(data: dict[str, Any]) -> list[dict[str, Any]]:
|
||||
|
||||
@mcp.tool()
|
||||
def get_circles() -> str:
|
||||
"""Return all Family Wall circles as JSON list of {id, name}."""
|
||||
"""Return all Family Wall circles as JSON list of {id, name}.
|
||||
|
||||
Call this proactively before presenting any data that contains circle IDs to the user.
|
||||
"""
|
||||
try:
|
||||
raw_circles = _famlistfamily()
|
||||
except RuntimeError as exc:
|
||||
@@ -220,6 +223,9 @@ def _famlistfamily() -> list[dict[str, Any]]:
|
||||
def get_members(circle_id: str | None = None) -> str:
|
||||
"""Return Family Wall circle members as JSON, optionally filtered by circle.
|
||||
|
||||
Call this proactively before presenting any data that contains member IDs
|
||||
(assignee_ids, author_id, creator) to the user.
|
||||
|
||||
Args:
|
||||
circle_id: Optional circle ID from get_circles (e.g. ``family/23431854``).
|
||||
When omitted all members across all circles are returned.
|
||||
@@ -311,6 +317,9 @@ def get_lists(scope: str | None = None) -> str:
|
||||
Returns:
|
||||
JSON list of list objects with keys id, name, type, open, total,
|
||||
emoji, color, circle_id.
|
||||
|
||||
IMPORTANT: When presenting lists to the user, always resolve
|
||||
circle_id to the circle name via get_circles. Never show raw IDs.
|
||||
"""
|
||||
try:
|
||||
email, password = get_credentials()
|
||||
@@ -419,6 +428,12 @@ def get_tasks(list_id: str, only_open: bool = True) -> str:
|
||||
JSON array of task objects with keys: id, text, description, completed,
|
||||
category_id, due_date, assignee_ids, recurrency, recurrency_interval,
|
||||
rrule, reminder.
|
||||
|
||||
IMPORTANT: Before presenting results to the user, always resolve:
|
||||
- assignee_ids → member names via get_members
|
||||
- category_id → category name via get_categories
|
||||
- circle context → circle name from get_lists
|
||||
Never show raw IDs to the user.
|
||||
"""
|
||||
# Extract circle number from list_id format: taskList/<circleNum>_<listNum>
|
||||
try:
|
||||
@@ -541,6 +556,9 @@ def get_categories(list_id: str, locale: str = "de") -> str:
|
||||
Use the returned ``id`` values as the ``category_id`` parameter in
|
||||
``create_task`` and ``update_task``.
|
||||
|
||||
Call this proactively before presenting shopping list tasks to the user so
|
||||
category_id values can be shown as readable names.
|
||||
|
||||
Args:
|
||||
list_id: List ID from get_lists (e.g. ``taskList/23431854_29740942``).
|
||||
locale: BCP-47 language code for category names (default ``"de"``).
|
||||
@@ -772,6 +790,9 @@ def get_activities(limit: int = 20) -> str:
|
||||
Returns:
|
||||
JSON list of activity objects sorted by date descending,
|
||||
including wall, task, and taskList activity entries.
|
||||
|
||||
IMPORTANT: Before presenting to the user, resolve author_id to
|
||||
the member name via get_members. Never show raw IDs.
|
||||
"""
|
||||
try:
|
||||
email, password = get_credentials()
|
||||
@@ -2035,6 +2056,9 @@ def get_wall_posts(limit: int = 20) -> str:
|
||||
JSON list of post objects with keys:
|
||||
id, type, text, date, author, author_id,
|
||||
liked_by_me, like_count, comment_count.
|
||||
|
||||
IMPORTANT: Before presenting to the user, resolve author_id to
|
||||
the member name via get_members. Never show raw IDs.
|
||||
"""
|
||||
try:
|
||||
email, password = get_credentials()
|
||||
@@ -2776,6 +2800,9 @@ def get_meal_plan(date_from: str, date_to: str) -> str:
|
||||
- ``can_update`` — whether the entry can be updated
|
||||
- ``can_delete`` — whether the entry can be deleted
|
||||
|
||||
IMPORTANT: When recipe_id is present, use get_recipe to resolve it to the
|
||||
recipe name for display. Never show raw recipe IDs.
|
||||
|
||||
Returns an error message string on failure.
|
||||
"""
|
||||
if date_err := _validate_date(date_from):
|
||||
|
||||
Reference in New Issue
Block a user