Skip to main content
Glama
jphyqr

HashBuilds Secure Prompts

by jphyqr

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
NameRequiredDescriptionDefault
promptIdYesThe ID of the secure prompt

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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"],
      },
    },
  • 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"],
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jphyqr/secure-prompts-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server