lokalise_remove_contributor
Remove a contributor from a project, revoking all access. Ideal for offboarding or security cleanup. Immediate effect: contributor loses all project access.
Instructions
Removes a team member from a project, revoking all access. Required: projectId, contributorId. Use for offboarding, security cleanup, or removing inactive members. Returns: Confirmation of removal. Warning: Immediate effect - contributor loses all project access. Consider permission downgrade instead for temporary changes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID containing the contributor | |
| contributorId | Yes | Contributor ID to remove |
Implementation Reference
- MCP tool handler that removes a contributor. Calls contributorsController.removeContributor() and formats the response.
} /** * @function handleRemoveContributor * @description MCP Tool handler to remove a contributor from a project. * * @param {RemoveContributorToolArgsType} args - Arguments provided to the tool. * @returns {Promise<{ content: Array<{ type: 'text', text: string }> }>} Formatted response for the MCP. * @throws {McpError} Formatted error if the controller or service layer encounters an issue. */ async function handleRemoveContributor(args: RemoveContributorToolArgsType) { - src/domains/contributors/contributors.tool.ts:295-300 (registration)Registration of the 'lokalise_remove_contributor' tool on the MCP server with its schema and handler.
server.tool( "lokalise_remove_contributor", "Removes a team member from a project, revoking all access. Required: projectId, contributorId. Use for offboarding, security cleanup, or removing inactive members. Returns: Confirmation of removal. Warning: Immediate effect - contributor loses all project access. Consider permission downgrade instead for temporary changes.", RemoveContributorToolArgs.shape, handleRemoveContributor, ); - Zod schema for remove contributor arguments: projectId (string) and contributorId (string | number).
export const RemoveContributorToolArgs = z .object({ projectId: z.string().describe("Project ID containing the contributor"), contributorId: z .union([z.string(), z.number()]) .describe("Contributor ID to remove"), }) .strict(); export type RemoveContributorToolArgsType = z.infer< typeof RemoveContributorToolArgs >; - Controller function that validates inputs and calls contributorsService.delete() to remove a contributor.
async function removeContributor( args: RemoveContributorToolArgsType, ): Promise<ControllerResponse> { const methodLogger = Logger.forContext( "contributors.controller.ts", "removeContributor", ); methodLogger.debug("Removing contributor...", args); try { // Validate inputs if (!args.projectId || typeof args.projectId !== "string") { throw new McpError( "Project ID is required and must be a string.", ErrorType.API_ERROR, ); } if (!args.contributorId) { throw new McpError("Contributor ID is required.", ErrorType.API_ERROR); } // Call service layer const result = await contributorsService.delete(args); // Format response const formattedContent = formatRemoveContributorResult(result); methodLogger.debug("Contributor removed successfully", { projectId: args.projectId, contributorId: args.contributorId, }); return { content: formattedContent, }; } catch (error: unknown) { throw handleControllerError(error, { source: "ContributorsController.removeContributor", entityType: "Contributor", entityId: { project: args.projectId, contributor: String(args.contributorId), }, operation: "removing", }); } } - Service layer delete function that calls the Lokalise API to remove a contributor from a project.
async delete( args: RemoveContributorToolArgsType, ): Promise<ContributorDeleted> { const methodLogger = logger.forMethod("delete"); methodLogger.info("Removing contributor", { projectId: args.projectId, contributorId: args.contributorId, }); try { const api = getLokaliseApi(); const result = await api.contributors().delete(args.contributorId, { project_id: args.projectId, }); methodLogger.info("Removed contributor successfully", { projectId: args.projectId, contributorId: args.contributorId, }); return result; } catch (error) { methodLogger.error("Failed to remove contributor", { error, args }); throw createUnexpectedError( `Failed to remove contributor ${args.contributorId} from project ${args.projectId}`, error, ); } },