Skip to main content
Glama
brianellin

Bluesky MCP Server

by brianellin

get-list-posts

Retrieve posts from a user list on Bluesky by specifying list URI, count, and time frame. Enables focused content curation and analysis.

Instructions

Fetch posts from users in a specified list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYesNumber of posts to fetch or hours to look back
listYesThe URI of the list (e.g., at://did:plc:abcdef/app.bsky.graph.list/listname)
typeYesWhether count represents number of posts or hours to look back

Implementation Reference

  • Complete registration and implementation of the 'get-list-posts' tool. This includes the tool name, description, Zod input schema for list URI, count, and type parameters, and the full async handler function that validates the list URI, fetches posts via Bluesky's getListFeed API with pagination support, applies optional time-based filtering, limits results, preprocesses the posts using preprocessPosts, formats a summary, and returns a formatted response or error.
    server.tool(
      "get-list-posts",
      "Fetch posts from users in a specified list",
      {
        list: z.string().describe("The URI of the list (e.g., at://did:plc:abcdef/app.bsky.graph.list/listname)"),
        count: z.number().min(1).max(500).describe("Number of posts to fetch or hours to look back"),
        type: z.enum(["posts", "hours"]).describe("Whether count represents number of posts or hours to look back")
      },
      async ({ list, count, type }) => {
        if (!agent) {
          return mcpErrorResponse("Not connected to Bluesky. Check your environment variables.");
        }
    
        const currentAgent = agent; // Assign to non-null variable to satisfy TypeScript
        
        try {
          // Validate the list by getting its info
          const listInfo = await validateUri(currentAgent, list, 'list');
          if (!listInfo) {
            return mcpErrorResponse(`Invalid list URI or list not found: ${list}.`);
          }
    
          const MAX_TOTAL_POSTS = 500; // Safety limit to prevent excessive API calls
          
          let allPosts: any[] = [];
          let nextCursor: string | undefined = undefined;
          let shouldContinueFetching = true;
          
          // Set up time-based or count-based fetching
          const useHoursLimit = type === "hours";
          const targetHours = count;
          const targetDate = new Date(Date.now() - targetHours * 60 * 60 * 1000);
          
          while (shouldContinueFetching && allPosts.length < MAX_TOTAL_POSTS) {
            // Calculate how many posts to fetch in this batch
            const batchLimit = 100;
            
            const response = await currentAgent.app.bsky.feed.getListFeed({ 
              list,
              limit: batchLimit,
              cursor: nextCursor
            });
            
            if (!response.success) {
              break;
            }
            
            const { feed, cursor } = response.data;
            
            // Filter posts based on time window if using hours limit
            let filteredFeed = feed;
            if (useHoursLimit) {
              filteredFeed = feed.filter(post => {
                const createdAt = post?.post?.record?.createdAt;
                if (!createdAt || typeof createdAt !== 'string') return false;
                const postDate = new Date(createdAt);
                return postDate >= targetDate;
              });
            }
            
            // Add the filtered posts to our collection
            allPosts = allPosts.concat(filteredFeed);
            
            // Update cursor for the next batch
            nextCursor = cursor;
            
            // Check if we should continue fetching based on the mode
            if (useHoursLimit) {
              // Check if we've reached posts older than our target date
              const oldestPost = feed[feed.length - 1];
              if (oldestPost?.post?.record?.createdAt && typeof oldestPost.post.record.createdAt === 'string') {
                const postDate = new Date(oldestPost.post.record.createdAt);
                if (postDate < targetDate) {
                  shouldContinueFetching = false;
                }
              }
            } else {
              // If we're using count-based fetching, stop when we have enough posts
              shouldContinueFetching = allPosts.length < count;
            }
            
            // Stop if we don't have a cursor for the next page
            if (!cursor) {
              shouldContinueFetching = false;
            }
          }
          
          // If we're using count-based fetching, limit the posts to the requested count
          const finalPosts = !useHoursLimit
            ? allPosts.slice(0, count)
            : allPosts;
    
          // If no posts were found after filtering
          if (finalPosts.length === 0) {
            return mcpSuccessResponse(`No posts found from the list.`);
          }
    
          // Format the posts
          const formattedPosts = preprocessPosts(finalPosts);
    
          // Add summary information
          const summaryText = formatSummaryText(finalPosts.length, "list");
    
          return mcpSuccessResponse(`${summaryText}\n\n${formattedPosts}`);
        } catch (error) {
          return mcpErrorResponse(`Error fetching list posts: ${error instanceof Error ? error.message : String(error)}`);
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool fetches posts but does not describe any behavioral traits such as rate limits, authentication needs, pagination, error handling, or what the output format looks like. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality ('Fetch posts from users in a specified list') with zero waste. It is appropriately sized for the tool's purpose and does not include unnecessary details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of fetching posts (which may involve data retrieval, filtering, and potential side effects), the lack of annotations and output schema means the description is incomplete. It does not address behavioral aspects like output format, error cases, or usage constraints, making it inadequate for an agent to fully understand the tool's operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'a specified list' which aligns with the 'list' parameter, but it does not add meaning beyond what the input schema provides. With 100% schema description coverage, the schema already documents all parameters thoroughly, so the baseline score of 3 is appropriate as the description does not compensate with additional semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Fetch posts') and resource ('from users in a specified list'), which is specific and unambiguous. However, it does not explicitly differentiate from sibling tools like 'get-user-posts' or 'get-timeline-posts', which might also fetch posts but from different sources, leaving some room for confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention any prerequisites, exclusions, or comparisons to sibling tools such as 'get-user-posts' or 'get-timeline-posts', leaving the agent to infer usage context solely from the tool name and parameters.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/brianellin/bsky-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server