{
  "openapi": "3.1.0",
  "info": {
    "title": "Galore site API",
    "version": "1.0.0",
    "summary": "Search and read Galore's public website and developer docs. Read-only, no sign-in.",
    "description": "Galore checks every AI trade against the rules a person sets once, before it reaches their brokerage. This API serves only the public pages of trygalore.com: search them, list them and read any one as Markdown. It holds no account, trading or personal data. To check and send trades, use the Galore trading API at https://connect.trygalore.com (OpenAPI: https://connect.trygalore.com/connect/openapi.json, MCP: https://connect.trygalore.com/mcp).",
    "contact": {
      "name": "Galore",
      "email": "hello@trygalore.com",
      "url": "https://trygalore.com/contact"
    },
    "termsOfService": "https://trygalore.com/terms"
  },
  "servers": [
    {
      "url": "https://trygalore.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Galore API docs",
    "url": "https://trygalore.com/developers"
  },
  "tags": [
    {
      "name": "Search",
      "description": "Find the part of the site that answers a question."
    },
    {
      "name": "Pages",
      "description": "List and read public pages."
    },
    {
      "name": "MCP",
      "description": "The same tools over the Model Context Protocol."
    }
  ],
  "paths": {
    "/ask": {
      "get": {
        "operationId": "searchGaloreSite",
        "tags": [
          "Search"
        ],
        "summary": "Search the Galore website",
        "description": "Returns the page sections that best answer a question, quoted from the site, with links to each page and its Markdown copy. Without q, returns how to use this API.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "The question or words to search for, for example \"what does Night Stop cost\". Without it, the reply says how to use this API.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many sections to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching sections, best first. Without q, how to use this API.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SearchResponse"
                    },
                    {
                      "type": "object",
                      "description": "How to use this API."
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Only GET and HEAD are allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ask/pages": {
      "get": {
        "operationId": "listGaloreSitePages",
        "tags": [
          "Pages"
        ],
        "summary": "List every public Galore page",
        "description": "Every public page with its URL, Markdown URL and one-line description.",
        "responses": {
          "200": {
            "description": "All public pages.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PageList"
                }
              }
            }
          },
          "405": {
            "description": "Only GET and HEAD are allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ask/page": {
      "get": {
        "operationId": "getGaloreSitePage",
        "tags": [
          "Pages"
        ],
        "summary": "Read one Galore page as Markdown",
        "description": "Returns a whole public page as Markdown. Pass its path or full URL.",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": true,
            "description": "Path or URL of the page, for example \"/night-stop\" or \"https://trygalore.com/developers\".",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The page.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          },
          "400": {
            "description": "path is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No public page at that address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Only GET and HEAD are allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "callGaloreSiteMcp",
        "tags": [
          "MCP"
        ],
        "summary": "MCP server for the Galore website",
        "description": "A read-only MCP server (Streamable HTTP, JSON responses, no sign-in) with the tools search_galore, read_galore_page and list_galore_pages. Send JSON-RPC 2.0 messages: initialize, tools/list, tools/call.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The JSON-RPC reply, or an array of replies for a batch.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/JsonRpcResponse"
                    },
                    {
                      "type": "array",
                      "maxItems": 20,
                      "items": {
                        "$ref": "#/components/schemas/JsonRpcResponse"
                      }
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "A notification was accepted. No body."
          },
          "400": {
            "description": "The body is not JSON. Returned as a JSON-RPC parse error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          },
          "405": {
            "description": "Only POST is allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The body is over 64 KB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Every error is JSON. error is a sentence for people; code is stable for programs.",
        "required": [
          "error",
          "code",
          "status"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "What went wrong, in plain words."
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable code, for example bad_request, page_not_found, not_found, method_not_allowed, payload_too_large or rate_limited."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status, repeated."
          },
          "hint": {
            "type": "string",
            "description": "How to fix the request."
          },
          "docs": {
            "type": "string",
            "format": "uri",
            "description": "Where this API is described."
          }
        }
      },
      "SearchResult": {
        "type": "object",
        "required": [
          "title",
          "url",
          "markdown_url",
          "text",
          "score"
        ],
        "properties": {
          "title": {
            "type": "string",
            "description": "Page title."
          },
          "section": {
            "type": [
              "string",
              "null"
            ],
            "description": "Heading of the matching section."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The page."
          },
          "markdown_url": {
            "type": "string",
            "format": "uri",
            "description": "The page as Markdown."
          },
          "text": {
            "type": "string",
            "description": "The section, quoted from the page (up to 1,500 characters)."
          },
          "score": {
            "type": "number",
            "description": "Relevance. Higher is better."
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "query",
          "results",
          "note"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          },
          "note": {
            "type": "string",
            "description": "What to do next."
          }
        }
      },
      "PageSummary": {
        "type": "object",
        "required": [
          "title",
          "url",
          "markdown_url",
          "description"
        ],
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdown_url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "PageList": {
        "type": "object",
        "required": [
          "pages"
        ],
        "properties": {
          "pages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PageSummary"
            }
          }
        }
      },
      "Page": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PageSummary"
          },
          {
            "type": "object",
            "required": [
              "markdown"
            ],
            "properties": {
              "markdown": {
                "type": "string",
                "description": "The whole page as Markdown."
              }
            }
          }
        ]
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer"
            ],
            "description": "Omit for a notification."
          },
          "method": {
            "type": "string",
            "enum": [
              "initialize",
              "ping",
              "tools/list",
              "tools/call",
              "resources/list",
              "prompts/list",
              "notifications/initialized"
            ]
          },
          "params": {
            "type": "object",
            "description": "For tools/call: { name, arguments }."
          }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": [
          "jsonrpc"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "const": "2.0"
          },
          "id": {
            "type": [
              "string",
              "integer",
              "null"
            ]
          },
          "result": {
            "type": "object"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
