{
  "openapi": "3.1.1",
  "info": {
    "title": "Scale, Chord and Fretboard Finder API",
    "version": "1.0.0",
    "summary": "Notes, intervals and fretboard positions of any scale or chord — or name the chord you play.",
    "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://tonegridscalechordfinder.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Notes, intervals and fretboard positions of any scale or chord — or name the chord you play.",
        "description": "Spells a scale, mode or chord on any root with correct note names and intervals, marks every position on a guitar, 7-string, bass or ukulele neck in the tuning you choose, lists easy chord shapes and the diatonic chords of a key, or names the chord formed by a set of notes (including inversions). The same theory engine as the Fretboard tab of the Tonegrid app.\n\nMethodology:\n- Scales and chords are interval formulas (1, b3, 5, b7 …). The pitch of each note is the root plus the interval in equal-tempered semitones; its name uses the letter that matches the interval’s degree, so a third is always spelled with the third letter above the root (F major contains B♭, D♭ major contains G♭, a diminished seventh may need a double flat).\n- Fretboard positions: every fret of every string whose pitch class belongs to the formula, from standard open-string pitches of the chosen tuning. The ukulele’s standard tuning is re-entrant (the G string is the high G4).\n- Chord shapes: a four-fret window is slid up the neck to fret 15; each string is not played, open or fretted with a chord tone. A shape is kept when the sounding strings are adjacent, the lowest note is the root, every chord tone sounds (a perfect fifth may be left out of four- and five-note chords) and at most four fingers are needed, one of which may barre the lowest fret. Shapes are ranked by fret span, position, muted strings and finger count.\n- Naming a chord: every note is tried as the root against 20 chord formulas; exact pitch-class matches come first, inversions are written as slash chords (C/E) with the first note as the bass, and four-note chords may be recognised without their fifth.\n\nChord shapes are generated by rules, not taken from a chord book: they are playable for most hands but not always the fingering a teacher would choose. Enharmonic spelling follows the chosen root (pick E♭ rather than D♯ for flat keys).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "tonegrid_scale_chord_finder",
        "x-owner-app": "tonegrid",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TonegridScaleChordFinderInput"
              },
              "examples": {
                "example1": {
                  "summary": "A minor pentatonic on guitar",
                  "value": {
                    "mode": "scale",
                    "root": "A",
                    "scale": "minorPentatonic",
                    "tuning": "guitar/standard",
                    "frets": 12
                  }
                },
                "example2": {
                  "summary": "E♭ major seventh chord shapes",
                  "value": {
                    "mode": "chord",
                    "root": "E♭",
                    "chord": "maj7",
                    "tuning": "guitar/standard",
                    "frets": 12
                  }
                },
                "example3": {
                  "summary": "Name the chord E G C (first inversion)",
                  "value": {
                    "mode": "identify",
                    "notes": "E G C",
                    "tuning": "ukulele/standard",
                    "frets": 12
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TonegridScaleChordFinderResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "TonegridScaleChordFinderInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "title": "What do you want?",
            "type": "string",
            "enum": [
              "scale",
              "chord",
              "identify"
            ],
            "default": "scale"
          },
          "root": {
            "title": "Root note",
            "type": "string",
            "enum": [
              "C",
              "C♯",
              "D",
              "E♭",
              "E",
              "F",
              "F♯",
              "G",
              "A♭",
              "A",
              "B♭",
              "B"
            ],
            "default": "C"
          },
          "scale": {
            "title": "Scale or mode",
            "description": "Used when showing a scale.",
            "type": "string",
            "enum": [
              "major",
              "minor",
              "dorian",
              "phrygian",
              "lydian",
              "mixolydian",
              "locrian",
              "harmonicMinor",
              "melodicMinor",
              "pentatonic",
              "minorPentatonic",
              "blues",
              "wholeTone",
              "chromatic"
            ],
            "default": "major"
          },
          "chord": {
            "title": "Chord type",
            "description": "Used when showing a chord.",
            "type": "string",
            "enum": [
              "major",
              "minor",
              "dim",
              "aug",
              "sus2",
              "sus4",
              "power",
              "six",
              "minorSix",
              "dom7",
              "maj7",
              "min7",
              "minMaj7",
              "halfDim7",
              "dim7",
              "sevenSus4",
              "add9",
              "dom9",
              "maj9",
              "min9"
            ],
            "default": "major"
          },
          "notes": {
            "title": "Notes to name (lowest first)",
            "description": "Used when naming a chord: note names separated by spaces, the bass note first. Octave numbers are optional.",
            "type": "string",
            "maxLength": 200,
            "default": ""
          },
          "tuning": {
            "title": "Instrument and tuning",
            "type": "string",
            "enum": [
              "guitar/standard",
              "guitar/dropD",
              "guitar/halfDown",
              "guitar/dadgad",
              "guitar/openG",
              "guitar/openD",
              "guitar7/standard",
              "bass4/standard",
              "bass4/dropD",
              "bass5/standard",
              "ukulele/standard",
              "ukulele/lowG",
              "ukulele/baritone"
            ],
            "default": "guitar/standard"
          },
          "frets": {
            "title": "Frets to show",
            "type": "integer",
            "minimum": 5,
            "maximum": 24,
            "default": 12
          }
        },
        "required": []
      },
      "TonegridScaleChordFinderResult": {
        "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": [
              "mode",
              "title",
              "instrument",
              "tuning",
              "openStrings",
              "notes",
              "positions",
              "diatonic",
              "voicings",
              "input",
              "matches"
            ],
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "scale",
                  "chord",
                  "identify"
                ]
              },
              "title": {
                "type": "string"
              },
              "instrument": {
                "type": "string"
              },
              "tuning": {
                "type": "string"
              },
              "openStrings": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Open-string pitches, lowest string (as listed in the tuning) first."
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "interval",
                    "intervalName",
                    "semitones"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "interval": {
                      "type": "string",
                      "description": "Interval formula token, e.g. b3 = minor third, #4 = augmented fourth."
                    },
                    "intervalName": {
                      "type": "string"
                    },
                    "semitones": {
                      "type": "integer"
                    }
                  }
                }
              },
              "positions": {
                "type": "integer",
                "description": "Positions on the shown part of the neck that belong to the scale or chord."
              },
              "diatonic": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "degree",
                    "roman",
                    "name",
                    "triad",
                    "seventh",
                    "notes"
                  ],
                  "properties": {
                    "degree": {
                      "type": "integer"
                    },
                    "roman": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "triad": {
                      "type": "string"
                    },
                    "seventh": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "voicings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "shape",
                    "frets",
                    "notes",
                    "lowestFret",
                    "span"
                  ],
                  "properties": {
                    "shape": {
                      "type": "string",
                      "description": "Frets per string, lowest string first; x = not played."
                    },
                    "frets": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "lowestFret": {
                      "type": "integer"
                    },
                    "span": {
                      "type": "integer"
                    }
                  }
                }
              },
              "input": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "matches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "root",
                    "chord",
                    "inversion",
                    "omitsFifth"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "root": {
                      "type": "string"
                    },
                    "chord": {
                      "type": "string"
                    },
                    "inversion": {
                      "type": "boolean"
                    },
                    "omitsFifth": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}