Skip to main content
Glama
jaipandya

product-hunt-mcp

by jaipandya

get_comment

Retrieve detailed information about a specific Product Hunt comment using its unique ID. Access comment content, user details, timestamps, and related post data.

Instructions

    Retrieve detailed information about a specific comment by ID.

    Parameters:
    - id (str, required): The comment's unique ID.

    Returns:
    - success (bool)
    - data (dict): If successful, contains comment details:
        - id, content, created_at, user, post, etc.
    - error (dict, optional)
    - rate_limits (dict)

    Notes:
    - Returns an error if the comment is not found.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo

Implementation Reference

  • The get_comment tool handler: retrieves a specific comment by ID via GraphQL query, validates input, handles errors, logs the call, and formats the response with rate limits.
    def get_comment(id: str = None) -> Dict[str, Any]:
        """
        Retrieve detailed information about a specific comment by ID.
    
        Parameters:
        - id (str, required): The comment's unique ID.
    
        Returns:
        - success (bool)
        - data (dict): If successful, contains comment details:
            - id, content, created_at, user, post, etc.
        - error (dict, optional)
        - rate_limits (dict)
    
        Notes:
        - Returns an error if the comment is not found.
        """
        params = {k: v for k, v in {"id": id}.items() if v is not None}
        logger.info("comments.get_comment called", extra=params)
    
        comment_data, rate_limits, error = execute_and_check_query(
            COMMENT_QUERY, {"id": id}, "comment", id
        )
    
        if error:
            return format_response(False, error=error, rate_limits=rate_limits)
    
        return format_response(True, data=comment_data, rate_limits=rate_limits)
  • Schema for validating the input parameter 'id' (required string) for the get_comment tool.
    COMMENT_SCHEMA = {"id": {"required": True, "type": str}}
  • Registration of comment tools (including get_comment) by calling register_comment_tools on the MCP server instance in the main CLI entry point.
    register_comment_tools(mcp)
  • Direct registration of the get_comment tool using @mcp.tool() decorator inside the register_comment_tools function.
    @mcp.tool()
    @require_token
    @handle_errors
    @validate_with_schema(COMMENT_SCHEMA)
    def get_comment(id: str = None) -> Dict[str, Any]:
        """
        Retrieve detailed information about a specific comment by ID.
    
        Parameters:
        - id (str, required): The comment's unique ID.
    
        Returns:
        - success (bool)
        - data (dict): If successful, contains comment details:
            - id, content, created_at, user, post, etc.
        - error (dict, optional)
        - rate_limits (dict)
    
        Notes:
        - Returns an error if the comment is not found.
        """
        params = {k: v for k, v in {"id": id}.items() if v is not None}
        logger.info("comments.get_comment called", extra=params)
    
        comment_data, rate_limits, error = execute_and_check_query(
            COMMENT_QUERY, {"id": id}, "comment", id
        )
    
        if error:
            return format_response(False, error=error, rate_limits=rate_limits)
    
        return format_response(True, data=comment_data, rate_limits=rate_limits)

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