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
| Name | Required | Description | Default |
|---|---|---|---|
| contentSiteId | Yes | Content 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, }; } } );
- src/index.ts:1963-1986 (handler)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, }; } }
- src/index.ts:1956-1962 (schema)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"), }, },
- src/index.ts:55-64 (schema)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; }
- src/index.ts:158-166 (helper)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}`; } }