Skip to main content
Glama

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
NameRequiredDescriptionDefault
modal_pathNo

Implementation Reference

  • 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"], }, ) ]
  • 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)}")
  • 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)}"
  • Input schema definition for the deploy tool (note inconsistency: requires 'message' but properties define 'modal_path').
    "required": ["message"], },

Other Tools

Related 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/Flux159/mcp-server-modal'

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