post
Add comments to GitHub issues and pull requests to provide feedback, answer questions, or contribute to discussions on open source projects.
Instructions
Post a comment on a GitHub issue or pull request.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Full GitHub issue or PR URL to comment on | |
| message | Yes | The comment text to post |
Implementation Reference
- Implementation of the post tool, which posts a comment to a GitHub issue or PR.
export async function runPost(options: PostOptions): Promise<PostOutput> { validateUrl(options.url); validateGitHubUrl(options.url, ISSUE_OR_PR_URL_PATTERN, 'issue or PR'); if (!options.message.trim()) { throw new Error('No message provided'); } validateMessage(options.message); const token = requireGitHubToken(); // Parse URL const parsed = parseGitHubUrl(options.url); if (!parsed) { throw new Error('Invalid GitHub URL format'); } const { owner, repo, number } = parsed; const octokit = getOctokit(token); const { data: comment } = await octokit.issues.createComment({ owner, repo, issue_number: number, body: options.message, }); return { commentUrl: comment.html_url, url: options.url, }; } - packages/mcp-server/src/tools.ts:185-197 (registration)Registration of the post tool in the MCP server.
// 9. post — Post a comment server.registerTool( 'post', { description: 'Post a comment on a GitHub issue or pull request.', inputSchema: { url: z.string().describe('Full GitHub issue or PR URL to comment on'), message: z.string().describe('The comment text to post'), }, annotations: { readOnlyHint: false, destructiveHint: false }, }, wrapTool(runPost), );