{
  "openapi": "3.1.1",
  "info": {
    "title": "Companion Planting Checker API",
    "version": "1.0.0",
    "summary": "Check which of your plants go well together, which to keep apart, and why.",
    "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://greenplotcompanioncheck.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Check which of your plants go well together, which to keep apart, and why.",
        "description": "Checks every pair in a list of up to 40 vegetables, herbs, fruit and flowers for companions and antagonists. Each pair says why — a plain reason such as shared blight or shade, or gardening tradition with weak evidence — and same-family neighbours that share soil pests are listed too.\n\nMethodology:\n- The pair table is our own compilation: Hearth’s twelve traditional pairs plus about sixty more for Greenplot’s library of vegetables, herbs, fruit and flowers. Every pair is either good (grow together) or bad (keep apart).\n- Each pair carries its reason and an evidence label. “Practical” means a plain mechanism: the same disease (late blight on potatoes and tomatoes, verticillium wilt on potatoes and raspberries), shade or competition, a quick crop that is cleared before its neighbour needs the space, pollinators, support for climbers. “Tradition” means gardening lore with weak or no trial evidence; it is shown, never promised.\n- Every pair inside your list is looked up once. The score adds 1 per practical good pair and 0.5 per traditional one, and subtracts the same for bad pairs; the verdict is “conflicts” when any practical bad pair is present.\n- Same-family neighbours are listed for the families that share soil pests and diseases (potato family, cabbage family, onion family, carrot family, legumes, cucurbits): they are fine together in one season but should move on together in the rotation.\n\nCompanion planting is mostly tradition. Spacing, light, water and rotation matter far more than neighbours.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "greenplot_companion_check",
        "x-owner-app": "greenplot",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GreenplotCompanionCheckInput"
              },
              "examples": {
                "example1": {
                  "summary": "Tomato bed with potatoes nearby",
                  "value": {
                    "plants": [
                      "tomato",
                      "basil",
                      "potato",
                      "carrot",
                      "onion",
                      "bush-bean"
                    ]
                  }
                },
                "example2": {
                  "summary": "Three sisters with sunflowers",
                  "value": {
                    "plants": [
                      "sweetcorn",
                      "pole-bean",
                      "squash",
                      "sunflower",
                      "nasturtium"
                    ]
                  }
                },
                "example3": {
                  "summary": "Herb spiral",
                  "value": {
                    "plants": [
                      "rosemary",
                      "sage",
                      "thyme",
                      "lavender",
                      "mint",
                      "parsley",
                      "chives"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GreenplotCompanionCheckResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "GreenplotCompanionCheckInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "plants": {
            "title": "Plants",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "tomato",
                "pepper",
                "eggplant",
                "potato",
                "cucumber",
                "zucchini",
                "squash",
                "melon",
                "sweetcorn",
                "bush-bean",
                "pole-bean",
                "pea",
                "broad-bean",
                "lettuce",
                "spinach",
                "chard",
                "beet",
                "carrot",
                "parsnip",
                "radish",
                "turnip",
                "onion",
                "spring-onion",
                "garlic",
                "leek",
                "cabbage",
                "broccoli",
                "cauliflower",
                "kale",
                "brussels-sprouts",
                "kohlrabi",
                "pak-choi",
                "rocket",
                "celery",
                "fennel",
                "parsley",
                "basil",
                "dill",
                "coriander",
                "chives",
                "asparagus",
                "rhubarb",
                "artichoke",
                "jerusalem-artichoke",
                "sweet-potato",
                "okra",
                "celeriac",
                "swede",
                "endive",
                "chicory",
                "mizuna",
                "corn-salad",
                "shallot",
                "chilli",
                "mangetout",
                "chinese-cabbage",
                "horseradish",
                "cress",
                "mustard-greens",
                "soybean",
                "tomatillo",
                "watermelon",
                "rosemary",
                "thyme",
                "sage",
                "oregano",
                "mint",
                "lavender",
                "tarragon",
                "lemon-balm",
                "lovage",
                "sorrel",
                "bay",
                "marjoram",
                "chamomile",
                "borage",
                "chervil",
                "summer-savory",
                "strawberry",
                "raspberry",
                "autumn-raspberry",
                "blackberry",
                "blueberry",
                "gooseberry",
                "redcurrant",
                "blackcurrant",
                "apple",
                "pear",
                "plum",
                "cherry",
                "peach",
                "apricot",
                "quince",
                "fig",
                "grape",
                "kiwi",
                "physalis",
                "sunflower",
                "french-marigold",
                "calendula",
                "nasturtium",
                "sweet-pea",
                "cosmos",
                "zinnia",
                "cornflower",
                "poppy",
                "nigella",
                "phacelia",
                "crimson-clover",
                "dahlia",
                "tulip",
                "daffodil",
                "snapdragon",
                "alyssum",
                "larkspur",
                "gladiolus",
                "echinacea",
                "rudbeckia",
                "lupin",
                "hollyhock",
                "verbena",
                "sweet-william"
              ]
            },
            "default": [
              "tomato",
              "basil",
              "potato",
              "carrot",
              "onion",
              "bush-bean"
            ]
          }
        },
        "required": []
      },
      "GreenplotCompanionCheckResult": {
        "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",
            "additionalProperties": false,
            "required": [
              "plants",
              "good",
              "bad",
              "sameFamily",
              "neutralPairs",
              "score",
              "verdict",
              "perPlant"
            ],
            "properties": {
              "plants": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "good": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "a",
                    "b",
                    "kind",
                    "evidence",
                    "note"
                  ],
                  "properties": {
                    "a": {
                      "type": "string"
                    },
                    "b": {
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "good",
                        "bad"
                      ]
                    },
                    "evidence": {
                      "enum": [
                        "practical",
                        "tradition"
                      ]
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              },
              "bad": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "a",
                    "b",
                    "kind",
                    "evidence",
                    "note"
                  ],
                  "properties": {
                    "a": {
                      "type": "string"
                    },
                    "b": {
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "good",
                        "bad"
                      ]
                    },
                    "evidence": {
                      "enum": [
                        "practical",
                        "tradition"
                      ]
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              },
              "sameFamily": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "family",
                    "plants"
                  ],
                  "properties": {
                    "family": {
                      "type": "string"
                    },
                    "plants": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "neutralPairs": {
                "type": "integer"
              },
              "score": {
                "type": "number"
              },
              "verdict": {
                "enum": [
                  "conflicts",
                  "tradition-conflicts",
                  "good",
                  "neutral"
                ]
              },
              "perPlant": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "plant",
                    "family",
                    "group",
                    "goodOutside"
                  ],
                  "properties": {
                    "plant": {
                      "type": "string"
                    },
                    "family": {
                      "type": "string"
                    },
                    "group": {
                      "type": "string"
                    },
                    "goodOutside": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}