Skip to main content
Glama

get_polyhaven_categories

Retrieve available categories for Polyhaven assets like HDRI, textures, or models to organize and filter 3D resources in the Tripo MCP Server.

Instructions

Get a list of categories for a specific asset type on Polyhaven.

Parameters:
- asset_type: The type of asset to get categories for (hdris, textures, models, all)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asset_typeNohdris

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for 'get_polyhaven_categories' tool. It checks if PolyHaven is enabled, sends a command to Blender to retrieve categories for the given asset_type, formats the response by sorting categories by asset count, and returns a formatted string list. The @mcp.tool() decorator handles registration.
    @mcp.tool()
    def get_polyhaven_categories(ctx: Context, asset_type: str = "hdris") -> str:
        """
        Get a list of categories for a specific asset type on Polyhaven.
    
        Parameters:
        - asset_type: The type of asset to get categories for (hdris, textures, models, all)
        """
        try:
            blender = get_blender_connection()
            if not _polyhaven_enabled:
                return "PolyHaven integration is disabled. Select it in the sidebar in BlenderMCP, then run it again."
            result = blender.send_command(
                "get_polyhaven_categories", {"asset_type": asset_type}
            )
    
            if "error" in result:
                return f"Error: {result['error']}"
    
            # Format the categories in a more readable way
            categories = result["categories"]
            formatted_output = f"Categories for {asset_type}:\n\n"
    
            # Sort categories by count (descending)
            sorted_categories = sorted(categories.items(), key=lambda x: x[1], reverse=True)
    
            for category, count in sorted_categories:
                formatted_output += f"- {category}: {count} assets\n"
    
            return formatted_output
        except Exception as e:
            logger.error(f"Error getting Polyhaven categories: {str(e)}")
            return f"Error getting Polyhaven categories: {str(e)}"
  • src/server.py:467-467 (registration)
    The @mcp.tool() decorator registers the get_polyhaven_categories function as an MCP tool.
    @mcp.tool()
  • Input schema defined by function parameters: asset_type (str, default 'hdris'). Output: str (formatted categories list). Documented in docstring.
    def get_polyhaven_categories(ctx: Context, asset_type: str = "hdris") -> str:
        """
        Get a list of categories for a specific asset type on Polyhaven.
    
        Parameters:
        - asset_type: The type of asset to get categories for (hdris, textures, models, all)
  • Helper function used by the tool to get Blender connection and update _polyhaven_enabled status, which is checked in the handler.
    def get_blender_connection():
        """Get or create a persistent Blender connection"""
        global _blender_connection, _polyhaven_enabled, _tripo_apikey  # Add _polyhaven_enabled to globals
    
        # If we have an existing connection, check if it's still valid
        if _blender_connection is not None:
            try:
                # First check if PolyHaven is enabled by sending a ping command
                result = _blender_connection.send_command("get_tripo_apikey")
                _tripo_apikey = result.get("api_key", "")
                result = _blender_connection.send_command("get_polyhaven_status")
                # Store the PolyHaven status globally
                _polyhaven_enabled = result.get("enabled", False)
    
                return _blender_connection
            except Exception as e:
                # Connection is dead, close it and create a new one
                logger.warning(f"Existing connection is no longer valid: {str(e)}")
                try:
                    _blender_connection.disconnect()
                except:
                    pass
                _blender_connection = None
    
        # Create a new connection if needed
        if _blender_connection is None:
            _blender_connection = BlenderConnection(host="localhost", port=9876)
            if not _blender_connection.connect():
                logger.error("Failed to connect to Blender")
                _blender_connection = None
                raise Exception(
                    "Could not connect to Blender. Make sure the Blender addon is running."
                )
            logger.info("Created new persistent connection to Blender")
    
        return _blender_connection
Behavior2/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 states it 'Get a list of categories', implying a read-only operation, but doesn't cover aspects like rate limits, authentication needs, error handling, or what the output looks like. This is a significant gap for a tool with zero annotation coverage.

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 front-loaded with the core purpose, followed by a clear parameter section. Every sentence earns its place by providing essential information without redundancy, making it efficiently structured and appropriately sized.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter) and the presence of an output schema, the description is somewhat complete. It covers the purpose and parameter semantics adequately, but with no annotations and missing behavioral details like error cases or usage context, it has clear gaps that prevent a higher score.

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 description adds meaningful context for the single parameter 'asset_type' by listing allowed values (hdris, textures, models, all), which is not covered in the input schema (0% schema description coverage). This compensates well for the schema gap, though it doesn't explain the semantics of 'all' or default behavior, keeping it from a perfect score.

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

Purpose4/5

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

The description clearly states the verb 'Get' and the resource 'list of categories for a specific asset type on Polyhaven', making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'search_polyhaven_assets' or 'get_polyhaven_status', which might also involve Polyhaven data retrieval, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for selecting asset types, or compare it to sibling tools like 'search_polyhaven_assets', leaving the agent with minimal usage direction.

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/VAST-AI-Research/tripo-mcp'

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