deploy
Deploy Python scripts to Modal directly from Claude using this tool. Automatically generates a shareable link for the deployed application, simplifying the process of launching and distributing Python-based solutions.
Instructions
some description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modal_path | No |
Implementation Reference
- src/modal_server/server.py:111-122 (registration)Registration of the 'deploy' tool, including its name, description, and input schema (note: schema has mismatch between 'required' ['message'] and properties ['modal_path']).Tool( name="deploy", description="some description", inputSchema={ "type": "object", "properties": { "modal_path": {"type": "string"}, }, "required": ["message"], }, ) ]
- src/modal_server/server.py:125-143 (handler)The MCP @app.call_tool() handler that dispatches to the deploy function when name=='deploy', extracts modal_path from arguments, calls deploy, and returns formatted result as TextContent.@app.call_tool() async def call_tool( name: str, arguments: Any ) -> Sequence[TextContent | ImageContent | EmbeddedResource]: """Handle tool calls for weather forecasts.""" if name != "deploy": raise ValueError(f"Unknown tool: {name}") if not isinstance(arguments, dict) or "modal_path" not in arguments: raise ValueError("Invalid forecast arguments") modal_path = arguments["modal_path"] try: res = deploy(modal_path) return [ TextContent(type="text", text=json.dumps(f"Deploy result: {res}", indent=2)) ] except httpx.HTTPError as e: raise RuntimeError(f"Ran in error: {str(e)}")
- src/modal_server/server.py:145-170 (handler)Core implementation of the deploy tool: executes 'modal deploy <modal_path>' via subprocess, returns success message or raises/propagates errors.def deploy(modal_path: str = "model_app.py") -> str: """ Deploy a model using Modal CLI command. Args: modal_path: Path to the modal file to deploy Returns: str: deployment result """ try: # Run modal deploy command process = subprocess.run(["modal", "deploy", modal_path], capture_output=True, text=True) # Check if the command was successful if process.returncode == 0: return f"Deploy success: {process.stdout}" else: raise RuntimeError(f"Deploy failed: {process.stderr}") # if process.returncode == 0: # message = f"Deployment successful: {stdout.decode()}" # else: # message = f"Deployment failed: {stderr.decode()}" # return message except Exception as e: return f"Deployment error: {str(e)}"
- src/modal_server/server.py:119-120 (schema)Input schema definition for the deploy tool (note inconsistency: requires 'message' but properties define 'modal_path')."required": ["message"], },