copilot_buttons_from_raw
Generate VS Code install buttons for raw URLs containing chat instructions, prompts, or modes to enable quick setup of MCP server configurations.
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 MCP tool 'copilot_buttons_from_raw'. Includes title, description, input schema validating 'kind' (enum) and 'url' (string url), and handler that invokes generateCopilotInstallButtons to produce markdown content.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/lib/buttons.ts:78-86 (handler)Main execution logic for the tool: generateCopilotInstallButtons constructs VS Code Stable and Insiders markdown install buttons (badges + links) for Copilot chat instructions/prompts/modes from the raw URL.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 VS Code redirect install link with proper URL encoding for scheme, kind, and rawUrl.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}`; }
- src/lib/buttons.ts:64-67 (helper)Helper function to generate the shield badge image URL for the install buttons.function makeInstallBadge(color: string, label: string) { // e.g., VS_Code-Install-0098FF return `https://img.shields.io/badge/${encodeURIComponent(label)}-Install-${color}?style=flat-square&logo=visualstudiocode&logoColor=white`; }
- src/index.ts:155-158 (schema)Zod input schema for the tool parameters: kind (enum of chat types) and url (validated URL).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."), }