Skip to main content
Glama
jaipandya

product-hunt-mcp

by jaipandya

get_viewer

Retrieve information about the currently authenticated user, including user details and authentication status.

Instructions

    Retrieve information about the currently authenticated user.

    Parameters:
    - None

    Returns:
    - success (bool)
    - data (dict): If successful, contains user details.
    - error (dict, optional)
    - rate_limits (dict)

    Notes:
    - Returns an error if the token is invalid or expired.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_viewer' tool. It is decorated with @mcp.tool() for registration, requires a token, handles errors, executes a GraphQL query to fetch viewer data, and formats the response.
    @require_token
    @handle_errors
    def get_viewer() -> Dict[str, Any]:
        """
        Retrieve information about the currently authenticated user.
    
        Parameters:
        - None
    
        Returns:
        - success (bool)
        - data (dict): If successful, contains user details.
        - error (dict, optional)
        - rate_limits (dict)
    
        Notes:
        - Returns an error if the token is invalid or expired.
        """
        logger.info("users.get_viewer called")
    
        result, rate_limits, error = execute_graphql_query(VIEWER_QUERY)
    
        if error:
            return format_response(False, error=error, rate_limits=rate_limits)
    
        # Check if viewer info exists
        viewer_exists = check_data_exists(result["data"], "viewer")
    
        if not viewer_exists:
            return format_response(
                False,
                error={
                    "code": "AUTHENTICATION_ERROR",
                    "message": "Unable to get viewer information. Token may be invalid or expired.",
                },
                rate_limits=rate_limits,
            )
    
        # Extract viewer data
        viewer_data = result["data"]["viewer"]
    
        # Check if the user field exists for nested viewer structure
        if "user" in viewer_data and viewer_data["user"] is not None:
            viewer_data = viewer_data["user"]
    
        return format_response(True, data=viewer_data, rate_limits=rate_limits)
  • The call to register_user_tools(mcp) in the main CLI entry point, which defines and registers the get_viewer tool among other user tools.
    register_user_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 of behavioral disclosure. It successfully describes authentication requirements ('currently authenticated user', 'token is invalid or expired'), error conditions, and return structure including rate limits. However, it doesn't specify whether this is a read-only operation (though implied by 'Retrieve') or any performance characteristics beyond rate limits.

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 perfectly structured with clear sections (purpose, parameters, returns, notes), uses bullet points for readability, and contains zero wasted words. Every sentence adds essential information, and the information is front-loaded with the core purpose stated first.

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?

For a 0-parameter tool with no output schema, the description provides excellent coverage: purpose, authentication context, return structure, and error conditions. The only minor gap is lack of explicit mention about whether this is a read-only operation (though strongly implied), and no details about what specific user details are included in the data dict.

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

Parameters4/5

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

The schema has 0 parameters with 100% coverage, so the baseline would be 3. However, the description explicitly states 'Parameters: - None', which adds value by confirming there are no parameters to consider. This clarity about parameter absence elevates the score above baseline.

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 explicitly states 'Retrieve information about the currently authenticated user' - a specific verb ('Retrieve') and resource ('currently authenticated user') that clearly distinguishes this from sibling tools like 'get_user' (which likely retrieves information about other users). The purpose is 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 guidance: 'Returns an error if the token is invalid or expired' indicates this tool should only be used when the user has a valid authentication token. It also implicitly distinguishes from 'get_user' by specifying it retrieves information about 'the currently authenticated user' rather than any user.

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