get_content_site
Retrieve content site details using a specific ID to access and manage website information within the Kapiti CMS platform.
Instructions
Get content site details by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contentSiteId | Yes | Content Site ID |
Implementation Reference
- src/index.ts:822-844 (handler)Handler function that performs a GET request to retrieve content site details by ID using the apiClient, formats the response as text, and handles errors using handleApiError.async ({ contentSiteId }) => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get(`/tools/content-sites/${contentSiteId}`); 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:819-820 (schema)Input schema for the tool, requiring a contentSiteId string parameter.contentSiteId: z.string().describe("Content Site ID"), },
- src/index.ts:813-846 (registration)Registration of the 'get_content_site' tool using server.registerTool, including title, description, inputSchema, and handler function.server.registerTool( "get_content_site", { title: "Get Content Site", description: "Get content site details by ID", inputSchema: { contentSiteId: z.string().describe("Content Site ID"), }, }, async ({ contentSiteId }) => { try { const response: AxiosResponse<ApiResponse> = await apiClient.get(`/tools/content-sites/${contentSiteId}`); 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:87-95 (schema)TypeScript interface defining the structure of a ContentSite object, used in API responses.interface ContentSite { id: string; name: string; description?: string; accountId: string; isActive: boolean; createdAt: string; updatedAt: string; }
- src/index.ts:158-166 (helper)Helper function to format and return error messages from API responses or network errors, used in the tool handler.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}`; } }