Skip to main content
Glama
jaipandya

product-hunt-mcp

by jaipandya

get_collection

Retrieve detailed information about a specific Product Hunt collection using its ID or slug, including name, description, follower count, and posts.

Instructions

    Retrieve detailed information about a specific collection by ID or slug.

    Parameters:
    - id (str, optional): The collection's unique ID.
    - slug (str, optional): The collection's slug (e.g., "best-productivity-apps").

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

    Returns:
    - success (bool)
    - data (dict): If successful, contains collection details:
        - id, name, description, follower_count, posts, etc.
    - error (dict, optional)
    - rate_limits (dict)

    Notes:
    - Returns an error if neither `id` nor `slug` is provided, or if the collection is not found.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
slugNo

Implementation Reference

  • Main handler function for the 'get_collection' tool, decorated with @mcp.tool(), handles retrieval of collection data via GraphQL query.
    def get_collection(id: str = None, slug: str = None) -> Dict[str, Any]:
        """
        Retrieve detailed information about a specific collection by ID or slug.
    
        Parameters:
        - id (str, optional): The collection's unique ID.
        - slug (str, optional): The collection's slug (e.g., "best-productivity-apps").
    
        At least one of `id` or `slug` must be provided.
    
        Returns:
        - success (bool)
        - data (dict): If successful, contains collection details:
            - id, name, description, follower_count, posts, etc.
        - error (dict, optional)
        - rate_limits (dict)
    
        Notes:
        - Returns an error if neither `id` nor `slug` is provided, or if the collection is not found.
        """
        params = {k: v for k, v in {"id": id, "slug": slug}.items() if v is not None}
        logger.info("collections.get_collection called", extra=params)
    
        variables = {}
        add_id_or_slug(variables, id, slug)
    
        # Execute the query and check if collection exists
        id_or_slug = id or slug
        collection_data, rate_limits, error = execute_and_check_query(
            COLLECTION_QUERY, variables, "collection", id_or_slug
        )
    
        if error:
            return format_response(False, error=error, rate_limits=rate_limits)
    
        return format_response(True, data=collection_data, rate_limits=rate_limits)
  • Input validation schema used for the get_collection tool.
    COLLECTION_SCHEMA = {
        "requires_one_of": [["id", "slug"]],
        "id": {"type": str},
        "slug": {"type": str},
    }
  • Registration of the get_collection tool using @mcp.tool() decorator within register_collection_tools function.
    @mcp.tool()
    @require_token
    @handle_errors
    @validate_with_schema(COLLECTION_SCHEMA)
  • Invocation of register_collection_tools(mcp) to register the collections tools including get_collection.
    register_collection_tools(mcp)
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 and does well by disclosing key behaviors: it returns detailed collection data, includes error handling for missing parameters or not-found collections, and mentions rate limits in the return structure. It doesn't cover authentication needs or pagination, but covers essential operational aspects.

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

Conciseness5/5

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

The description is well-structured with clear sections (purpose, parameters, returns, notes), uses bullet points for readability, and every sentence adds value without redundancy. It's appropriately sized for the tool's complexity.

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

Completeness4/5

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

Given no annotations and no output schema, the description provides a complete picture for a read operation: purpose, parameters with semantics, return structure, and error cases. It could briefly mention authentication or rate limit specifics, but covers the core context adequately.

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 has 0% description coverage, so the description fully compensates by explaining both parameters ('id' as unique ID, 'slug' with an example), their optional nature, and the constraint that at least one must be provided. This adds crucial meaning beyond the bare 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 verb 'retrieve' and resource 'detailed information about a specific collection', specifying it works by 'ID or slug'. It distinguishes from sibling tools like 'get_collections' (plural) by focusing on a single collection.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('by ID or slug') and notes that at least one parameter must be provided. However, it doesn't explicitly mention when to choose this over alternatives like 'get_collections' or 'search_topics', though the specificity implies it's for known collections.

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