Skip to main content
Glama

Search stories

search_stories

Search Hacker News stories by keyword to find relevant technology discussions and news articles.

Instructions

Search Hacker News stories by keyword.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
storiesYes
returnedYes

Implementation Reference

  • The handler implementation for the `search_stories` tool in the Hacker News MCP server. It calls the `client.searchStories` method and returns the formatted stories and the count.
    handler: async ({ query, limit }, context) => {
      await context.log("info", `Searching Hacker News for ${query}`);
      const stories = await this.client.searchStories({ query, limit });
      return {
        stories: [...stories],
        returned: stories.length,
      };
    },
  • Tool registration for `search_stories` within the Hacker News Server constructor.
    this.registerTool(
      defineTool({
        name: "search_stories",
        title: "Search stories",
        description: "Search Hacker News stories by keyword.",
        inputSchema: {
          query: z.string().trim().min(1),
          limit: z.number().int().min(1).max(30).default(10),
        },
        outputSchema: {
          stories: z.array(storySummarySchema),
          returned: z.number().int(),
        },
        handler: async ({ query, limit }, context) => {
          await context.log("info", `Searching Hacker News for ${query}`);
          const stories = await this.client.searchStories({ query, limit });
          return {
            stories: [...stories],
            returned: stories.length,
          };
        },
        renderText: ({ stories, returned }) => {
          if (returned === 0) {
            return "No matching Hacker News stories found.";
          }
          return stories.map((story) => `${story.title} by ${story.author ?? "unknown"}`).join("\n");
        },
      }),
    );
Behavior2/5

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

No annotations are provided, so the description carries full disclosure burden. It fails to explain search behavior (fuzzy vs. exact matching, case sensitivity), result ranking, or what happens when no matches are found. The phrase 'by keyword' hints at the search mechanism but provides no syntax rules or scope limitations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single sentence contains no redundant words or fluff, earning marks for efficiency. However, given the complete lack of annotations and schema descriptions, this extreme brevity results in under-specification rather than appropriate conciseness.

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

Completeness2/5

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

While an output schema exists (excusing the description from detailing return values), the tool remains under-documented due to zero schema parameter coverage and the description's failure to explain parameter semantics, constraints, or behavioral edge cases necessary for confident invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description must compensate for both parameters. It only partially covers the query parameter via the implied 'keyword' reference, while completely omitting the limit parameter and its constraints (default 10, maximum 30, minimum 1).

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

Purpose4/5

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

The description provides a specific verb ('Search'), resource ('Hacker News stories'), and mechanism ('by keyword'). It implicitly distinguishes from sibling get_top_stories (browsing vs. searching) and get_item_thread (retrieval by ID vs. keyword), though it does not explicitly name these alternatives.

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 guidance is provided on when to use this tool versus get_top_stories (for trending content without specific keywords) or get_item_thread (when a specific item ID is known). There are no stated prerequisites, filters, or conditions for use.

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/Markgatcha/universal-mcp-toolkit'

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