Grafbase

Connect AI Agents to
Grafbase

Automate workflows and connect AI agents to Grafbase. Metorial is built for developers. Handling OAuth, compliance, observability, and more.

Back to Grafbase overview

Querying Specific Items by ID

Understanding Item IDs

Every piece of content on Hacker News—whether it's a story, comment, poll, or job posting—has a unique numeric identifier called an item ID. These IDs are assigned sequentially as content is created, making them a reliable way to reference and retrieve specific items. When you know the exact ID of an item you want to access, you can query it directly rather than browsing through story feeds or user profiles.

Why Query by ID?

Querying specific items by their ID is useful in several scenarios. You might want to revisit a particular discussion you bookmarked, track updates to a specific comment thread over time, or retrieve detailed information about a story that was referenced elsewhere. Item IDs are often visible in Hacker News URLs (for example, news.ycombinator.com/item?id=12345678), making it easy to extract and use them in your queries.

How to Query Items

To retrieve a specific item using the Hacker News MCP Server, simply request it using its ID through your AI assistant. You can phrase your request naturally, such as:

  • "Get Hacker News item 12345678"
  • "Show me details for HN item 34567890"
  • "Retrieve the story with ID 23456789"

The server will fetch the item and return comprehensive information including its type (story, comment, poll, etc.), title, text content, author, timestamp, score, and any associated URLs.

Working with Different Item Types

The server returns different information depending on the item type. Stories include titles, URLs, submission times, and scores. Comments provide the comment text, parent item references, and threading information that shows where they fit in a discussion. Poll items include the poll question and associated poll options. Understanding these distinctions helps you interpret the returned data correctly.

Using IDs for Thread Exploration

When you retrieve a story or comment by ID, the response includes references to related items—particularly child comments. Each story contains an array of comment IDs that represent top-level replies, while comments include IDs of their direct replies. You can follow these ID references to explore entire discussion threads, building a complete picture of conversations happening around a particular topic.

Best Practices

Item IDs remain stable and permanent, so you can safely store them for later reference. This makes them excellent for building bookmarks, tracking specific discussions over time, or creating collections of related content. When working with comment threads, start with the story ID to get the initial comment list, then query individual comment IDs as needed to traverse the conversation tree.

Grafbase on Metorial

The Grafbase integration lets you query and manage your GraphQL API directly from your workspace, enabling you to explore schemas, execute queries and mutations, and configure your API settings without leaving your development environment.

Connect anything. Anywhere.

Ready to build with Metorial?

Connect any AI agent to 600+ apps.

About Metorial

Metorial provides developers with instant access to 600+ MCP servers for building AI agents that can interact with real-world tools and services. Built on MCP, Metorial simplifies agent tool integration by offering pre-configured connections to popular platforms like Google Drive, Slack, GitHub, Notion, and hundreds of other APIs. Our platform supports all major AI agent frameworks—including LangChain, AutoGen, CrewAI, and LangGraph—enabling developers to add tool calling capabilities to their agents in just a few lines of code. By eliminating the need for custom integration code, Metorial helps AI developers move from prototype to production faster while maintaining security and reliability. Whether you're building autonomous research agents, customer service bots, or workflow automation tools, Metorial's MCP server library provides the integrations you need to connect your agents to the real world.

Star us on GitHub