add_issue_comment
Add comments to issues in Gitee repositories by specifying the repository owner, repo, issue number, and comment content.
Instructions
向 Gitee 仓库中的 Issue 添加评论
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Comment content | |
| issue_number | Yes | Issue number | |
| owner | Yes | Repository owner path (enterprise, organization, or personal path) | |
| repo | Yes | Repository path |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"body": {
"description": "Comment content",
"type": "string"
},
"issue_number": {
"description": "Issue number",
"type": [
"number",
"string"
]
},
"owner": {
"description": "Repository owner path (enterprise, organization, or personal path)",
"type": "string"
},
"repo": {
"description": "Repository path",
"type": "string"
}
},
"required": [
"owner",
"repo",
"issue_number",
"body"
],
"type": "object"
}
Implementation Reference
- operations/issues.ts:211-224 (handler)The async function that implements the logic to add a comment to a Gitee issue by making a POST request to the Gitee API.export async function addIssueComment( owner: string, repo: string, issueNumber: number | string, body: string ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); const url = `/repos/${owner}/${repo}/issues/${issueNumber}/comments`; const response = await giteeRequest(url, "POST", { body }); return GiteeIssueCommentSchema.parse(response); }
- operations/issues.ts:82-91 (schema)Zod schema defining the input parameters for adding an issue comment: owner, repo, issue_number, body.export const IssueCommentSchema = z.object({ // 仓库所属空间地址 (企业、组织或个人的地址 path) owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"), // 仓库路径 (path) repo: z.string().describe("Repository path"), // Issue 编号 issue_number: z.union([z.number(), z.string()]).describe("Issue number"), // 评论内容 body: z.string().describe("Comment content"), });
- index.ts:179-187 (registration)Registers the 'add_issue_comment' tool with the MCP server, linking the schema and handler from issueOperations.server.registerTool({ name: "add_issue_comment", description: "向 Gitee 仓库中的 Issue 添加评论", schema: issueOperations.IssueCommentSchema, handler: async (params: any) => { const { owner, repo, issue_number, body } = params; return await issueOperations.addIssueComment(owner, repo, issue_number, body); }, });