lokalise_get_contributor
Retrieve a team member's full access and permissions details, including language assignments and admin rights. Verify permissions before updates or investigate access issues.
Instructions
Retrieves detailed information about a specific team member's access and permissions. Required: projectId, contributorId. Use to verify exact permissions before updates, investigate access issues, or get complete language assignments. Returns: Full contributor profile including all language permissions and administrative rights.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID containing the contributor | |
| contributorId | Yes | Contributor ID to get details for |
Implementation Reference
- src/domains/contributors/contributors.tool.ts:267-272 (registration)MCP tool registration: binds the name 'lokalise_get_contributor' to the GetContributorToolArgs schema and the handleGetContributor handler function.
server.tool( "lokalise_get_contributor", "Retrieves detailed information about a specific team member's access and permissions. Required: projectId, contributorId. Use to verify exact permissions before updates, investigate access issues, or get complete language assignments. Returns: Full contributor profile including all language permissions and administrative rights.", GetContributorToolArgs.shape, handleGetContributor, ); - Handler function for the 'lokalise_get_contributor' tool. Delegates to contributorsController.getContributor() and formats the result as MCP text content.
async function handleGetContributor(args: GetContributorToolArgsType) { const methodLogger = Logger.forContext( "contributors.tool.ts", "handleGetContributor", ); methodLogger.debug("Getting contributor details...", args); try { const result = await contributorsController.getContributor(args); methodLogger.debug("Got the response from the controller", result); return { content: [ { type: "text" as const, text: result.content, }, ], }; } catch (error) { methodLogger.error("Tool failed", { error: (error as Error).message, args, }); return formatErrorForMcpTool(error); } } - Zod schema (GetContributorToolArgs) defining the input arguments: projectId (string) and contributorId (string | number). Also exports the inferred TypeScript type.
export const GetContributorToolArgs = z .object({ projectId: z.string().describe("Project ID containing the contributor"), contributorId: z .union([z.string(), z.number()]) .describe("Contributor ID to get details for"), }) .strict(); export type GetContributorToolArgsType = z.infer<typeof GetContributorToolArgs>; - Controller function getContributor() that validates inputs (projectId, contributorId), calls contributorsService.get(), and returns formatted content via formatContributorDetails().
/** * @function getContributor * @description Fetches details of a specific contributor. * @memberof ContributorsController * @param {GetContributorToolArgsType} args - Arguments containing project ID and contributor ID * @returns {Promise<ControllerResponse>} A promise that resolves to the formatted contributor details. * @throws {McpError} Throws an McpError if the service call fails. */ async function getContributor( args: GetContributorToolArgsType, ): Promise<ControllerResponse> { const methodLogger = Logger.forContext( "contributors.controller.ts", "getContributor", ); methodLogger.debug("Getting contributor details...", 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.get(args); // Format response const formattedContent = formatContributorDetails(result); methodLogger.debug("Contributor details fetched successfully", { projectId: args.projectId, contributorId: args.contributorId, }); return { content: formattedContent, }; } catch (error: unknown) { throw handleControllerError(error, { source: "ContributorsController.getContributor", entityType: "Contributor", entityId: { project: args.projectId, contributor: String(args.contributorId), }, operation: "retrieving", }); } } - Service layer get() method that invokes the Lokalise API client (api.contributors().get()) to fetch a single contributor by ID for a given project.
/** * Get a specific contributor */ async get(args: GetContributorToolArgsType): Promise<Contributor> { const methodLogger = logger.forMethod("get"); methodLogger.info("Getting contributor", { projectId: args.projectId, contributorId: args.contributorId, }); try { const api = getLokaliseApi(); const result = await api.contributors().get(args.contributorId, { project_id: args.projectId, }); methodLogger.info("Retrieved contributor successfully", { projectId: args.projectId, contributorId: args.contributorId, email: result.email, }); return result; } catch (error) { methodLogger.error("Failed to get contributor", { error, args }); throw createUnexpectedError( `Failed to get contributor ${args.contributorId} from project ${args.projectId}`, error, ); } },