Skip to main content
Glama
jaipandya

product-hunt-mcp

by jaipandya

get_post_details

Retrieve detailed Product Hunt post information including votes, makers, topics, media, and paginated comments by providing a post ID or slug.

Instructions

    Retrieve detailed information about a specific Product Hunt post by ID or slug.

    Parameters:
    - id (str, optional): The post's unique ID.
    - slug (str, optional): The post's slug (e.g., "product-hunt-api").
    - comments_count (int, optional): Number of comments to return (default: 10, max: 20).
    - comments_after (str, optional): Pagination cursor for fetching the next page of comments.

    At least one of `id` or `slug` must be provided.

    Returns:
    - success (bool): Whether the request was successful.
    - data (dict): If successful, contains:
        - id, name, description, tagline, votes, makers, topics, media, and
        - comments (paginated): { edges: [...], pageInfo: { endCursor, hasNextPage } }
    - error (dict, optional): If unsuccessful, contains error code and message.
    - rate_limits (dict): API rate limit information.

    Notes:
    - If neither `id` nor `slug` is provided, an error is returned.
    - If the post is not found, an error is returned.
    - The dedicated `get_post_comments` tool is deprecated; use this tool for paginated comments.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
slugNo
comments_countNo
comments_afterNo

Implementation Reference

  • The main handler function for the 'get_post_details' tool. It fetches detailed post information using a GraphQL query (POST_QUERY), handles pagination for comments, and formats the response.
    def get_post_details(
        id: str = None, slug: str = None, comments_count: int = 10, comments_after: str = None
    ) -> Dict[str, Any]:
        """
        Retrieve detailed information about a specific Product Hunt post by ID or slug.
    
        Parameters:
        - id (str, optional): The post's unique ID.
        - slug (str, optional): The post's slug (e.g., "product-hunt-api").
        - comments_count (int, optional): Number of comments to return (default: 10, max: 20).
        - comments_after (str, optional): Pagination cursor for fetching the next page of comments.
    
        At least one of `id` or `slug` must be provided.
    
        Returns:
        - success (bool): Whether the request was successful.
        - data (dict): If successful, contains:
            - id, name, description, tagline, votes, makers, topics, media, and
            - comments (paginated): { edges: [...], pageInfo: { endCursor, hasNextPage } }
        - error (dict, optional): If unsuccessful, contains error code and message.
        - rate_limits (dict): API rate limit information.
    
        Notes:
        - If neither `id` nor `slug` is provided, an error is returned.
        - If the post is not found, an error is returned.
        - The dedicated `get_post_comments` tool is deprecated; use this tool for paginated comments.
        """
        params = {
            k: v
            for k, v in {
                "id": id,
                "slug": slug,
                "comments_count": comments_count,
                "comments_after": comments_after,
            }.items()
            if v is not None
        }
        logger.info("posts.get_post_details called", extra=params)
    
        variables = {}
        add_id_or_slug(variables, id, slug)
        # Add pagination for comments if requested
        if comments_count is not None:
            variables["commentsCount"] = min(comments_count, 20)
        if comments_after:
            variables["commentsAfter"] = comments_after
    
        # Use the utility function to execute the query and check if post exists
        id_or_slug = id or slug
        post_data, rate_limits, error = execute_and_check_query(
            POST_QUERY, variables, "post", id_or_slug
        )
    
        if error:
            return format_response(False, error=error, rate_limits=rate_limits)
    
        return format_response(True, data=post_data, rate_limits=rate_limits)
  • POST_SCHEMA validation dictionary used by the tool. Requires either 'id' or 'slug' (strings), with other parameters implicitly optional.
    POST_SCHEMA = {"requires_one_of": [["id", "slug"]], "id": {"type": str}, "slug": {"type": str}}
  • Invocation of register_post_tools(mcp) in the main CLI entrypoint, which defines and registers the get_post_details tool.
    register_post_tools(mcp)
  • @mcp.tool() decorator immediately above the handler, which registers the function as an MCP tool during register_post_tools execution.
    @mcp.tool()
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: the tool retrieves data (implied read-only), includes rate limit information in returns, handles errors for missing inputs or posts, supports pagination for comments, and mentions a deprecated sibling tool. However, it doesn't explicitly state permission requirements or whether it's idempotent, leaving minor gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Parameters, Returns, Notes) and front-loaded purpose. Most sentences earn their place by adding value, such as parameter details and usage notes. However, the Returns section is somewhat verbose in listing data fields, which could be slightly condensed without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, no annotations, no output schema), the description is highly complete. It covers purpose, parameters with semantics, return structure including success/error/rate limits, usage rules, error conditions, and sibling tool relationships. This provides all necessary context for an agent to invoke the tool correctly without relying on external documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must fully compensate. It adds substantial meaning beyond the basic schema: explains that id and slug are alternative identifiers (with slug examples), specifies comments_count default and max values, describes comments_after as a pagination cursor, and clarifies that at least one of id or slug is required. This provides complete parameter context missing from the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Retrieve detailed information') and resource ('about a specific Product Hunt post'), distinguishing it from siblings like get_posts (list posts) or get_post_comments (deprecated for comments only). It specifies retrieval by ID or slug, making the purpose unambiguous and differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: it states when to use this tool (for detailed post info with optional comments) and when not to use alternatives (notes that get_post_comments is deprecated for paginated comments). It also specifies prerequisites (at least id or slug required) and error conditions (if neither provided or post not found), offering comprehensive context for selection.

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/jaipandya/producthunt-mcp-server'

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