Skip to main content
Glama
paabloLC

MCP Hacker News

by paabloLC

getUpdates

Retrieve recently updated Hacker News items and profiles to monitor new activity and changes in real-time.

Instructions

Get recently updated items and profiles

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler function for the 'getUpdates' MCP tool. It fetches recent updates from the Hacker News '/updates' endpoint, handles errors, limits results to top 10 items and profiles, and returns a standardized MCP content response with JSON text.
    execute: async (args: any) => {
      const updates = await fetchFromAPI<HackerNewsUpdates>("/updates");
    
      if (!updates) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({ error: "Failed to fetch updates" }),
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                message: "Recent updates",
                recentlyUpdatedItems: updates.items.slice(0, 10),
                recentlyUpdatedProfiles: updates.profiles.slice(0, 10),
              },
              null,
              2
            ),
          },
        ],
      };
    },
  • Input schema definition for the 'getUpdates' tool, specifying no required parameters.
    inputSchema: { type: "object", properties: {} },
  • src/index.ts:52-65 (registration)
    MCP 'tools/call' request handler in the main server that locates the 'getUpdates' tool by name from the tools array and invokes its execute method with arguments.
    if (json.method === "tools/call") {
      const tool = tools.find((tool) => tool.name === json.params.name);
      if (tool) {
        const toolResponse = await tool.execute(json.params.arguments);
        sendResponse(json.id, toolResponse);
      } else {
        sendResponse(json.id, {
          error: {
            code: -32602,
            message: `MCP error -32602: Tool ${json.params.name} not found`,
          },
        });
      }
    }
  • fetchFromAPI utility function called by the getUpdates handler to retrieve data from the Hacker News API (used with endpoint '/updates'), including caching via helpers.
    export async function fetchFromAPI<T>(endpoint: string): Promise<T | null> {
      const cacheKey = endpoint;
      const cached = getCached<T>(cacheKey);
      if (cached) return cached;
    
      try {
        const response = await fetch(
          `https://hacker-news.firebaseio.com/v0${endpoint}.json`
        );
        if (!response.ok) throw new Error(`HTTP ${response.status}`);
    
        const data = await response.json();
        setCache(cacheKey, data);
        return data;
      } catch (error) {
        console.error(`Error fetching ${endpoint}:`, error);
        return null;
      }
  • TypeScript interface defining the structure of updates data returned by the Hacker News '/updates' endpoint, used in the handler's type annotation.
    export interface HackerNewsUpdates {
      items: number[];
      profiles: string[];
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'recently updated' which implies time-based behavior, but doesn't disclose what 'recently' means (e.g., time window, pagination), whether it's read-only or has side effects, or how results are formatted. This leaves significant behavioral gaps.

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 with no wasted words. It's front-loaded with the core action and resources, making it easy to parse. Every word contributes meaning, achieving ideal conciseness.

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

Completeness3/5

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

Given 0 parameters and no output schema, the description is minimally complete for a simple retrieval tool. However, with no annotations and siblings that suggest complex content types (e.g., stories, comments, users), it should clarify what 'items and profiles' includes or how it differs from other getters, leaving room for improvement.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a high baseline score. It could be a 5 if it explicitly noted the lack of parameters, but it's still very effective.

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 'Get recently updated items and profiles' clearly states the verb ('Get') and resources ('recently updated items and profiles'), making the purpose understandable. However, it doesn't specifically differentiate this tool from its siblings like 'getNewStories' or 'getTopStories' that also retrieve content, which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'getNewStories' and 'getTopStories' that retrieve specific story types, there's no indication whether this tool is for general updates, time-based filtering, or different content categories, leaving usage unclear.

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/paabloLC/mcp-hacker-news'

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