{
  "edit": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "filePath": {
        "description": "Path to the file to edit (absolute or relative to project root)",
        "type": "string"
      },
      "oldString": {
        "description": "Text to find (exact match, with fuzzy fallback)",
        "type": "string"
      },
      "newString": {
        "description": "Text to replace with (omit or set to empty string to delete the matched text)",
        "type": "string"
      },
      "replaceAll": {
        "description": "Replace all occurrences",
        "type": "boolean"
      },
      "occurrence": {
        "description": "0-indexed occurrence to replace when multiple matches exist",
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "symbol": {
        "description": "Named symbol to replace (function, class, type)",
        "type": "string"
      },
      "content": {
        "description": "Replacement content for symbol mode. For whole-file writes, use the `write` tool.",
        "type": "string"
      },
      "appendContent": {
        "description": "Text to append to the end of filePath; creates the file if needed",
        "type": "string"
      },
      "edits": {
        "description": "Batch edits — array of { oldString: string, newString: string } or { startLine: number (1-based), endLine: number (1-based, inclusive), content: string }",
        "type": "array",
        "items": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        }
      }
    }
  },
  "grep": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "pattern": {
        "type": "string"
      },
      "include": {
        "type": "string"
      },
      "path": {
        "type": "string"
      }
    },
    "required": [
      "pattern"
    ]
  },
  "inspect": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "sections": {
        "description": "Categories to include in detailed drill-down (e.g. 'todos' or ['todos', 'dead_code']). Use 'all' for every active category. Omit for summary-only mode.",
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "scope": {
        "description": "Restrict scan/results to paths under this scope (file or directory, absolute or relative to project root). Tier 1 scopes the scan; Tier 2 scans project-wide and applies scope as a result filter.",
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "topK": {
        "description": "Max drill-down items per category. Default 20, max 100.",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 100
      }
    }
  },
  "outline": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "target": {
        "description": "What to outline: a file path, directory path, URL, or array of paths. The mode is auto-detected: URLs by `http://`/`https://` prefix, directories by stat, arrays as multi-file.",
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "files": {
        "description": "Directory-only mode: when true, target must be a directory or array of directories and the result is a flat file tree with path, language, symbol count, and byte size instead of a symbol outline.",
        "type": "boolean"
      },
      "includeTests": {
        "description": "Directory outline only: include test files. Defaults to false; tests are hidden.",
        "type": "boolean"
      }
    },
    "required": [
      "target"
    ]
  },
  "read": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "filePath": {
        "description": "Path to file or directory (absolute or relative to project root)",
        "type": "string"
      },
      "startLine": {
        "description": "1-based line to start reading from",
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "endLine": {
        "description": "1-based line to stop reading at (inclusive)",
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "limit": {
        "description": "Max lines to return (default: 2000)",
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "offset": {
        "description": "1-based line number to start reading from (use with limit). Ignored if startLine is provided",
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      }
    },
    "required": [
      "filePath"
    ]
  },
  "search": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "query": {
        "description": "Concept, regex, literal text, filename, or capability to find. Examples: 'fuzzy match with whitespace tolerance', '^export', 'Cargo.lock'.",
        "type": "string"
      },
      "topK": {
        "description": "Number of results (default: 10, max: 100)",
        "type": "integer",
        "minimum": 1,
        "maximum": 100
      },
      "hint": {
        "description": "Optional routing hint. Defaults to 'auto'.",
        "type": "string",
        "enum": [
          "regex",
          "literal",
          "semantic",
          "auto"
        ]
      },
      "includeTests": {
        "description": "Include test files (*.test.*, *_test.rs, __tests__/, …) plus test-support, fixture, mock, snapshot, and corpus files. Defaults to false.",
        "type": "boolean"
      }
    },
    "required": [
      "query"
    ]
  },
  "status": {
    "type": "object",
    "properties": {},
    "additionalProperties": false
  },
  "write": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "filePath": {
        "description": "Path to the file to write (absolute or relative to project root)",
        "type": "string"
      },
      "content": {
        "description": "The full content to write to the file",
        "type": "string"
      }
    },
    "required": [
      "filePath",
      "content"
    ]
  }
}
