create_3d_model_from_text
Generate a 3D model from a text description using the Tripo API. Initiate the task with a detailed object description, monitor progress using task_id, and retrieve the finalized model upon completion.
Instructions
Create a 3D model from a text description using the Tripo API.
IMPORTANT: This tool initiates a 3D model generation task but does NOT wait for completion.
After calling this tool, you MUST repeatedly call the get_task_status tool with the returned
task_id until the task status is SUCCESS or a terminal error state.
Typical workflow:
1. Call create_3d_model_from_text to start the task
2. Get the task_id from the response
3. Call get_task_status with the task_id
4. If status is not SUCCESS, wait a moment and call get_task_status again
5. Repeat until status is SUCCESS or a terminal error state
6. When status is SUCCESS, use the pbr_model_url from the response
Args:
describe_the_look_of_object: A detailed description of the object to generate.
face_limit: The maximum number of faces in the model.
auto_size: Whether to automatically size the model.
Returns:
A dictionary containing the task ID and instructions for checking the status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| describe_the_look_of_object | Yes | ||
| face_limit | No |
Implementation Reference
- src/server.py:718-780 (handler)The primary handler function for the create_3d_model_from_text tool. It registers the tool via @mcp.tool(), defines the input parameters (describe_the_look_of_object: str, face_limit: int = -1), uses TripoClient to start an asynchronous 3D model generation task from text prompt, and returns task details including task_id for status polling.@mcp.tool() async def create_3d_model_from_text( describe_the_look_of_object: str, face_limit: int = -1 ) -> Dict[str, Any]: """ Create a 3D model from a text description using the Tripo API. IMPORTANT: This tool initiates a 3D model generation task but does NOT wait for completion. After calling this tool, you MUST repeatedly call the get_task_status tool with the returned task_id until the task status is SUCCESS or a terminal error state. Typical workflow: 1. Call create_3d_model_from_text to start the task 2. Get the task_id from the response 3. Call get_task_status with the task_id 4. If status is not SUCCESS, wait a moment and call get_task_status again 5. Repeat until status is SUCCESS or a terminal error state 6. When status is SUCCESS, use the pbr_model_url from the response Args: describe_the_look_of_object: A detailed description of the object to generate. face_limit: The maximum number of faces in the model. auto_size: Whether to automatically size the model. Returns: A dictionary containing the task ID and instructions for checking the status. """ # Get the API key from environment variable # api_key = os.environ.get("TRIPO_API_KEY") get_blender_connection() blender = get_blender_connection() api_key = _tripo_apikey if not api_key: raise ValueError( "It may take some more time to correctly re-enter the tripo function. You can first check the scene and then try the tripo function again later" ) # Create the Tripo client async with TripoClient(api_key=api_key) as client: # Create a text-to-model task task_id = await client.text_to_model( prompt=describe_the_look_of_object, face_limit=face_limit, ) # Get initial task status task = await client.get_task(task_id) # Return immediately with task ID and status return { "task_id": task_id, "status": str(task.status), "progress": task.progress, "message": "Task created successfully. The 3D model generation is in progress.", "next_step": "You MUST now call get_task_status with this task_id to check progress.", "important_note": "3D model generation takes 3-5 minutes. You need to repeatedly call get_task_status until completion.", "workflow": [ "1. You've completed this step by calling create_3d_model_from_text", "2. Now call get_task_status with task_id: " + task_id, "3. If status is not SUCCESS, wait and call get_task_status again", "4. When status is SUCCESS, use the pbr_model_url from the response", ], }
- src/server.py:983-989 (registration)The main entry point that starts the MCP server with stdio transport, thereby registering and serving all @mcp.tool() decorated functions including create_3d_model_from_text.def main(): # mcp.run("sse") mcp.run(transport="stdio") if __name__ == "__main__": main()
- src/server.py:847-884 (helper)Helper tool to import the generated GLB model (using pbr_model_url from task status) into the Blender scene.@mcp.tool() def import_tripo_glb_model(ctx: Context, glb_url: str) -> str: """ Import a GLB model from URL into Blender scene Parameters: - glb_url: Download URL of the GLB model file Returns: Result message of the import operation """ try: blender = get_blender_connection() result = blender.send_command("import_tripo_glb_model", {"url": glb_url}) if "error" in result: return f"Import failed: {result['error']}" if result.get("status") == "success": output = ["Successfully imported models:"] for model in result.get("models", []): dim = model["dimensions"] output.append( f"• {model['name']} | Dimensions: " f"{dim['x']} x {dim['y']} x {dim['z']} meters" ) if not output: output.append("No models found in imported file") return "\n".join(output) else: return f"Import failed: {result.get('message', 'Unknown error')}" except Exception as e: logger.error(f"Error importing GLB model: {str(e)}") return f"GLB model import failed: {str(e)}"
- src/server.py:886-981 (helper)Essential helper tool to poll the status of tasks created by create_3d_model_from_text, providing model URLs upon success.@mcp.tool() async def get_task_status(task_id: str) -> Dict[str, Any]: """ Get the status of a 3D model generation task. IMPORTANT: This tool checks the status of a task started by create_3d_model_from_text. You may need to call this tool MULTIPLE TIMES until the task completes. Typical workflow: 1. Call this tool with the task_id from create_3d_model_from_text 2. Check the status in the response: - If status is SUCCESS, the task is complete and you can use the pbr_model_url - If status is FAILED, CANCELLED, BANNED, or EXPIRED, the task failed - If status is anything else, the task is still in progress 3. If the task is still in progress, wait a moment and call this tool again Args: task_id: The ID of the task to check (obtained from create_3d_model_from_text). Returns: A dictionary containing the task status and other information. """ # Get the API key from environment variable # api_key = os.environ.get("TRIPO_API_KEY") get_blender_connection() api_key = _tripo_apikey if not api_key: raise ValueError( "It may take some more time to correctly re-enter the tripo function. You can first check the scene and then try the tripo function again later" ) # Create the Tripo client async with TripoClient(api_key=api_key) as client: # Get task status task = await client.get_task(task_id) # Ensure task is not None if task is None: raise ValueError( f"Failed to retrieve task information for task ID: {task_id}" ) # Create result dictionary result = { "task_id": task_id, "status": str(task.status), "progress": task.progress, } # Add output fields if task is successful and output is available if task.status == TaskStatus.SUCCESS and task.output: result.update( { "base_model_url": task.output.base_model, "model_url": task.output.model, "pbr_model_url": task.output.pbr_model, "rendered_image_url": task.output.rendered_image, "message": "Task completed successfully! You can now use the pbr_model_url.", "next_step": "Use the pbr_model_url to access the 3D model, download it through import_tripo_glb_model tool", } ) if not task.output.pbr_model: result["warning"] = ( "Model generated but PBR model URL is not available." ) elif task.status == TaskStatus.SUCCESS: result["message"] = ( "Task completed successfully but no output data is available." ) result["next_step"] = ( "Try creating a new model with a different description." ) elif task.status in ( TaskStatus.FAILED, TaskStatus.CANCELLED, TaskStatus.BANNED, TaskStatus.EXPIRED, ): result["message"] = f"Task failed with status: {task.status}" result["next_step"] = ( "Try creating a new model with a different description." ) else: result["message"] = ( f"Task is still in progress. Current status: {task.status}, Progress: {task.progress}%" ) result["next_step"] = ( "IMPORTANT: You must call get_task_status again with this task_id to continue checking progress." ) result["wait_message"] = ( "3D model generation typically takes 3-5 minutes. Please be patient and keep checking." ) return result