From 096dab95457ca6c84af7ff867d913f23ef9441e0 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Sun, 29 Jun 2025 22:08:55 -0700 Subject: [PATCH] Fix feed tool to handle Letta's Literal type conversion issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove Literal type that gets converted to FeedName.value in sandbox - Keep workaround to strip 'FeedName.' prefix if present - Use plain string type with validation in function body 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tools/feed.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/feed.py b/tools/feed.py index 9ffded1..6ff799c 100644 --- a/tools/feed.py +++ b/tools/feed.py @@ -1,10 +1,10 @@ """Feed tool for retrieving Bluesky feeds.""" from pydantic import BaseModel, Field -from typing import Optional, Literal +from typing import Optional class FeedArgs(BaseModel): - feed_name: Optional[Literal["home", "discover", "ai-for-grownups", "atmosphere"]] = Field(None, description="Named feed preset. Available feeds: 'home' (timeline), 'discover' (what's hot), 'ai-for-grownups', 'atmosphere'. If not provided, returns home timeline") + feed_name: Optional[str] = Field(None, description="Named feed preset. Available feeds: 'home' (timeline), 'discover' (what's hot), 'ai-for-grownups', 'atmosphere'. If not provided, returns home timeline") max_posts: int = Field(default=25, description="Maximum number of posts to retrieve (max 100)") @@ -37,6 +37,10 @@ def get_bluesky_feed(feed_name: str = None, max_posts: int = 25) -> str: # Resolve feed URI from name if feed_name: + # Handle case where agent passes 'FeedName.discover' instead of 'discover' + if '.' in feed_name and feed_name.startswith('FeedName.'): + feed_name = feed_name.split('.', 1)[1] + # Look up named preset if feed_name not in feed_presets: available_feeds = list(feed_presets.keys()) -- 2.51.2