Skip to main content
Glama

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
NameRequiredDescriptionDefault
contentSiteIdYesContent Site ID

Implementation Reference

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

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