feat: filter chat conversations by type; add get_weather and get_rss_items LLM tools

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 19:46:08 -04:00
parent ae3dff0952
commit 42b0d8c4ac
3 changed files with 67 additions and 4 deletions
+59
View File
@@ -478,6 +478,51 @@ _CORE_TOOLS = [
},
},
},
{
"type": "function",
"function": {
"name": "get_weather",
"description": (
"Get the current 7-day weather forecast for the user's configured locations. "
"Returns temperature, precipitation, and conditions for each day. "
"Also reports any changes since the last forecast was fetched."
),
"parameters": {
"type": "object",
"properties": {
"location_key": {
"type": "string",
"description": "Which location to focus on: 'home', 'work', or 'all'. Defaults to 'all'.",
}
},
"required": [],
},
},
},
{
"type": "function",
"function": {
"name": "get_rss_items",
"description": (
"Get recent items from the user's RSS feeds (news, blogs, Reddit, podcasts). "
"Returns titles, URLs, and summaries of recent posts."
),
"parameters": {
"type": "object",
"properties": {
"limit": {
"type": "integer",
"description": "Number of items to return (default 15, max 50)",
},
"category": {
"type": "string",
"description": "Filter by feed category (e.g. 'news', 'tech'). Omit for all.",
},
},
"required": [],
},
},
},
]
# CalDAV tools — only included when user has CalDAV configured
@@ -1568,6 +1613,20 @@ async def execute_tool(user_id: int, tool_name: str, arguments: dict) -> dict:
return {"success": False, "error": str(e)}
return {"success": True, "log": log.to_dict(), "task": note.title}
elif tool_name == "get_weather":
from fabledassistant.services.weather import get_cached_weather
location_key = arguments.get("location_key", "all")
locations = await get_cached_weather(user_id)
if location_key != "all":
locations = [loc for loc in locations if loc["location_key"] == location_key]
return {"data": {"locations": locations}}
elif tool_name == "get_rss_items":
from fabledassistant.services.rss import get_recent_items
limit = min(int(arguments.get("limit", 15)), 50)
items = await get_recent_items(user_id, limit=limit)
return {"data": {"items": items, "count": len(items)}}
else:
return {"success": False, "error": f"Unknown tool: {tool_name}"}