Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlYesFull GitHub issue or PR URL to comment on
messageYesThe 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,
      };
    }
  • 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),
    );

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/costajohnt/oss-autopilot'

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