copilot_buttons_from_raw
Create VS Code install buttons for raw URLs to chat instructions, prompts, or modes. Simplify embedding and sharing custom configurations directly in VS Code.
Instructions
Generate VS Code install buttons for a raw URL to chat instructions, prompts, or chat modes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Install kind | |
| url | Yes | Raw GitHub URL or any public raw URL to the file. |
Implementation Reference
- src/index.ts:150-164 (registration)Registration of the 'copilot_buttons_from_raw' MCP tool, including title, description, input schema, and inline handler function.server.registerTool( "copilot_buttons_from_raw", { title: "Copilot install buttons (raw URL)", description: "Generate VS Code install buttons for a raw URL to chat instructions, prompts, or chat modes.", inputSchema: { kind: z.enum(["chat-instructions", "chat-prompt", "chat-mode"]).describe("Install kind"), url: z.string().url().describe("Raw GitHub URL or any public raw URL to the file."), } }, async ({ kind, url }) => { const markdown = generateCopilotInstallButtons(kind, url); return { content: [{ type: "text", text: markdown }] }; } );
- src/index.ts:160-163 (handler)The handler function for the tool, which invokes generateCopilotInstallButtons to produce markdown and returns it as text content.async ({ kind, url }) => { const markdown = generateCopilotInstallButtons(kind, url); return { content: [{ type: "text", text: markdown }] }; }
- src/index.ts:155-158 (schema)Zod input schema defining 'kind' (enum) and 'url' (string URL) parameters.inputSchema: { kind: z.enum(["chat-instructions", "chat-prompt", "chat-mode"]).describe("Install kind"), url: z.string().url().describe("Raw GitHub URL or any public raw URL to the file."), }
- src/lib/buttons.ts:78-86 (helper)Main helper function that generates the markdown for VS Code stable and insiders install buttons using badges and links.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}`; }
- src/lib/buttons.ts:69-76 (helper)Helper function to build the install link URL for Copilot-style buttons.function buildCopilotInstallLink(kind: CopilotInstallKind, rawUrl: string, insiders = false) { const scheme = insiders ? 'vscode-insiders' : 'vscode'; const host = insiders ? 'https://insiders.vscode.dev/redirect' : 'https://vscode.dev/redirect'; // Encode the prefix and the raw URL separately so inner % are not double-encoded const prefix = encodeURIComponent(`${scheme}:${kind}/install?url=`); const raw = encodeURIComponent(rawUrl); return `${host}?url=${prefix}${raw}`; }