Skip to main content
Glama

lokalise_get_comment

Retrieve the complete text and metadata of a comment when the list view shows truncated content. Returns author details and exact timestamps for accurate comment management.

Instructions

Gets full details of a single comment including complete text and metadata. Required: projectId, keyId, commentId. Use when comment text was truncated in list view or to get exact timestamps. Returns: Complete comment data with author details and creation time. Pairs with: lokalise_delete_comment for comment management.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID containing the comment
keyIdYesKey ID containing the comment
commentIdYesComment ID to get details for

Implementation Reference

  • Registration of the 'lokalise_get_comment' MCP tool, binding the tool name to its Zod schema (GetCommentToolArgs.shape) and handler function (handleGetComment).
    server.tool(
    	"lokalise_get_comment",
    	"Gets full details of a single comment including complete text and metadata. Required: projectId, keyId, commentId. Use when comment text was truncated in list view or to get exact timestamps. Returns: Complete comment data with author details and creation time. Pairs with: lokalise_delete_comment for comment management.",
    	GetCommentToolArgs.shape,
    	handleGetComment,
    );
  • Handler function for the lokalise_get_comment tool. Calls commentsController.getComment() and formats the result as MCP text content.
    async function handleGetComment(args: GetCommentToolArgsType) {
    	const methodLogger = Logger.forContext(
    		"comments.tool.ts",
    		"handleGetComment",
    	);
    	methodLogger.debug("Getting comment details...", args);
    
    	try {
    		const result = await commentsController.getComment(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 for the lokalise_get_comment tool arguments: projectId (string), keyId (number), and commentId (number).
    export const GetCommentToolArgs = z
    	.object({
    		projectId: z.string().describe("Project ID containing the comment"),
    		keyId: z.number().describe("Key ID containing the comment"),
    		commentId: z.number().describe("Comment ID to get details for"),
    	})
    	.strict();
    
    export type GetCommentToolArgsType = z.infer<typeof GetCommentToolArgs>;
  • Controller for getComment. Validates inputs (projectId, keyId, commentId), calls commentsService.getComment(), and formats the result via formatCommentDetails().
    async function getComment(
    	args: GetCommentToolArgsType,
    ): Promise<ControllerResponse> {
    	const methodLogger = Logger.forContext(
    		"comments.controller.ts",
    		"getComment",
    	);
    	methodLogger.debug("Getting comment 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.keyId || typeof args.keyId !== "number") {
    			throw new McpError(
    				"Key ID is required and must be a number.",
    				ErrorType.API_ERROR,
    			);
    		}
    
    		if (!args.commentId || typeof args.commentId !== "number") {
    			throw new McpError(
    				"Comment ID is required and must be a number.",
    				ErrorType.API_ERROR,
    			);
    		}
    
    		// Call service layer
    		const result = await commentsService.getComment(args);
    
    		// Format response
    		const formattedContent = formatCommentDetails(result);
    
    		methodLogger.debug("Comment details fetched successfully", {
    			projectId: args.projectId,
    			keyId: args.keyId,
    			commentId: args.commentId,
    		});
    
    		return {
    			content: formattedContent,
    		};
    	} catch (error: unknown) {
    		throw handleControllerError(error, {
    			source: "CommentsController.getComment",
    			entityType: "Comment",
    			entityId: {
    				project: args.projectId,
    				key: String(args.keyId),
    				comment: String(args.commentId),
    			},
    			operation: "retrieving",
    		});
    	}
    }
    
    /**
     * @function createComments
     * @description Creates one or more comments on a key.
     * @memberof CommentsController
  • Service layer - calls Lokalise API's comments().get() with commentId, project_id, and key_id to retrieve a single comment.
    async getComment(args: GetCommentToolArgsType): Promise<Comment> {
    	const methodLogger = logger.forMethod("getComment");
    	methodLogger.info("Getting comment", {
    		projectId: args.projectId,
    		keyId: args.keyId,
    		commentId: args.commentId,
    	});
    
    	try {
    		const api = getLokaliseApi();
    		const result = await api.comments().get(args.commentId, {
    			project_id: args.projectId,
    			key_id: args.keyId,
    		});
    
    		methodLogger.info("Retrieved comment successfully", {
    			projectId: args.projectId,
    			keyId: args.keyId,
    			commentId: args.commentId,
    		});
    
    		return result;
    	} catch (error) {
    		methodLogger.error("Failed to get comment", { error, args });
    		throw createUnexpectedError(
    			`Failed to get comment ${args.commentId} from key ${args.keyId} in project ${args.projectId}`,
    			error,
    		);
    	}
    },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description bears full burden. Discloses returned content: complete text, metadata, author details, creation time. Read-only nature implied. Does not mention auth or rate limits, but adequate for a simple getter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences: purpose, usage conditions, return value. Front-loaded with key information. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers essential aspects: what it does, when to use, what it returns. Lacks mention of error behavior or validity of IDs, but given no output schema or annotations, it is fairly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, baseline 3. Description adds 'Required:' label and context that commentId is used to get details, but does not significantly enhance meaning beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Gets full details of a single comment', specifying verb and resource. Distinguishes from list operations by mentioning truncation in list view and pairs with delete comment for management. Explicitly lists required parameters.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use: 'when comment text was truncated in list view or to get exact timestamps'. Mentions pairing with delete comment. Lacks explicit when-not-to-use or alternatives among list comment siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/AbdallahAHO/lokalise-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server