copilot_buttons_from_github
Create VS Code install buttons for GitHub files by specifying owner, repository, and file path. Generates markdown badges for MCP server installation.
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 |
|---|---|---|---|
| kind | Yes | Install kind | |
| owner | Yes | ||
| repo | Yes | ||
| path | Yes | Path within the repo | |
| branch | No | main |
Implementation Reference
- src/index.ts:166-183 (registration)Registers the MCP tool 'copilot_buttons_from_github' with Zod input schema and a handler that delegates to the helper function.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:92-95 (handler)The core handler logic: constructs the raw GitHub URL for the file and generates the Copilot-style install buttons markdown.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)Zod input schema definition for the tool parameters.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/lib/buttons.ts:88-90 (helper)Helper function to build the raw GitHub file URL from repo details.export function buildRawGithubUrl(owner: string, repo: string, branch: string, path: string): string { return `https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`; }