download_sketchfab_model
Download and import a Sketchfab model into Blender using its unique UID. Ensure the model is downloadable and you have proper access rights for successful retrieval and integration.
Instructions
Download and import a Sketchfab model by its UID.
Parameters:
uid: The unique identifier of the Sketchfab model
Returns a message indicating success or failure. The model must be downloadable and you must have proper access rights.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes |
Implementation Reference
- src/blender_mcp/server.py:654-696 (handler)MCP tool handler that forwards the download_sketchfab_model command to the Blender addon via socket connection, handling the UID parameter and returning success/error messages with imported object names.@mcp.tool() def download_sketchfab_model( ctx: Context, uid: str ) -> str: """ Download and import a Sketchfab model by its UID. Parameters: - uid: The unique identifier of the Sketchfab model Returns a message indicating success or failure. The model must be downloadable and you must have proper access rights. """ try: blender = get_blender_connection() logger.info(f"Attempting to download Sketchfab model with UID: {uid}") result = blender.send_command("download_sketchfab_model", { "uid": uid }) if result is None: logger.error("Received None result from Sketchfab download") return "Error: Received no response from Sketchfab download request" if "error" in result: logger.error(f"Error from Sketchfab download: {result['error']}") return f"Error: {result['error']}" if result.get("success"): imported_objects = result.get("imported_objects", []) object_names = ", ".join(imported_objects) if imported_objects else "none" return f"Successfully imported model. Created objects: {object_names}" else: return f"Failed to download model: {result.get('message', 'Unknown error')}" except Exception as e: logger.error(f"Error downloading Sketchfab model: {str(e)}") import traceback logger.error(traceback.format_exc()) return f"Error downloading Sketchfab model: {str(e)}"
- src/blender_mcp/server.py:655-667 (schema)Input schema defined by function signature (uid: str) and docstring describing the parameter and return type (str message).def download_sketchfab_model( ctx: Context, uid: str ) -> str: """ Download and import a Sketchfab model by its UID. Parameters: - uid: The unique identifier of the Sketchfab model Returns a message indicating success or failure. The model must be downloadable and you must have proper access rights. """
- src/blender_mcp/server.py:654-654 (registration)The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool()
- src/blender_mcp/server.py:892-892 (helper)Usage instruction in the asset_creation_strategy prompt mentioning how to use the tool.- Then download specific models using download_sketchfab_model() with the UID
- src/blender_mcp/server.py:560-575 (helper)Related tool to check if Sketchfab integration (required for download_sketchfab_model) is enabled.def get_sketchfab_status(ctx: Context) -> str: """ Check if Sketchfab integration is enabled in Blender. Returns a message indicating whether Sketchfab features are available. """ try: blender = get_blender_connection() result = blender.send_command("get_sketchfab_status") enabled = result.get("enabled", False) message = result.get("message", "") if enabled: message += "Sketchfab is good at Realistic models, and has a wider variety of models than PolyHaven." return message except Exception as e: logger.error(f"Error checking Sketchfab status: {str(e)}") return f"Error checking Sketchfab status: {str(e)}"