copilot_buttons_from_github
Generate VS Code install buttons for GitHub files by specifying owner, repo, path, and optional branch, simplifying code sharing and collaboration.
Instructions
Generate VS Code install buttons for a GitHub file using owner/repo/path and optional branch.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | No | main | |
| kind | Yes | Install kind | |
| owner | Yes | ||
| path | Yes | Path within the repo | |
| repo | Yes |
Implementation Reference
- src/lib/buttons.ts:92-95 (handler)Core tool handler implementation: constructs the raw GitHub URL from repo details and generates the Copilot install buttons markdown using the helper function.export function generateCopilotInstallButtonsFromGithub(kind: CopilotInstallKind, owner: string, repo: string, path: string, branch = 'main'): string { const raw = buildRawGithubUrl(owner, repo, branch, path); return generateCopilotInstallButtons(kind, raw); }
- src/index.ts:171-177 (schema)Input schema definition for the tool using Zod validators for parameters: kind, owner, repo, path, branch.inputSchema: { kind: z.enum(["chat-instructions", "chat-prompt", "chat-mode"]).describe("Install kind"), owner: z.string(), repo: z.string(), path: z.string().describe("Path within the repo"), branch: z.string().default("main"), }
- src/index.ts:166-183 (registration)Registration of the 'copilot_buttons_from_github' MCP tool, including title, description, input schema, and thin handler that delegates to the core implementation.server.registerTool( "copilot_buttons_from_github", { title: "Copilot install buttons (GitHub)", description: "Generate VS Code install buttons for a GitHub file using owner/repo/path and optional branch.", inputSchema: { kind: z.enum(["chat-instructions", "chat-prompt", "chat-mode"]).describe("Install kind"), owner: z.string(), repo: z.string(), path: z.string().describe("Path within the repo"), branch: z.string().default("main"), } }, async ({ kind, owner, repo, path, branch }) => { const markdown = generateCopilotInstallButtonsFromGithub(kind, owner, repo, path, branch ?? 'main'); return { content: [{ type: "text", text: markdown }] }; } );
- src/lib/buttons.ts:88-90 (helper)Helper function to build the raw GitHub content URL from owner, repo, branch, and path.export function buildRawGithubUrl(owner: string, repo: string, branch: string, path: string): string { return `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`; }
- src/lib/buttons.ts:78-86 (helper)Helper function that generates the markdown for VS Code stable and insiders install buttons given the raw URL and kind.export function generateCopilotInstallButtons(kind: CopilotInstallKind, rawUrl: string): string { const stableBadge = makeInstallBadge('0098FF', 'VS_Code'); const insidersBadge = makeInstallBadge('24bfa5', 'VS_Code_Insiders'); const stableLink = buildCopilotInstallLink(kind, rawUrl, false); const insidersLink = buildCopilotInstallLink(kind, rawUrl, true); const stable = `[](${stableLink})`; const insiders = `[](${insidersLink})`; return `${stable}\n${insiders}`; }