Skip to main content
Glama

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
NameRequiredDescriptionDefault
contentSiteIdYesContent site ID
newNameNoName for the cloned site
stagingSiteIdYesStaging site ID

Implementation Reference

  • 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, }; } }
  • 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, }; } } );
  • 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}`; } }

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/Headlesshost/mcp-server'

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