Skip to main content
Glama

getUserSubmissions

Retrieve a user's submissions on Hacker News by providing their unique ID. This tool enables access to stories and comments shared by the user, integrating with the Hacker News MCP Server for streamlined data retrieval.

Instructions

Get a user's submissions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the user

Implementation Reference

  • The handler function that executes the getUserSubmissions tool. It validates the input using UserRequestSchema, queries Algolia API for the user's submissions using author tag, formats the results into a numbered list with details, and returns as text content.
    case "getUserSubmissions": { const validatedArgs = validateInput(UserRequestSchema, args); const { id } = validatedArgs; const results = await algoliaApi.search("", { tags: `author_${id}`, hitsPerPage: 50, }); const hits = results.hits || []; const text = `Submissions by ${id}:\n\n` + hits .map( (hit: any, index: number) => `${index + 1}. ${hit.title || hit.comment_text}\n` + ` ID: ${hit.objectID}\n` + ` Points: ${hit.points || 0} | Posted: ${hit.created_at}\n\n` ) .join(""); return { content: [{ type: "text", text: text.trim() }], }; }
  • Zod schema used for input validation of the getUserSubmissions tool, defining the required 'id' as a string.
    export const UserRequestSchema = z.object({ id: z.string(), });
  • src/index.ts:161-171 (registration)
    Tool registration in the ListTools handler, specifying name, description, and input schema matching UserRequestSchema.
    { name: "getUserSubmissions", description: "Get a user's submissions", inputSchema: { type: "object", properties: { id: { type: "string", description: "The ID of the user" }, }, required: ["id"], }, },

Other Tools

Related 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/devabdultech/hn-mcp'

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