reddit_search
Search Reddit posts by keywords to find relevant discussions, with options to filter results by sort order and limit the number of posts returned.
Instructions
Search all of Reddit for posts matching a query.
Args: query: Search keywords (e.g., 'python web scraping', 'machine learning') limit: Maximum number of results to return (default: 25, max: 100) sort: Sort order for results (relevance, hot, top, new, comments)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No | ||
| sort | No |
Implementation Reference
- The reddit_search tool handler implementation, which calls the search service and serializes the result.
async def reddit_search( query: str, ctx: Context, limit: int = 25, sort: str | None = None, ) -> list[dict[str, Any]]: try: results = await service.search(query, limit=limit, sort=sort) return McpSerializer.serialize_list(results) except Exception as e: McpErrorMapper.map(e, "reddit_search") - The registration of the reddit_search tool using FastMCP.
@mcp.tool( name="reddit_search", description=( "Search all of Reddit for posts matching a query.\n\n" "Args:\n" " query: Search keywords " "(e.g., 'python web scraping', 'machine learning')\n" " limit: Maximum number of results to return " "(default: 25, max: 100)\n" " sort: Sort order for results " "(relevance, hot, top, new, comments)" ), )