{
  "openapi": "3.1.0",
  "info": {
    "title": "WeRepairSubZero agent API",
    "version": "1.0.0",
    "description": "Sub-Zero repair requests in the Houston area. Requests are accepted immediately; tell the customer the company may call or text about the request, no need to wait for a reply."
  },
  "servers": [
    {
      "url": "https://werepairsubzero-booking.werepairsubzero.workers.dev"
    }
  ],
  "paths": {
    "/agent": {
      "get": {
        "operationId": "listTools",
        "summary": "Describe the available tools and contact terms",
        "responses": {
          "200": {
            "description": "Tool list"
          }
        }
      },
      "post": {
        "operationId": "runTool",
        "summary": "Run one tool",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "title": "check_service_area",
                    "required": [
                      "tool"
                    ],
                    "properties": {
                      "tool": {
                        "type": "string",
                        "enum": [
                          "check_service_area"
                        ],
                        "description": "Check whether a ZIP code is in the listed Houston-area service ZIP codes."
                      },
                      "arguments": {
                        "type": "object",
                        "properties": {
                          "zip": {
                            "type": "string",
                            "description": "5-digit ZIP code"
                          }
                        },
                        "required": [
                          "zip"
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "title": "get_pricing",
                    "required": [
                      "tool"
                    ],
                    "properties": {
                      "tool": {
                        "type": "string",
                        "enum": [
                          "get_pricing"
                        ],
                        "description": "Published starting prices and warranty."
                      },
                      "arguments": {
                        "type": "object",
                        "properties": {}
                      }
                    }
                  },
                  {
                    "type": "object",
                    "title": "request_repair",
                    "required": [
                      "tool"
                    ],
                    "properties": {
                      "tool": {
                        "type": "string",
                        "enum": [
                          "request_repair"
                        ],
                        "description": "Ask for a Sub-Zero repair visit. This is a request, not a confirmed appointment: staff call to confirm."
                      },
                      "arguments": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Customer's full name"
                          },
                          "phone": {
                            "type": "string",
                            "description": "US phone number, 10 digits"
                          },
                          "issue": {
                            "type": "string",
                            "description": "What is wrong, with the Sub-Zero model or error code if known (10-800 characters)"
                          },
                          "address": {
                            "type": "string",
                            "description": "Street address and city"
                          },
                          "zip": {
                            "type": "string",
                            "description": "5-digit ZIP code"
                          },
                          "date": {
                            "type": "string",
                            "description": "Preferred date, YYYY-MM-DD, Monday to Saturday, today or later (Houston time)"
                          },
                          "time_window": {
                            "type": "string",
                            "enum": [
                              "morning",
                              "afternoon",
                              "late_afternoon"
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "phone",
                          "address",
                          "zip",
                          "issue",
                          "date",
                          "time_window"
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "title": "request_callback",
                    "required": [
                      "tool"
                    ],
                    "properties": {
                      "tool": {
                        "type": "string",
                        "enum": [
                          "request_callback"
                        ],
                        "description": "Ask for a phone call back, for questions or when details are not known yet."
                      },
                      "arguments": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Customer's full name"
                          },
                          "phone": {
                            "type": "string",
                            "description": "US phone number, 10 digits"
                          },
                          "issue": {
                            "type": "string",
                            "description": "What is wrong, with the Sub-Zero model or error code if known (10-800 characters)"
                          }
                        },
                        "required": [
                          "name",
                          "phone",
                          "issue"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result"
          },
          "400": {
            "description": "Invalid input"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    }
  }
}
