Skip to main content
Glama
wei
by wei

Get HackerNews User Info

get-user

Retrieve detailed information about specific HackerNews users including their profile data, karma score, and account activity.

Instructions

Get information about a specific HackerNews user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesThe username to look up

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
aboutNo
karmaYes
usernameYes

Implementation Reference

  • The asynchronous handler function for the 'get-user' tool. It constructs the HN API endpoint for the given username, fetches the user data using the shared fetchHN helper, and returns both a textual JSON representation and the structured data.
    async ({ username }) => {
      const endpoint = `/users/${username}`;
      const result = await fetchHN(endpoint);
      
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
        structuredContent: result
      };
    }
  • The tool configuration including title, description, inputSchema (username: string), and outputSchema (username, about, karma) using Zod validation for the 'get-user' tool.
    {
      title: 'Get HackerNews User Info',
      description: 'Get information about a specific HackerNews user',
      inputSchema: {
        username: z.string().describe('The username to look up')
      },
      outputSchema: {
        username: z.string(),
        about: z.string().optional(),
        karma: z.number()
      }
    },
  • src/index.ts:306-329 (registration)
    The complete registration of the 'get-user' tool via server.registerTool, specifying the tool name, schema/configuration, and handler function.
    server.registerTool(
      'get-user',
      {
        title: 'Get HackerNews User Info',
        description: 'Get information about a specific HackerNews user',
        inputSchema: {
          username: z.string().describe('The username to look up')
        },
        outputSchema: {
          username: z.string(),
          about: z.string().optional(),
          karma: z.number()
        }
      },
      async ({ username }) => {
        const endpoint = `/users/${username}`;
        const result = await fetchHN(endpoint);
        
        return {
          content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          structuredContent: result
        };
      }
    );
  • Shared helper function fetchHN used by all HN API tools, including 'get-user', to perform API requests 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();
    }
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 of behavioral disclosure. It states the tool 'Get information' but doesn't specify what information is returned (e.g., karma, about, submission history), whether it's read-only, or any rate limits or authentication needs. This leaves significant gaps in understanding the tool's behavior.

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 that directly states the tool's purpose without any unnecessary words. It's front-loaded and efficient, making it easy to understand at a glance, which is ideal for 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 the tool's low complexity (one parameter) and the presence of an output schema, the description is minimally adequate. However, with no annotations and incomplete behavioral details, it doesn't fully cover aspects like return values or usage context, leaving room for improvement despite the structured support.

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?

The description adds no parameter semantics beyond what the input schema provides. The schema has 100% coverage with a clear description for the 'username' parameter. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate or add extra meaning.

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 tool's purpose: 'Get information about a specific HackerNews user.' It includes a specific verb ('Get') and resource ('HackerNews user'), making the action and target explicit. However, it doesn't differentiate from sibling tools like 'get-posts-by-author' or 'search-posts,' which might also involve user-related data, so it doesn't reach the highest 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. It doesn't mention scenarios like retrieving user profiles versus posts, or how it differs from siblings such as 'get-posts-by-author' or 'search-posts.' Without such context, users might struggle to choose the correct tool.

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