Skip to main content
Glama

create_content_site

Create a new content site in your account by providing a name to establish your online presence and manage digital content.

Instructions

Create a new content site in the current account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesContent site name

Implementation Reference

  • The handler function for the 'create_content_site' tool. It sends a POST request to the Headlesshost API endpoint '/tools/content-sites' with the site name and optional sampleDataId, then returns the formatted API response or error.
    async ({ name, sampleDataId }) => { try { const payload = { name, sampleDataId }; const response: AxiosResponse<ApiResponse> = await apiClient.post("/tools/content-sites", payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
  • Input schema for the 'create_content_site' tool using Zod validation: required 'name' string and optional 'sampleDataId' string.
    inputSchema: { name: z.string().describe("Content site name"), sampleDataId: z.string().optional().describe("Optional sample data ID to initialize the site. The sample data list can be found in the ref data."), },
  • src/index.ts:741-776 (registration)
    Registration of the 'create_content_site' tool using McpServer.registerTool, including title, description, input schema, and inline handler function.
    server.registerTool( "create_content_site", { title: "Create Content Site", description: "Create a new content site in the current account", inputSchema: { name: z.string().describe("Content site name"), sampleDataId: z.string().optional().describe("Optional sample data ID to initialize the site. The sample data list can be found in the ref data."), }, }, async ({ name, sampleDataId }) => { try { const payload = { name, sampleDataId }; const response: AxiosResponse<ApiResponse> = await apiClient.post("/tools/content-sites", payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );
  • TypeScript interface defining the structure of a ContentSite entity, used in API responses.
    interface ContentSite { id: string; name: string; description?: string; accountId: string; isActive: boolean; createdAt: string; updatedAt: string; }
  • Helper function used by 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