{
  "openapi": "3.1.1",
  "info": {
    "title": "Skillgrove Lesson Search API",
    "version": "1.0.0",
    "summary": "Find free lessons on plants, crafts, code, electronics, chemistry, physics and money.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://skillgrovelessonsearch.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Find free lessons on plants, crafts, code, electronics, chemistry, physics and money.",
        "description": "Searches the Skillgrove lessons — titles, learning objectives, key points and flashcards — by words, subject and tier (basic, intermediate, expert) and returns the matching lessons with their links, minutes and objectives.\n\nMethodology:\n- Every query word must appear in a lesson (words of 3+ letters also match as the start of a longer word); accents and case are ignored.\n- Ranking: a match in the title weighs 5, in objectives or key points 3, in the description or flashcards 2, in the subject or module name 1; ties keep the course order.\n- Only English lesson texts are searched; translated lessons share the same links.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "skillgrove_lesson_search",
        "x-owner-app": "skillgrove",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SkillgroveLessonSearchInput"
              },
              "examples": {
                "example1": {
                  "summary": "Ohm's law",
                  "value": {
                    "query": "Ohm's law"
                  }
                },
                "example2": {
                  "summary": "Basic electronics lessons",
                  "value": {
                    "query": "",
                    "subject": "electronics",
                    "tier": "basic"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SkillgroveLessonSearchResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "SkillgroveLessonSearchInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "query": {
            "title": "Search words",
            "description": "For example: LED resistor, compound interest, soil pH, recursion.",
            "type": "string",
            "maxLength": 200,
            "default": "Ohm's law"
          },
          "subject": {
            "title": "Subject",
            "type": "string",
            "enum": [
              "",
              "plants",
              "craftsmanship",
              "programming",
              "electronics",
              "chemistry",
              "physics",
              "finance",
              "business"
            ],
            "default": ""
          },
          "tier": {
            "title": "Tier",
            "type": "string",
            "enum": [
              "",
              "basic",
              "intermediate",
              "expert"
            ],
            "default": ""
          },
          "limit": {
            "title": "Results",
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "default": 10
          }
        },
        "required": []
      },
      "SkillgroveLessonSearchResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "count",
              "lessons"
            ],
            "properties": {
              "count": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "lessons": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}