Skip to main content
Glama

getUserSubmissions

Retrieve a Hacker News user's submitted stories and comments to analyze their contributions and activity history on the platform.

Instructions

Get a user's submissions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the user

Implementation Reference

  • The core handler logic for the 'getUserSubmissions' tool. Validates the input user ID using UserRequestSchema, queries Algolia API for user's submissions using author tag, formats the hit 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() }], }; }
  • src/index.ts:161-171 (registration)
    Tool registration entry in the ListTools handler, defining the tool name, description, and input schema (object with required 'id' string).
    { name: "getUserSubmissions", description: "Get a user's submissions", inputSchema: { type: "object", properties: { id: { type: "string", description: "The ID of the user" }, }, required: ["id"], }, },
  • Zod schema (UserRequestSchema) used for input validation in the getUserSubmissions handler, requiring a string 'id' for the user.
    export const UserRequestSchema = z.object({ id: z.string(), });

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