Skip to main content
Glama

delete_user

Remove a user account from the Kapiti platform by specifying the user ID and optional deletion reason to maintain system integrity.

Instructions

Delete a user from the system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUser ID
reasonNoReason for deletion

Implementation Reference

  • The handler function for the 'delete_user' tool. It sends a DELETE request to the Headlesshost API endpoint `/tools/membership/users/${id}` with an optional 'reason' in the payload and returns the API response or error.
    async ({ id, reason }) => {
      try {
        const payload = { reason };
        const response: AxiosResponse<ApiResponse> = await apiClient.delete(`/tools/membership/users/${id}`, {
          data: 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 'delete_user' tool using Zod validation: requires 'id' (string) and optional 'reason' (string).
      id: z.string().describe("User ID"),
      reason: z.string().optional().describe("Reason for deletion"),
    },
  • src/index.ts:434-471 (registration)
    Registers the 'delete_user' tool with the MCP server, including title, description, input schema, and handler function.
    server.registerTool(
      "delete_user",
      {
        title: "Delete User",
        description: "Delete a user from the system",
        inputSchema: {
          id: z.string().describe("User ID"),
          reason: z.string().optional().describe("Reason for deletion"),
        },
      },
      async ({ id, reason }) => {
        try {
          const payload = { reason };
          const response: AxiosResponse<ApiResponse> = await apiClient.delete(`/tools/membership/users/${id}`, {
            data: payload,
          });
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(response.data, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: handleApiError(error),
              },
            ],
            isError: true,
          };
        }
      }
    );

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