claim
Claim GitHub issues by posting intent-to-work comments to manage open source contributions.
Instructions
Claim a GitHub issue by posting a comment expressing intent to work on it.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueUrl | Yes | Full GitHub issue URL to claim | |
| message | No | Custom claim message. If omitted, a default message is used. |
Implementation Reference
- The handler function 'runClaim' which posts a claim comment on a GitHub issue and tracks it locally.
export async function runClaim(options: ClaimOptions): Promise<ClaimOutput> { validateUrl(options.issueUrl); validateGitHubUrl(options.issueUrl, ISSUE_URL_PATTERN, 'issue'); const token = requireGitHubToken(); // Default claim message or custom const message = options.message || "Hi! I'd like to work on this issue. Could you assign it to me?"; validateMessage(message); // Parse URL const parsed = parseGitHubUrl(options.issueUrl); if (!parsed || parsed.type !== 'issues') { throw new Error('Invalid issue URL format (must be an issue, not a PR)'); } const { owner, repo, number } = parsed; const octokit = getOctokit(token); const { data: comment } = await octokit.issues.createComment({ owner, repo, issue_number: number, body: message, }); // Add to tracked issues — non-fatal if state save fails (comment already posted) try { const stateManager = getStateManager(); stateManager.addIssue({ id: number, url: options.issueUrl, repo: `${owner}/${repo}`, number, title: '(claimed)', status: 'claimed', labels: [], createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), vetted: false, }); } catch (error) { console.error( `Warning: Comment posted on ${options.issueUrl} but failed to save to local state: ${error instanceof Error ? error.message : error}`, ); } return { commentUrl: comment.html_url, issueUrl: options.issueUrl, }; } - packages/mcp-server/src/tools.ts:199-211 (registration)MCP tool registration for 'claim' which uses the 'runClaim' handler.
// 10. claim — Claim an issue server.registerTool( 'claim', { description: 'Claim a GitHub issue by posting a comment expressing intent to work on it.', inputSchema: { issueUrl: z.string().describe('Full GitHub issue URL to claim'), message: z.string().optional().describe('Custom claim message. If omitted, a default message is used.'), }, annotations: { readOnlyHint: false, destructiveHint: false }, }, wrapTool(runClaim), );