deploy_site
Trigger deployment for a specified site on a Ploi server and wait for it to complete. Returns the final status of the deployment.
Instructions
Trigger deployment for a site and wait for it to complete. Returns status when done.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server_id | Yes | The ID of the server | |
| site_id | Yes | The ID of the site to deploy |
Implementation Reference
- src/tools/sites.ts:66-117 (handler)MCP tool handler for 'deploy_site'. Calls client.deploySite() then polls every 5s for up to 5 minutes until site status is 'active' or changes from 'deploying'. Returns a formatted status message.
server.tool( "deploy_site", "Trigger deployment for a site and wait for it to complete. Returns status when done.", { server_id: z.coerce.number().describe("The ID of the server"), site_id: z.coerce.number().describe("The ID of the site to deploy"), }, async ({ server_id, site_id }) => { await client.deploySite(server_id, site_id); // Poll until deployment completes (max 5 minutes) const maxAttempts = 60; const pollInterval = 5000; // 5 seconds for (let attempt = 0; attempt < maxAttempts; attempt++) { await new Promise(resolve => setTimeout(resolve, pollInterval)); const site = await client.getSite(server_id, site_id); if (site.status === "active") { return { content: [ { type: "text" as const, text: `✅ Deployment successful!\n\nSite: ${site.domain}\nStatus: ${site.status}`, }, ], }; } if (site.status !== "deploying") { // Some other status (error, etc) return { content: [ { type: "text" as const, text: `⚠️ Deployment ended with status: ${site.status}\n\nSite: ${site.domain}`, }, ], }; } } return { content: [ { type: "text" as const, text: `⏱️ Deployment still in progress after 5 minutes. Check status manually.`, }, ], }; } - src/tools/sites.ts:69-72 (schema)Zod schema for deploy_site: requires server_id and site_id as numbers.
{ server_id: z.coerce.number().describe("The ID of the server"), site_id: z.coerce.number().describe("The ID of the site to deploy"), }, - src/tools/sites.ts:66-118 (registration)Tool registration via server.tool('deploy_site', ...) inside registerSiteTools() which is called from registerAllTools().
server.tool( "deploy_site", "Trigger deployment for a site and wait for it to complete. Returns status when done.", { server_id: z.coerce.number().describe("The ID of the server"), site_id: z.coerce.number().describe("The ID of the site to deploy"), }, async ({ server_id, site_id }) => { await client.deploySite(server_id, site_id); // Poll until deployment completes (max 5 minutes) const maxAttempts = 60; const pollInterval = 5000; // 5 seconds for (let attempt = 0; attempt < maxAttempts; attempt++) { await new Promise(resolve => setTimeout(resolve, pollInterval)); const site = await client.getSite(server_id, site_id); if (site.status === "active") { return { content: [ { type: "text" as const, text: `✅ Deployment successful!\n\nSite: ${site.domain}\nStatus: ${site.status}`, }, ], }; } if (site.status !== "deploying") { // Some other status (error, etc) return { content: [ { type: "text" as const, text: `⚠️ Deployment ended with status: ${site.status}\n\nSite: ${site.domain}`, }, ], }; } } return { content: [ { type: "text" as const, text: `⏱️ Deployment still in progress after 5 minutes. Check status manually.`, }, ], }; } ); - src/client.ts:155-160 (helper)PloiClient.deploySite() - HTTP helper that POSTs to /servers/{serverId}/sites/{siteId}/deploy to trigger a deployment.
async deploySite(serverId: number, siteId: number): Promise<void> { await this.request<void>( "POST", `/servers/${serverId}/sites/${siteId}/deploy` ); }