search_hackernews
Search Hacker News stories and comments by query, filter by story type, recency, and sort order to find relevant discussions.
Instructions
Search Hacker News stories and comments via HN's Algolia API.
Use this to find HN discussion on a topic, surface Ask HN / Show HN posts, or
pull the most recent items in a time window. Returns a JSON object with a
hits array.
Parameters:
query (str, required): the search phrase, e.g. "rust async runtime".
tag (str): which item kind to search. One of "story" (default), "comment", "ask_hn", "show_hn", or "all".
time_range (str): restrict by recency. One of "past_24h", "past_week", "past_month", or "all_time" (default).
sort (str): "relevance" (default) ranks by Algolia relevance; "date" returns newest first.
limit (int): number of hits to return, 1-50 (default 10).
Each hit has: id, title, url, points, author, num_comments, created_at (ISO8601), and excerpt (a highlighted snippet when Algolia provides one). For comment hits, title/url/points are usually null and the matched text appears in excerpt. An empty search returns {"hits": []} rather than an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The search phrase. | |
| tag | No | Which item kind to search. | story |
| time_range | No | Restrict results by recency. | all_time |
| sort | No | Ranking: relevance or newest-first. | relevance |
| limit | No | Number of hits to return (1-50). |