hosting_listJsDeployments
Retrieve a paginated list of Node.js application deployments with optional filtering by deployment states to monitor their status.
Instructions
List javascript application deployments for checking their status. Use this tool when customer asks for the status of the deployment. This tool retrieves a paginated list of Node.js application deployments for a domain with optional filtering by deployment states.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain name associated with the hosting account (e.g., example.com) | |
| page | No | Page number for pagination (optional) | |
| perPage | No | Number of items per page (optional) | |
| states | No | Filter by deployment states (optional). Valid values: pending, completed, running, failed |
Implementation Reference
- src/core/tools/hosting.ts:190-235 (schema)Schema definition for the hosting_listJsDeployments tool. Defines input parameters (domain required, page/perPage optional integers, states optional filter array with enum values: pending, completed, running, failed). Marks it as a custom tool with handlerMethod 'handleListJavascriptDeployments'.
{ "name": "hosting_listJsDeployments", "topic": "hosting", "description": "List javascript application deployments for checking their status. Use this tool when customer asks for the status of the deployment. This tool retrieves a paginated list of Node.js application deployments for a domain with optional filtering by deployment states.", "method": "", "path": "", "inputSchema": { "type": "object", "properties": { "domain": { "type": "string", "description": "Domain name associated with the hosting account (e.g., example.com)" }, "page": { "type": "integer", "description": "Page number for pagination (optional)" }, "perPage": { "type": "integer", "description": "Number of items per page (optional)" }, "states": { "type": "array", "items": { "type": "string", "enum": [ "pending", "completed", "running", "failed" ] }, "description": "Filter by deployment states (optional). Valid values: pending, completed, running, failed" } }, "required": [ "domain" ] }, "security": [], "custom": true, "templateFile": "list-javascript-deployments.template.js", "templateFileTS": "list-javascript-deployments.template.ts", "handlerMethod": "handleListJavascriptDeployments", "group": "hosting" }, - src/core/runtime.js:185-192 (registration)Registration of the hosting_listJsDeployments tool in the executeCustomTool switch statement. When the tool name matches, it calls handleListJavascriptDeployments.
case 'hosting_listJsDeployments': return await this.handleListJavascriptDeployments(params); case 'hosting_showJsDeploymentLogs': return await this.handleShowJsDeploymentLogs(params); default: throw new Error(`Unknown custom tool: ${tool.name}`); } } - src/core/runtime.js:1732-1766 (handler)Main handler function handleListJavascriptDeployments. Validates params, resolves username from domain, builds query params from optional filters (page, perPage, states), calls the API to fetch deployments from '/api/hosting/v1/accounts/{username}/websites/{domain}/nodejs/builds', and returns the result.
async handleListJavascriptDeployments(params) { const { domain, page, perPage, states } = params; this.hosting_listJsDeployments_validateRequiredParams(params); // Auto-resolve username from domain this.log('info', `Resolving username from domain: ${domain}`); const username = await this.resolveUsername(domain); // Build query parameters const queryParams = this.hosting_listJsDeployments_buildQueryParams(params); // Fetch deployments let deployments; try { this.log('info', `Fetching deployments for ${domain}`); deployments = await this.hosting_listJsDeployments_fetchDeployments(username, domain, queryParams); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); this.log('error', `Failed to fetch deployments: ${errorMessage}`); throw error; } return { status: 'success', domain, username, queryParams: { page, perPage, states }, deployments }; } - src/core/runtime.js:1660-1679 (helper)Helper function that builds URL query parameters for the deployments API call. Converts optional page, perPage, and states filters into query string format (page, per_page, states[]).
hosting_listJsDeployments_buildQueryParams(params) { const { page, perPage, states } = params; const queryParams = new URLSearchParams(); if (page !== undefined && page !== null) { queryParams.append('page', page.toString()); } if (perPage !== undefined && perPage !== null) { queryParams.append('per_page', perPage.toString()); } if (states && Array.isArray(states) && states.length > 0) { states.forEach(state => { queryParams.append('states[]', state); }); } return queryParams.toString(); } - src/core/runtime.js:1652-1658 (helper)Helper function that validates the required 'domain' parameter is present and is a string.
hosting_listJsDeployments_validateRequiredParams(params) { const { domain } = params; if (!domain || typeof domain !== 'string') { throw new Error('domain is required and must be a string'); } }