get_embed_code
Generate HTML and React embed code to display security verification badges for registered prompts on websites.
Instructions
Generate HTML and React embed code for displaying a secure prompt badge. Use this after registering a prompt to get the code to add to your website.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| promptId | Yes | The ID of the secure prompt |
Implementation Reference
- src/index.ts:341-373 (handler)Core handler function that generates HTML embed code and React component code for displaying a secure prompt badge using the provided promptId. Returns an object with htmlCode, reactCode, and scriptUrl.function generateEmbedCode(args: { promptId: string }): { htmlCode: string; reactCode: string; scriptUrl: string; } { const scriptUrl = "https://www.hashbuilds.com/sp.js"; return { htmlCode: `<!-- HashBuilds Secure Prompt Badge --> <div data-secure-prompt-id="${args.promptId}"> <pre data-secure-prompt-content="${args.promptId}">YOUR_PROMPT_TEXT_HERE</pre> </div> <script src="${scriptUrl}" async></script>`, reactCode: `// React/Next.js Component import Script from "next/script"; export function SecurePromptBadge() { return ( <> <div data-secure-prompt-id="${args.promptId}"> <pre data-secure-prompt-content="${args.promptId}"> {/* Your prompt text here */} </pre> </div> <Script src="${scriptUrl}" strategy="lazyOnload" /> </> ); }`, scriptUrl, }; }
- src/index.ts:439-454 (registration)Tool registration in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema (promptId required).{ name: "get_embed_code", description: "Generate HTML and React embed code for displaying a secure prompt badge. " + "Use this after registering a prompt to get the code to add to your website.", inputSchema: { type: "object", properties: { promptId: { type: "string", description: "The ID of the secure prompt", }, }, required: ["promptId"], }, },
- src/index.ts:555-571 (handler)Dispatch handler in the CallToolRequestSchema switch statement. Validates the promptId argument and invokes generateEmbedCode, then returns the result as MCP content.case "get_embed_code": { const typedArgs = args as { promptId: string }; if (!typedArgs.promptId) { throw new McpError(ErrorCode.InvalidParams, "promptId is required"); } const result = generateEmbedCode(typedArgs); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }