Skip to main content
Glama

create_issue_comment

Add comments to AtomGit repository issues to provide updates, ask questions, or share information with collaborators.

Instructions

Create an issue comment in a AtomGit repository issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner, typically referred to as 'username (owner)'. Case-insensitive.
repoYesRepository name. Case-insensitive.
issue_numberYesIssue number
bodyYesIssue comment content (in Markdown format)

Implementation Reference

  • Core handler function that executes the POST request to AtomGit API to create an issue comment.
    export async function createIssueComment(
      owner: string,
      repo: string,
      issue_number: number,
      body: string
    ) {
      return atomGitRequest(
        `https://api.atomgit.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/issues/${encodeURIComponent(issue_number)}/comments`,
        {
          method: "POST",
          body: {
            body
          },
        }
      );
    }
  • Zod input schema used for validation in both registration and handler.
    export const CreateIssueCommentSchema = z.object({
      owner: z.string().describe("Repository owner, typically referred to as 'username (owner)'. Case-insensitive."),
      repo: z.string().describe("Repository name. Case-insensitive."),
      issue_number: z.number().describe("Issue number"),
      body: z.string().describe("Issue comment content (in Markdown format)"),
    });
  • index.ts:126-130 (registration)
    Tool registration object in the ListTools response, defining name, description, and schema.
    {
      name: "create_issue_comment",
      description: "Create an issue comment in a AtomGit repository issue",
      inputSchema: zodToJsonSchema(issues.CreateIssueCommentSchema),
    },
  • Dispatcher handler case for 'create_issue_comment' tool: parses args, calls the core function, formats response and handles errors.
    case "create_issue_comment": {
      const args = issues.CreateIssueCommentSchema.parse(request.params.arguments);
      const { owner, repo, issue_number, body } = args;
    
      try {
        console.error(`[DEBUG] Attempting to create issue comment in ${owner}/${repo}`);
    
        const issue = await issues.createIssueComment(owner, repo, issue_number, body);
    
        return {
          content: [{ type: "text", text: JSON.stringify(issue, null, 2) }],
        };
      } catch (err) {
        // Type guard for Error objects
        const error = err instanceof Error ? err : new Error(String(err));
    
        console.error(`[ERROR] Failed to create issue:`, error);
    
        if (error instanceof AtomGitResourceNotFoundError) {
          throw new Error(
            `Repository '${owner}/${repo}' not found. Please verify:\n` +
            `1. The repository exists\n` +
            `2. You have correct access permissions\n` +
            `3. The owner and repository names are spelled correctly`
          );
        }
    
        // Safely access error properties
        throw new Error(
          `Failed to create issue comment: ${error.message}${error.stack ? `\nStack: ${error.stack}` : ''
          }`
        );
      }
    }

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/kaiyuanxiaobing/atomgit-mcp-server'

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