Get item thread
get_item_threadRetrieve Hacker News stories with their comment threads using item IDs, controlling thread depth and comment limits for focused analysis.
Instructions
Fetch a Hacker News story and its comment thread.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes | ||
| depth | No | ||
| maxChildren | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread | Yes |
Implementation Reference
- servers/hackernews/src/index.ts:369-374 (handler)The handler implementation for the 'get_item_thread' tool.
handler: async ({ itemId, depth, maxChildren }, context) => { await context.log("info", `Fetching Hacker News thread ${itemId}`); return { thread: await this.client.getThread({ itemId, depth, maxChildren }), }; }, - servers/hackernews/src/index.ts:356-377 (registration)The tool registration for 'get_item_thread' in the HackerNewsServer class.
this.registerTool( defineTool({ name: "get_item_thread", title: "Get item thread", description: "Fetch a Hacker News story and its comment thread.", inputSchema: { itemId: z.number().int().nonnegative(), depth: z.number().int().min(1).max(6).default(2), maxChildren: z.number().int().min(1).max(50).default(20), }, outputSchema: { thread: threadSchema, }, handler: async ({ itemId, depth, maxChildren }, context) => { await context.log("info", `Fetching Hacker News thread ${itemId}`); return { thread: await this.client.getThread({ itemId, depth, maxChildren }), }; }, renderText: ({ thread }) => `${thread.title} with ${thread.replies.length} top-level replies.`, }), );