Skip to main content
Glama
brianellin

Bluesky MCP Server

by brianellin

get-trends

Discover current trending topics on Bluesky by fetching a customizable number of results, optionally including suggested topics for comprehensive insights.

Instructions

Get current trending topics on Bluesky

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeSuggestedNoWhether to include suggested topics in addition to trending topics
limitNoNumber of trending topics to fetch (1-50)

Implementation Reference

  • The handler function for the 'get-trends' tool. It fetches current trending topics from Bluesky using the unspecced API endpoint, formats them with post counts, start times, and feed links. Optionally includes suggested topics. Handles errors and returns formatted MCP response.
    if (!agent) { return mcpErrorResponse("Not connected to Bluesky. Check your environment variables."); } const currentAgent = agent; // Assign to non-null variable to satisfy TypeScript try { // Call the unspecced API endpoint for trending topics const response = await currentAgent.api.app.bsky.unspecced.getTrendingTopics({ limit: Math.min(50, limit) // API accepts up to 50 per call }); if (!response.success) { return mcpErrorResponse("Failed to fetch trending topics."); } const { topics, suggested } = response.data; if (!topics || topics.length === 0) { return mcpSuccessResponse("No trending topics found at this time."); } // Format trending topics const formattedTopics = topics.map((topic: any, index: number) => { const startTime = new Date(topic.startTime).toLocaleString(); return `#${index + 1}: ${topic.topic} Post Count: ${topic.postCount} posts Started Trending: ${startTime} Feed Link: https://bsky.app${topic.link} ---`; }).join("\n\n"); // Format suggested topics if requested let suggestedContent = ""; if (includeSuggested && suggested && suggested.length > 0) { const formattedSuggested = suggested.map((topic: any, index: number) => { return `#${index + 1}: ${topic.topic} Feed Link: https://bsky.app${topic.link} ---`; }).join("\n\n"); suggestedContent = `\n\n## Suggested Topics for Exploration\n\n${formattedSuggested}`; } return mcpSuccessResponse(`## Current Trending Topics on Bluesky\n\n${formattedTopics}${suggestedContent}`); } catch (error) { return mcpErrorResponse(`Error fetching trending topics: ${error instanceof Error ? error.message : String(error)}`); } } );
  • The input schema for the 'get-trends' tool using Zod validation. Parameters: limit (number, 1-50, default 10) for number of topics, includeSuggested (boolean, default false).
    limit: z.number().min(1).max(50).default(10).describe("Number of trending topics to fetch (1-50)"), includeSuggested: z.boolean().default(false).describe("Whether to include suggested topics in addition to trending topics"), }, async ({ limit, includeSuggested }) => {
  • src/index.ts:584-641 (registration)
    The registration of the 'get-trends' tool on the MCP server, including name, description, input schema, and handler reference.
    "get-trends", "Get current trending topics on Bluesky", { limit: z.number().min(1).max(50).default(10).describe("Number of trending topics to fetch (1-50)"), includeSuggested: z.boolean().default(false).describe("Whether to include suggested topics in addition to trending topics"), }, async ({ limit, includeSuggested }) => { if (!agent) { return mcpErrorResponse("Not connected to Bluesky. Check your environment variables."); } const currentAgent = agent; // Assign to non-null variable to satisfy TypeScript try { // Call the unspecced API endpoint for trending topics const response = await currentAgent.api.app.bsky.unspecced.getTrendingTopics({ limit: Math.min(50, limit) // API accepts up to 50 per call }); if (!response.success) { return mcpErrorResponse("Failed to fetch trending topics."); } const { topics, suggested } = response.data; if (!topics || topics.length === 0) { return mcpSuccessResponse("No trending topics found at this time."); } // Format trending topics const formattedTopics = topics.map((topic: any, index: number) => { const startTime = new Date(topic.startTime).toLocaleString(); return `#${index + 1}: ${topic.topic} Post Count: ${topic.postCount} posts Started Trending: ${startTime} Feed Link: https://bsky.app${topic.link} ---`; }).join("\n\n"); // Format suggested topics if requested let suggestedContent = ""; if (includeSuggested && suggested && suggested.length > 0) { const formattedSuggested = suggested.map((topic: any, index: number) => { return `#${index + 1}: ${topic.topic} Feed Link: https://bsky.app${topic.link} ---`; }).join("\n\n"); suggestedContent = `\n\n## Suggested Topics for Exploration\n\n${formattedSuggested}`; } return mcpSuccessResponse(`## Current Trending Topics on Bluesky\n\n${formattedTopics}${suggestedContent}`); } catch (error) { return mcpErrorResponse(`Error fetching trending topics: ${error instanceof Error ? error.message : String(error)}`); } } );

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