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)

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