Skip to main content
Glama
imprvhub

mcp-claude-hackernews

hn_best

Fetch the best Hacker News stories. Configure the number of stories returned between 1 and 50.

Instructions

Get the best stories from Hacker News

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of stories to fetch (1-50, default: 10)

Implementation Reference

  • index.ts:178-193 (registration)
    Tool registration for 'hn_best' in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema accepting an optional 'limit' parameter (1-50, default 10).
    {
      name: "hn_best",
      description: "Get the best stories from Hacker News",
      inputSchema: {
        type: "object",
        properties: {
          limit: {
            type: "number",
            description: "Number of stories to fetch (1-50, default: 10)",
            minimum: 1,
            maximum: 50,
            default: 10
          }
        }
      }
    },
  • Handler for 'hn_best' tool in CallToolRequestSchema. Calls api.getBestStories() with the limit, formats the results, and returns them as text content.
    if (name === "hn_best") {
      const limit = typeof args?.limit === 'number' ? args.limit : 10;
      const stories = await api.getBestStories(limit);
      const formattedStories = stories.map(story => ({
        id: story.id,
        title: story.title,
        by: story.by,
        time: api.formatTime(story.time),
        url: story.url,
        score: story.score,
        commentsCount: story.kids?.length || 0
      }));
      lastStoriesList = formattedStories;
      return {
        content: [
          {
            type: "text",
            text: formatStoriesAsText(formattedStories)
          }
        ]
      };
  • HackerNewsAPI.getBestStories() helper method. Fetches best story IDs from the Firebase API, retrieves details for each, and filters for valid story type items.
    async getBestStories(limit = 50): Promise<Story[]> {
      try {
        const response = await axios.get(`${baseUrl}/beststories.json`);
        const storyIds = response.data || [];
        const storyPromises = storyIds.slice(0, limit).map((id: number) => this.getItemDetails(id));
        const stories = await Promise.all(storyPromises);
        return stories.filter((story): story is Story => story !== null && story.type === 'story');
      } catch (error) {
        console.error('Error fetching best stories:', error);
        return [];
      }
    }
Behavior2/5

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

No annotations provided. Description only states 'Get' without disclosing read-only nature, side effects, auth, or rate limits. Minimal behavioral context.

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?

Single sentence, no filler, front-loaded. Every word serves purpose.

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

Completeness4/5

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

Simple tool with one parameter and no output schema. Description is adequate for basic list retrieval, though could mention response format.

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?

Schema description covers 100% of parameters (limit). Tool description adds no extra meaning beyond schema. Baseline 3 applies.

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

Purpose5/5

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

The description 'Get the best stories from Hacker News' uses a specific verb and resource, clearly distinguishing it from sibling tools like hn_comments, hn_latest, and hn_top.

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?

No explicit guidance on when to use or avoid this tool versus siblings. Only implied purpose; lacks context like 'use for curated best stories' vs 'hn_latest for most recent.'

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

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/imprvhub/mcp-claude-hackernews'

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