get_embed_code
Generate HTML and React embed code to display a secure prompt verification badge on your website after registering a prompt for security checks.
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:555-571 (handler)Handler for the 'get_embed_code' tool call. Validates the promptId argument and invokes generateEmbedCode to produce the embed code, returning it as text 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), }, ], }; }
- src/index.ts:341-373 (helper)Core helper function that generates HTML and React embed code snippets for displaying the secure prompt badge using the provided promptId.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)Registration of the 'get_embed_code' tool in the listTools response, including name, description, and input schema.{ 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:444-453 (schema)Input schema definition for the 'get_embed_code' tool, specifying the required promptId parameter.inputSchema: { type: "object", properties: { promptId: { type: "string", description: "The ID of the secure prompt", }, }, required: ["promptId"], },