clone_staging_site
Clone a staging site to create a new copy for testing or development purposes using specified content and staging site IDs.
Instructions
Clone a staging site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contentSiteId | Yes | Content site ID | |
| newName | No | Name for the cloned site | |
| stagingSiteId | Yes | Staging site ID |
Implementation Reference
- src/index.ts:1321-1345 (handler)Handler function that executes the clone_staging_site tool by sending a POST request to the API endpoint `/tools/content-sites/${contentSiteId}/staging-sites/${stagingSiteId}/clone` with optional newName payload, returning the API response or error.async ({ contentSiteId, stagingSiteId, newName }) => { try { const payload = { newName }; const response: AxiosResponse<ApiResponse<StagingSite>> = await apiClient.post(`/tools/content-sites/${contentSiteId}/staging-sites/${stagingSiteId}/clone`, payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
- src/index.ts:1315-1319 (schema)Zod input schema for clone_staging_site tool parameters: required contentSiteId and stagingSiteId (strings), optional newName (string).inputSchema: { contentSiteId: z.string().describe("Content site ID"), stagingSiteId: z.string().describe("Staging site ID"), newName: z.string().optional().describe("Name for the cloned site"), },
- src/index.ts:1310-1346 (registration)Tool registration call for clone_staging_site using McpServer.registerTool, specifying title, description, input schema, and inline handler function.server.registerTool( "clone_staging_site", { title: "Clone Staging Site", description: "Clone a staging site", inputSchema: { contentSiteId: z.string().describe("Content site ID"), stagingSiteId: z.string().describe("Staging site ID"), newName: z.string().optional().describe("Name for the cloned site"), }, }, async ({ contentSiteId, stagingSiteId, newName }) => { try { const payload = { newName }; const response: AxiosResponse<ApiResponse<StagingSite>> = await apiClient.post(`/tools/content-sites/${contentSiteId}/staging-sites/${stagingSiteId}/clone`, payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );
- src/index.ts:158-166 (helper)Helper function handleApiError used in the tool handler to format and return API error messages.function handleApiError(error: any): string { if (error.response) { return `API Error ${error.response.status}: ${error.response.data?.message || error.response.statusText}`; } else if (error.request) { return "Network Error: Unable to reach API server"; } else { return `Error: ${error.message}`; } }