Skip to main content
Glama
wei
by wei

Get Show HN Posts

get-show-hn

Retrieve user-submitted project showcases from HackerNews to discover new tools, applications, and innovations shared by the developer community.

Instructions

Get latest "Show HN" posts where users showcase their projects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hitsPerPageNoNumber of results per page (default: 20)
pageNoPage number for pagination (default: 0)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hitsYes
pageYes
nbHitsYes
nbPagesYes
hitsPerPageYes

Implementation Reference

  • The handler function for the 'get-show-hn' tool. It constructs a search query for 'show_hn' tagged posts using the HackerNews Algolia API's /search_by_date endpoint, applies optional pagination, fetches the results using the shared fetchHN helper, and returns both text and structured content.
    async ({ page, hitsPerPage }) => {
      const params = new URLSearchParams();
      params.append('tags', 'show_hn');
      if (page !== undefined) params.append('page', page.toString());
      if (hitsPerPage !== undefined) params.append('hitsPerPage', hitsPerPage.toString());
      
      const endpoint = `/search_by_date?${params.toString()}`;
      const result = await fetchHN(endpoint);
      
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
        structuredContent: result
      };
    }
  • The schema definition for the 'get-show-hn' tool, including title, description, input schema (optional pagination params), and output schema matching the HN API search response structure.
    {
      title: 'Get Show HN Posts',
      description: 'Get latest "Show HN" posts where users showcase their projects',
      inputSchema: {
        page: z.number().optional().describe('Page number for pagination (default: 0)'),
        hitsPerPage: z.number().optional().describe('Number of results per page (default: 20)')
      },
      outputSchema: {
        hits: z.array(z.any()),
        nbHits: z.number(),
        nbPages: z.number(),
        page: z.number(),
        hitsPerPage: z.number()
      }
    },
  • src/index.ts:207-237 (registration)
    The registration of the 'get-show-hn' tool using server.registerTool, which includes the tool name, schema, and inline handler function.
      'get-show-hn',
      {
        title: 'Get Show HN Posts',
        description: 'Get latest "Show HN" posts where users showcase their projects',
        inputSchema: {
          page: z.number().optional().describe('Page number for pagination (default: 0)'),
          hitsPerPage: z.number().optional().describe('Number of results per page (default: 20)')
        },
        outputSchema: {
          hits: z.array(z.any()),
          nbHits: z.number(),
          nbPages: z.number(),
          page: z.number(),
          hitsPerPage: z.number()
        }
      },
      async ({ page, hitsPerPage }) => {
        const params = new URLSearchParams();
        params.append('tags', 'show_hn');
        if (page !== undefined) params.append('page', page.toString());
        if (hitsPerPage !== undefined) params.append('hitsPerPage', hitsPerPage.toString());
        
        const endpoint = `/search_by_date?${params.toString()}`;
        const result = await fetchHN(endpoint);
        
        return {
          content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          structuredContent: result
        };
      }
    );
  • Shared helper function fetchHN used by the 'get-show-hn' handler (and all other tools) to make API calls to the HackerNews Algolia API and handle errors.
    async function fetchHN(endpoint: string): Promise<any> {
      const response = await fetch(`${HN_API_BASE}${endpoint}`);
      if (!response.ok) {
        throw new Error(`HN API error: ${response.status} ${response.statusText}`);
      }
      return await response.json();
    }
  • Base URL constant for the HackerNews Algolia API, used by fetchHN helper.
    const HN_API_BASE = 'https://hn.algolia.com/api/v1';
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It mentions 'latest' posts but doesn't specify recency criteria, sorting order, or data freshness. No information about rate limits, authentication needs, or error handling is included.

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?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded with the core functionality.

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?

Given the tool's moderate complexity (list retrieval with pagination), 100% schema coverage, and presence of an output schema, the description is reasonably complete. However, it lacks behavioral details that would be helpful for an agent, such as sorting behavior or data source characteristics.

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 coverage is 100%, so the schema fully documents both parameters. The description adds no parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 for adequate but not enhanced parameter semantics.

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 clearly states the specific action ('Get') and resource ('latest "Show HN" posts'), with explicit mention of the content type ('where users showcase their projects'). It distinguishes this tool from siblings like 'get-ask-hn' or 'get-top-stories' by specifying the Show HN category.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving Show HN posts, but provides no explicit guidance on when to use this versus alternatives like 'get-latest-stories' or 'search-posts'. There's no mention of prerequisites, exclusions, or comparative scenarios with sibling tools.

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/wei/hn-mcp-server-vibe'

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