/Template Library
WebMCP Templates
🏪

Local Business

WEBMCP

Perfect for handymen, contractors, restaurants, salons, and any local service business.

HandymanRestaurantSalonContractor
Tools:get_business_info()get_hours()book_appointment()get_services()get_location()
// WebMCP Template: Local Business
// Drop in your business details and deploy.
// Works with: Handyman, Restaurant, Salon, Contractor, etc.

const businessData = {
  name: "PD Handy LLC",
  tagline: "Professional Handyman Services",
  phone: "(555) 123-4567",
  email: "[email protected]",
  address: "Your City, ST",
  hours: {
    monday: "8:00 AM - 6:00 PM",
    tuesday: "8:00 AM - 6:00 PM",
    wednesday: "8:00 AM - 6:00 PM",
    thursday: "8:00 AM - 6:00 PM",
    friday: "8:00 AM - 6:00 PM",
    saturday: "9:00 AM - 4:00 PM",
    sunday: "Closed"
  },
  services: [
    { name: "General Repairs", price: "From $75/hr", duration: "1-4 hours" },
    { name: "Painting", price: "From $200", duration: "Half day+" },
    { name: "Plumbing", price: "From $95/hr", duration: "1-3 hours" },
    { name: "Electrical", price: "From $95/hr", duration: "1-3 hours" },
    { name: "Flooring", price: "From $3/sqft", duration: "1-3 days" }
  ],
  bookingUrl: "https://yoursite.com/book"
};

// WebMCP Tool Definitions
const tools = [
  {
    name: "get_business_info",
    description: `Get information about ${businessData.name}. Returns contact details, location, and overview.`,
    handler: () => ({
      name: businessData.name,
      tagline: businessData.tagline,
      phone: businessData.phone,
      email: businessData.email,
      address: businessData.address,
      bookingUrl: businessData.bookingUrl
    })
  },
  {
    name: "get_hours",
    description: "Get the current business hours and check if the business is open right now.",
    handler: () => {
      const days = ["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];
      const today = days[new Date().getDay()];
      return {
        hours: businessData.hours,
        today: today,
        todayHours: businessData.hours[today],
        isOpen: businessData.hours[today] !== "Closed"
      };
    }
  },
  {
    name: "get_services",
    description: "Get a list of all services offered with pricing and estimated duration.",
    handler: () => ({ services: businessData.services })
  },
  {
    name: "book_appointment",
    description: "Direct the user to book an appointment. Returns the booking URL.",
    handler: () => ({
      bookingUrl: businessData.bookingUrl,
      message: `Book your appointment at ${businessData.bookingUrl}`,
      phone: businessData.phone
    })
  }
];

// Register all tools with WebMCP
if (typeof navigator !== "undefined" && navigator.modelContext) {
  tools.forEach(tool => {
    navigator.modelContext.registerTool(
      tool.name,
      tool.description,
      { type: "object", properties: {} },
      tool.handler
    );
  });
  console.log(`[WebMCP] ${tools.length} tools registered for ${businessData.name}`);
}

export default tools;