Skip to main content
Glama

Reddit MCP Server

by ozipi
get-channel.ts1.08 kB
import { getChannelSuccessMessage } from '../../constants/tool/get-channel.js'; import { RedditError } from '../../types/reddit.js'; import { formatToolResponse } from './types.js'; import type { ToolHandler, GetChannelArgs} from './types.js'; export const handleGetChannel: ToolHandler<GetChannelArgs> = async (args, { redditService }) => { try { const { sort = "hot", subreddit } = args; if (!subreddit) { throw new RedditError("Subreddit is required", "VALIDATION_ERROR"); } const posts = await redditService.fetchPosts({ sort, subreddit, limit: 25 }); return formatToolResponse({ message: getChannelSuccessMessage, result: { posts, subreddit, sort, }, }); } catch (error) { return formatToolResponse({ status: "error", message: `Failed to fetch channel posts: ${error instanceof Error ? error.message : "Unknown error"}`, error: { type: error instanceof RedditError ? error.type : "API_ERROR", details: error, }, }); } };

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/ozipi/brainloop-mcp-server-v2'

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