Skip to main content
Glama

get_content_site_accounts

Retrieve user accounts linked to a specific content site for management and access control purposes.

Instructions

Get accounts associated with a content site

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentSiteIdYesContent site ID

Implementation Reference

  • src/index.ts:1954-1987 (registration)
    Full registration of the 'get_content_site_accounts' MCP tool, including input schema, title, description, and inline async handler function that performs an API GET request to retrieve accounts for the specified contentSiteId.
    server.registerTool(
      "get_content_site_accounts",
      {
        title: "Get ContentSite Accounts",
        description: "Get accounts associated with a content site",
        inputSchema: {
          contentSiteId: z.string().describe("Content site ID"),
        },
      },
      async ({ contentSiteId }) => {
        try {
          const response: AxiosResponse<ApiResponse<User[]>> = await apiClient.get(`/tools/content-sites/${contentSiteId}/accounts`);
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(response.data, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: handleApiError(error),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Inline handler function for the tool: fetches accounts via API for given contentSiteId, returns formatted JSON response or error message.
    async ({ contentSiteId }) => {
      try {
        const response: AxiosResponse<ApiResponse<User[]>> = await apiClient.get(`/tools/content-sites/${contentSiteId}/accounts`);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: handleApiError(error),
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the tool using Zod: requires contentSiteId as string.
    {
      title: "Get ContentSite Accounts",
      description: "Get accounts associated with a content site",
      inputSchema: {
        contentSiteId: z.string().describe("Content site ID"),
      },
    },
  • TypeScript interface User used in the API response typing ApiResponse<User[]> for the tool.
    interface User {
      id: string;
      email: string;
      firstName: string;
      lastName: string;
      isActive: boolean;
      role?: string;
      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