{
  "service": "California Justice Watch REST API",
  "description": "Plain-JSON REST wrapper around the cajusticewatch MCP tools. Use this if your AI agent or tool prefers REST over MCP/JSON-RPC. Same handlers, same data.",
  "canonical_endpoint": "https://cajusticewatch.pages.dev/api/mcp",
  "openapi": "https://cajusticewatch.pages.dev/openapi.json",
  "mcp_discovery": "https://cajusticewatch.pages.dev/.well-known/mcp.json",
  "rest_usage": {
    "list_tools": "GET https://cajusticewatch.pages.dev/api/rest",
    "call_tool_get": "GET https://cajusticewatch.pages.dev/api/rest/<tool>?param=value",
    "call_tool_post": "POST https://cajusticewatch.pages.dev/api/rest/<tool>  body: { \"param\": \"value\" }"
  },
  "examples": [
    "GET https://cajusticewatch.pages.dev/api/rest/list_databases",
    "GET https://cajusticewatch.pages.dev/api/rest/search_das?query=misconduct&county=Alameda",
    "GET https://cajusticewatch.pages.dev/api/rest/top_judges?limit=10",
    "GET https://cajusticewatch.pages.dev/api/rest/search_cjp_documents?query=racial+bias&limit=3"
  ],
  "cors": "* (any origin)",
  "auth": "none (public, read-only)",
  "tools": [
    {
      "name": "search_das",
      "description": "Search the public database of California District Attorneys with documented misconduct or controversy. Returns name, county, in-office date, misconduct type, description, source URL.",
      "url": "/api/rest/search_das",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Free-text query — matched against any field"
          },
          "county": {
            "type": "string",
            "description": "Filter to a specific California county"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "minimum": 1,
            "maximum": 100
          }
        }
      }
    },
    {
      "name": "get_da",
      "description": "Get a full DA record by name (exact or close partial match).",
      "url": "/api/rest/get_da",
      "inputSchema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "DA name"
          }
        },
        "required": [
          "name"
        ]
      }
    },
    {
      "name": "search_defenders",
      "description": "Search the public database of California public defenders with documented case outcomes, failures, or systemic-context entries. Includes Bar number, county, office, score.",
      "url": "/api/rest/search_defenders",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "county": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "e.g. \"Active\", \"Suspended\""
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "minimum": 1,
            "maximum": 100
          }
        }
      }
    },
    {
      "name": "get_defender",
      "description": "Get a full defender record by Bar number id or name.",
      "url": "/api/rest/get_defender",
      "inputSchema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      }
    },
    {
      "name": "search_judges",
      "description": "Search current California judges by name and/or court type (e.g., \"superior\", \"appeal\", \"supreme\"). Returns name + court type pairs.",
      "url": "/api/rest/search_judges",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "court_type": {
            "type": "string",
            "description": "\"superior\", \"appeal\", \"supreme\", etc."
          },
          "limit": {
            "type": "integer",
            "default": 50,
            "minimum": 1,
            "maximum": 500
          }
        }
      }
    },
    {
      "name": "search_officers",
      "description": "Search the public database of California law enforcement officers with documented misconduct or decertification. Includes name, agency, basis.",
      "url": "/api/rest/search_officers",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "agency": {
            "type": "string",
            "description": "Police department or agency name"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "minimum": 1,
            "maximum": 100
          }
        }
      }
    },
    {
      "name": "get_officer",
      "description": "Get a full officer record by name (with optional agency filter for disambiguation).",
      "url": "/api/rest/get_officer",
      "inputSchema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "agency": {
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      }
    },
    {
      "name": "search_cjp",
      "description": "Search the California Commission on Judicial Performance (CJP) public-discipline records — judges censured, admonished, or removed for misconduct. Source: cjp.ca.gov public decisions.",
      "url": "/api/rest/search_cjp",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Free-text query against any field"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "minimum": 1,
            "maximum": 100
          }
        }
      }
    },
    {
      "name": "search_cjp_documents",
      "description": "Semantic search over the full text of CJP public-discipline decisions (250 PDFs ingested). Use this for topic questions (\"racial bias\", \"drug-related misconduct\", \"ex parte communications\") or when you need passages, not just summary records. Returns matching passages with citations. Distinct from search_cjp (which searches the summary-record JSON).",
      "url": "/api/rest/search_cjp_documents",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Topic or phrase to find in the decision text"
          },
          "judge": {
            "type": "string",
            "description": "Optional judge-name filter (substring match)"
          },
          "year": {
            "type": "integer",
            "description": "Optional year filter (e.g. 2020)"
          },
          "limit": {
            "type": "integer",
            "default": 5,
            "minimum": 1,
            "maximum": 20
          }
        },
        "required": [
          "query"
        ]
      }
    },
    {
      "name": "search_capost",
      "description": "Search the California POST decertification database — law enforcement officers stripped of their POST certification. Source: post.ca.gov public records.",
      "url": "/api/rest/search_capost",
      "inputSchema": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "agency": {
            "type": "string",
            "description": "Police department or agency name"
          },
          "limit": {
            "type": "integer",
            "default": 20,
            "minimum": 1,
            "maximum": 100
          }
        }
      }
    },
    {
      "name": "list_databases",
      "description": "List all public databases exposed by this MCP server with their metadata (entry counts, last updated, descriptions).",
      "url": "/api/rest/list_databases",
      "inputSchema": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "top_das",
      "description": "Return the top-N California DAs by editorial severity score (descending). Use for \"worst DA\" / \"most-disciplined DA\" / ranking questions. Optional county filter. Only manually-scored records are returned.",
      "url": "/api/rest/top_das",
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "default": 10,
            "minimum": 1,
            "maximum": 25
          },
          "county": {
            "type": "string",
            "description": "Optional county filter, e.g. \"San Mateo\""
          }
        }
      }
    },
    {
      "name": "top_judges",
      "description": "Return the top-N California judges by CJP discipline severity (removal > censure > admonishment, descending). Use for \"worst judge\" / \"most-disciplined judge\" / ranking questions.",
      "url": "/api/rest/top_judges",
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "default": 10,
            "minimum": 1,
            "maximum": 25
          }
        }
      }
    },
    {
      "name": "top_officers",
      "description": "Return the top-N California law enforcement officers by editorial severity score (descending). Use for \"worst officer\" / \"most-disciplined officer\" / ranking questions. Optional agency filter.",
      "url": "/api/rest/top_officers",
      "inputSchema": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer",
            "default": 10,
            "minimum": 1,
            "maximum": 25
          },
          "agency": {
            "type": "string",
            "description": "Optional agency filter, e.g. \"Riverside County Sheriff\""
          }
        }
      }
    },
    {
      "name": "list_pages",
      "description": "Return the canonical list of pages on cajusticewatch.com — slug, URL, label, and purpose. Use this when the user asks about features/pages/tools of the site, OR when you need to recommend a page, OR before saying \"I do not have access to X\" — the page may actually exist.",
      "url": "/api/rest/list_pages",
      "inputSchema": {
        "type": "object",
        "properties": {}
      }
    }
  ]
}