1/* 2 * WebMCP â expose Gatehills site tools to in-browser AI agents. 3 * https://webmachinelearning.github.io/webmcp/ 4 * 5 * Include on the API / homepage: 6 * <script src="/assets/webmcp-gatehills.js" defer></script> 7 * 8 * Feature-detects navigator.modelContext; no-ops in browsers without WebMCP. 9 */ 10(function () { 11 "use strict"; 12 13 if (!("modelContext" in navigator) || typeof navigator.modelContext.provideContext !== "function") { 14 return; // WebMCP not supported â nothing to do. 15 } 16 17 var API = "https://api.gatehills.com/registrar/"; 18 19 navigator.modelContext.provideContext({ 20 tools: [ 21 { 22 name: "check_domain_availability", 23 description: "Check whether a domain name is available to register with Gatehills (700+ TLDs).", 24 inputSchema: { 25 type: "object", 26 required: ["domain"], 27 properties: { 28 domain: { type: "string", description: "Fully qualified domain name, e.g. example.ae" } 29 } 30 }, 31 async execute(input) { 32 var res = await fetch(API + "/domains/availability?domain=" + encodeURIComponent(input.domain)); 33 var data = await res.json(); 34 return { 35 content: [{ type: "text", text: JSON.stringify(data) }] 36 }; 37 } 38 }, 39 { 40 name: "get_tld_pricing", 41 description: "Get transparent register/renew/transfer pricing for a TLD. The price you see is the price you pay.", 42 inputSchema: { 43 type: "object", 44 required: ["tld"], 45 properties: {
46 tld: { type: "string", description: "TLD without the dot, e.g. ae, io, com" } 47 } 48 }, 49 async execute(input) { 50 var res = await fetch(API + "/tlds/pricing?tld=" + encodeURIComponent(input.tld)); 51 var data = await res.json(); 52 return { content: [{ type: "text", text: JSON.stringify(data) }] }; 53 } 54 }, 55 { 56 name: "contact_api_sales", 57 description: "Open the Gatehills API sales contact form, pre-filling the described use case.", 58 inputSchema: { 59 type: "object", 60 properties: { 61 useCase: { type: "string", description: "What the user is building" } 62 } 63 }, 64 async execute(input) { 65 var url = "/contact-api"; 66 if (input && input.useCase) { 67 url += "?use_case=" + encodeURIComponent(input.useCase); 68 } 69 window.location.href = url; 70 return { content: [{ type: "text", text: "Opening the Gatehills API sales form." }] }; 71 } 72 } 73 ] 74 }); 75})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.