{
  "openapi": "3.1.0",
  "info": {
    "title": "AltruBiz Public Tools",
    "version": "1.0.0",
    "description": "Public knowledge search and ROI estimates only. No CRM access, personal records, messaging, checkout or authentication."
  },
  "servers": [
    {
      "url": "https://altrubiz.co.il"
    }
  ],
  "security": [],
  "paths": {
    "/api/public-tools": {
      "post": {
        "operationId": "executePublicTool",
        "summary": "Search public knowledge or calculate an ROI estimate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "name",
                      "arguments"
                    ],
                    "properties": {
                      "name": {
                        "const": "calculate_roi"
                      },
                      "arguments": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "leadsPerMonth",
                          "avgDealValue",
                          "closeRatePercent",
                          "hoursSpentPerMonth",
                          "hourlyCost",
                          "targetUpliftPercent"
                        ],
                        "properties": {
                          "leadsPerMonth": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1000000
                          },
                          "avgDealValue": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100000000
                          },
                          "closeRatePercent": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100
                          },
                          "hoursSpentPerMonth": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 744
                          },
                          "hourlyCost": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1000000
                          },
                          "targetUpliftPercent": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 100
                          }
                        }
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "name",
                      "arguments"
                    ],
                    "properties": {
                      "name": {
                        "const": "search_public_knowledge"
                      },
                      "arguments": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "query"
                        ],
                        "properties": {
                          "query": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool result",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "revenueAtRisk": {
                          "type": "number"
                        },
                        "upliftValue": {
                          "type": "number"
                        },
                        "timeSavingsValue": {
                          "type": "number"
                        },
                        "combinedPotentialValue": {
                          "type": "number"
                        },
                        "annualPotentialValue": {
                          "type": "number"
                        },
                        "currency": {
                          "type": "string",
                          "enum": [
                            "ILS"
                          ]
                        },
                        "disclaimer": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "revenueAtRisk",
                        "upliftValue",
                        "timeSavingsValue",
                        "combinedPotentialValue",
                        "annualPotentialValue",
                        "currency",
                        "disclaimer"
                      ]
                    },
                    {
                      "type": "object",
                      "required": [
                        "results"
                      ],
                      "properties": {
                        "results": {
                          "type": "array",
                          "maxItems": 5,
                          "items": {
                            "type": "object",
                            "required": [
                              "title",
                              "description",
                              "url",
                              "score"
                            ],
                            "properties": {
                              "title": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "format": "uri"
                              },
                              "score": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid tool name or input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Origin not allowed"
          },
          "405": {
            "description": "Method not allowed"
          },
          "429": {
            "description": "Instance-local rate limit, 60 requests per IP per minute",
            "headers": {
              "Retry-After": {
                "description": "Seconds until retry",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        }
      }
    }
  }
}
