Skip to main content
Glama
paabloLC

MCP Hacker News

by paabloLC

getMaxItemId

Retrieve the highest available item ID from Hacker News to determine the most recent content or track updates in the system.

Instructions

Get the current maximum item ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler function for the getMaxItemId tool. It calls fetchFromAPI on the /maxitem endpoint to retrieve the highest item ID from Hacker News and returns a formatted JSON response containing the maxItemId.
    execute: async (args: any) => {
      const maxId = await fetchFromAPI<number>("/maxitem");
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                message: "Current maximum item ID",
                maxItemId: maxId,
              },
              null,
              2
            ),
          },
        ],
      };
    },
  • The input schema for the getMaxItemId tool, defining an empty object as it requires no input parameters.
    inputSchema: { type: "object", properties: {} },
  • src/tools.ts:528-551 (registration)
    The full tool object definition for getMaxItemId, including name, description, schema, and handler, registered in the exported tools array used by the MCP server.
    {
      name: "getMaxItemId",
      description: "Get the current maximum item ID",
      inputSchema: { type: "object", properties: {} },
      execute: async (args: any) => {
        const maxId = await fetchFromAPI<number>("/maxitem");
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  message: "Current maximum item ID",
                  maxItemId: maxId,
                },
                null,
                2
              ),
            },
          ],
        };
      },
    },
  • src/index.ts:52-64 (registration)
    MCP server implementation for handling 'tools/call' requests by finding the tool by name in the tools array and invoking its execute method.
    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`,
          },
        });
      }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool 'gets' something, implying a read-only operation, but doesn't disclose behavioral traits like whether it's cached, real-time, requires authentication, or has rate limits. This is inadequate for a tool with zero annotation coverage.

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, clear sentence with no wasted words. It's front-loaded with the core purpose, making it efficient and easy to parse, which is ideal for such a simple tool.

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?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'maximum item ID' means (e.g., numeric, timestamp-based), the return format, or error handling. For a tool with no structured data support, more context is needed.

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 the schema fully documents the lack of inputs. The description doesn't add parameter details, which isn't needed here, but it could have mentioned implicit dependencies (e.g., context or defaults). Baseline is 4 for zero parameters.

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 clearly states the action ('Get') and the resource ('maximum item ID'), making the purpose understandable. However, it doesn't differentiate from siblings like 'getItem' or 'getUpdates' that might also retrieve ID-related information, preventing 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 'getItem' that might retrieve specific items by ID, there's no indication if this is for metadata, initialization, or other contexts, leaving usage ambiguous.

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