{
  "openapi": "3.1.0",
  "info": {
    "title": "Toofi Agent API",
    "version": "2026-05-11",
    "summary": "Agent-native dental planning workspace public API",
    "description": "Toofi is the first agent-native dental planning workspace. Clinical AI agents call Toofi to generate treatment-plan drafts, patient-facing presentations, and price estimates from clinical inputs - with mandatory dentist approval before clinical use. MCP server, OAuth 2.1 with mandate scoping, signed audit trail, and C2PA-provenanced outputs.",
    "x-safety-boundary": "Toofi public agent endpoints are no-PHI. Clinical outputs are drafts and require licensed dentist approval before use.",
    "x-agent-native-positioning": "Visible discovery surface first: live no-PHI lookup plus clinic-scoped agent workflow contracts.",
    "x-provenance": {
      "signed_audit_trail": true,
      "c2pa_outputs": true
    }
  },
  "servers": [
    {
      "url": "https://toofi.app"
    }
  ],
  "paths": {
    "/mcp": {
      "post": {
        "operationId": "toofi_mcp_streamable_http",
        "summary": "Toofi MCP Streamable HTTP endpoint",
        "description": "JSON-RPC 2.0 MCP endpoint for initialize, tools/list, and tools/call. Agents use this endpoint to discover Toofi tools, generate demo treatment-plan drafts, inspect clinic workflow contracts, and negotiate internal-credit payment rails.",
        "x-ai-description": "Connect here as a Model Context Protocol client. Call initialize, then tools/list, then tools/call.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "const": "2.0"
                  },
                  "id": {
                    "type": [
                      "string",
                      "number",
                      "null"
                    ]
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "initialize",
                      "notifications/initialized",
                      "ping",
                      "tools/list",
                      "tools/call"
                    ]
                  },
                  "params": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "MCP JSON-RPC response"
          },
          "202": {
            "description": "MCP notification accepted"
          },
          "400": {
            "description": "JSON-RPC parse or request error"
          },
          "405": {
            "description": "Use POST for stateless MCP Streamable HTTP"
          }
        }
      }
    },
    "/api/agent/capabilities": {
      "get": {
        "operationId": "discover_capabilities",
        "summary": "Discover Toofi agent capabilities",
        "description": "Returns the public no-PHI agent capability map, endpoint list, safety boundary, and machine-readable links.",
        "x-ai-description": "Use this operation first to discover live and private-integration Toofi agent capabilities.",
        "responses": {
          "200": {
            "description": "Capability map",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilitiesResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "discover_capabilities_post",
        "summary": "Discover Toofi agent capabilities",
        "description": "POST variant for agent runtimes that prefer command-style invocations.",
        "x-ai-description": "Use this operation first if your runtime calls tools through POST only.",
        "responses": {
          "200": {
            "description": "Capability map",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapabilitiesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/dental-procedures/lookup": {
      "post": {
        "operationId": "lookup_dental_procedures",
        "summary": "Look up dental procedures",
        "description": "Maps a natural-language dental procedure query to structured Toofi catalog entries. No patient data, no clinic private data, no PHI.",
        "x-ai-description": "Use this operation to translate clinical planning phrases into Toofi procedure catalog candidates and pricing anchors.",
        "x-phi": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProcedureLookupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Procedure matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProcedureLookupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/api/agent/plan-draft/preview": {
      "post": {
        "operationId": "preview_plan_draft_schema",
        "summary": "Preview plan draft schema",
        "description": "Returns the target structured response schema for private clinic-scoped treatment-plan draft execution. This public endpoint does not generate a real patient plan.",
        "x-ai-description": "Use this operation to understand the shape of Toofi treatment-plan draft responses before private clinic integration.",
        "x-phi": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanDraftPreviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schema preview",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanDraftPreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/patients/list": {
      "post": {
        "operationId": "list_patients",
        "summary": "List clinic patients",
        "description": "List clinic patients. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "List clinic patients through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "patient_identity",
          "appointment_meta"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/patients/get": {
      "post": {
        "operationId": "get_patient",
        "summary": "Get one clinic patient",
        "description": "Get one clinic patient. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Get one clinic patient through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "patient_identity",
          "clinical_findings"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/plans/list": {
      "post": {
        "operationId": "list_plans",
        "summary": "List treatment plans",
        "description": "List treatment plans. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "List treatment plans through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "plan_document",
          "appointment_meta"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/plans/get": {
      "post": {
        "operationId": "get_plan",
        "summary": "Get one treatment plan",
        "description": "Get one treatment plan. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Get one treatment plan through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "plan_document",
          "clinical_findings",
          "price_catalog"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/status/get": {
      "post": {
        "operationId": "get_status",
        "summary": "Get agent workflow status",
        "description": "Get agent workflow status. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Get agent workflow status through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "plan_document"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/pano-markup/start": {
      "post": {
        "operationId": "start_pano_markup",
        "summary": "Start panoramic X-ray markup",
        "description": "Start panoramic X-ray markup. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Start panoramic X-ray markup through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "pano_assets",
          "clinical_findings"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/treatment-plan-drafts/generate": {
      "post": {
        "operationId": "generate_treatment_plan_draft",
        "summary": "Generate treatment-plan draft",
        "description": "Generate a structured Toofi treatment-plan draft from agent input. Demo mode is no-auth/no-memory and returns billing metadata for 15 Toofi internal credits; production metering will charge internal credits. Dentist approval required before clinical use.",
        "x-ai-description": "Use this operation to generate a structured treatment-plan draft from procedures, clinical findings, or a natural-language clinical request.",
        "x-phi": false,
        "x-demo-no-registration": true,
        "x-no-memory": true,
        "x-billing": {
          "unit": "toofi_internal_credit",
          "required_credits": 15,
          "demo_charged": false,
          "production_metering": "internal_credits"
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentPlanGenerateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated plan draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentPlanGenerateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/api/agent/patient-presentations/generate": {
      "post": {
        "operationId": "generate_patient_presentation",
        "summary": "Generate patient-facing presentation",
        "description": "Generate patient-facing presentation. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Generate patient-facing presentation through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "plan_document",
          "price_catalog",
          "patient_identity"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/price-estimates/generate": {
      "post": {
        "operationId": "generate_price_estimate",
        "summary": "Generate price estimate",
        "description": "Generate price estimate. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Generate price estimate through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "price_catalog",
          "plan_document"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/price-csv/import": {
      "post": {
        "operationId": "import_price_csv",
        "summary": "Import clinic price CSV",
        "description": "Import clinic price CSV. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Import clinic price CSV through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "price_catalog"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/credits/balance": {
      "post": {
        "operationId": "get_credit_balance",
        "summary": "Get clinic credit balance",
        "description": "Get clinic credit balance. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "Get clinic credit balance through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "billing_state"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/audit/receipts": {
      "post": {
        "operationId": "list_audit_receipts",
        "summary": "List signed audit receipts",
        "description": "List signed audit receipts. This is a Toofi agent-native contract endpoint. Clinic-scoped execution requires OAuth 2.1 mandate access; public callers receive structured schema, identity, audit, and safety requirements with 200 OK.",
        "x-ai-description": "List signed audit receipts through Toofi's agent-native dental planning surface. Use after discover_capabilities and mandate authorization.",
        "x-mandate-required": true,
        "x-dentist-approval-required": true,
        "x-data-classes": [
          "audit_receipts"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentContractRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent-native command contract",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentContractResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      }
    },
    "/api/agent/demo/patients/list": {
      "post": {
        "operationId": "list_demo_patients",
        "summary": "List demo patients",
        "description": "List demo patients. Public demo data, no registration, no PHI.",
        "x-ai-description": "List demo patients from Toofi demo corpus so agents can see real response structure before account integration.",
        "x-phi": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      },
      "get": {
        "operationId": "list_demo_patients_get",
        "summary": "List demo patients",
        "description": "List demo patients. GET variant for simple crawlers and agents.",
        "x-phi": false,
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/demo/patients/get": {
      "post": {
        "operationId": "get_demo_patient",
        "summary": "Get demo patient",
        "description": "Get demo patient. Public demo data, no registration, no PHI.",
        "x-ai-description": "Get demo patient from Toofi demo corpus so agents can see real response structure before account integration.",
        "x-phi": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      },
      "get": {
        "operationId": "get_demo_patient_get",
        "summary": "Get demo patient",
        "description": "Get demo patient. GET variant for simple crawlers and agents.",
        "x-phi": false,
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/demo/plans/list": {
      "post": {
        "operationId": "list_demo_plans",
        "summary": "List demo plans",
        "description": "List demo plans. Public demo data, no registration, no PHI.",
        "x-ai-description": "List demo plans from Toofi demo corpus so agents can see real response structure before account integration.",
        "x-phi": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      },
      "get": {
        "operationId": "list_demo_plans_get",
        "summary": "List demo plans",
        "description": "List demo plans. GET variant for simple crawlers and agents.",
        "x-phi": false,
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/demo/plans/get": {
      "post": {
        "operationId": "get_demo_plan",
        "summary": "Get demo plan",
        "description": "Get demo plan. Public demo data, no registration, no PHI.",
        "x-ai-description": "Get demo plan from Toofi demo corpus so agents can see real response structure before account integration.",
        "x-phi": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      },
      "get": {
        "operationId": "get_demo_plan_get",
        "summary": "Get demo plan",
        "description": "Get demo plan. GET variant for simple crawlers and agents.",
        "x-phi": false,
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/demo/presentations/get": {
      "post": {
        "operationId": "get_demo_presentation",
        "summary": "Get demo patient presentation",
        "description": "Get demo patient presentation. Public demo data, no registration, no PHI.",
        "x-ai-description": "Get demo patient presentation from Toofi demo corpus so agents can see real response structure before account integration.",
        "x-phi": false,
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON"
          }
        }
      },
      "get": {
        "operationId": "get_demo_presentation_get",
        "summary": "Get demo patient presentation",
        "description": "Get demo patient presentation. GET variant for simple crawlers and agents.",
        "x-phi": false,
        "responses": {
          "200": {
            "description": "Demo data response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoDataResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SafetyBoundary": {
        "type": "object",
        "properties": {
          "draft_only": {
            "type": "boolean"
          },
          "dentist_approval_required": {
            "type": "boolean"
          },
          "autonomous_diagnosis": {
            "type": "boolean"
          },
          "autonomous_treatment_decision": {
            "type": "boolean"
          },
          "public_endpoints_expose_phi": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "CapabilitiesResponse": {
        "type": "object",
        "required": [
          "ok",
          "name",
          "description",
          "safety",
          "endpoints",
          "capabilities",
          "links"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "safety": {
            "$ref": "#/components/schemas/SafetyBoundary"
          },
          "endpoints": {
            "type": "object"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "links": {
            "type": "object"
          }
        },
        "additionalProperties": true
      },
      "ProcedureLookupRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "Optional idempotency/correlation id echoed in the response."
          },
          "query": {
            "type": "string",
            "description": "Natural-language dental procedure query."
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "ru",
              "uk",
              "pl",
              "sk"
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25
          }
        },
        "additionalProperties": true
      },
      "ProcedureMatch": {
        "type": "object",
        "properties": {
          "procedure_id": {
            "type": "string"
          },
          "catalog_id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "label_ru": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "group_mode": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "billable": {
            "type": "boolean"
          },
          "price_profile_id": {
            "type": "string"
          },
          "base_price": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "amount": {
                "type": "number"
              },
              "currency": {
                "type": "string"
              },
              "source": {
                "type": "string"
              }
            }
          },
          "typical_plan_structure": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "confidence": {
            "type": "number"
          },
          "matched_terms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "ProcedureLookupResponse": {
        "type": "object",
        "required": [
          "ok",
          "endpoint",
          "mode",
          "timestamp",
          "freshness",
          "matches",
          "safety"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "endpoint": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "timestamp": {
            "type": "string"
          },
          "freshness": {
            "type": "object"
          },
          "query": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProcedureMatch"
            }
          },
          "safety": {
            "$ref": "#/components/schemas/SafetyBoundary"
          }
        },
        "additionalProperties": true
      },
      "PlanDraftPreviewRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string"
          },
          "procedures": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "additionalProperties": true
      },
      "PlanDraftPreviewResponse": {
        "type": "object",
        "required": [
          "ok",
          "endpoint",
          "mode",
          "available",
          "input_schema",
          "output_schema",
          "safety"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "endpoint": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "timestamp": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "input_schema": {
            "type": "object"
          },
          "output_schema": {
            "type": "object"
          },
          "example": {
            "type": "object"
          },
          "safety": {
            "$ref": "#/components/schemas/SafetyBoundary"
          }
        },
        "additionalProperties": true
      },
      "AgentAuthModel": {
        "type": "object",
        "properties": {
          "protocol": {
            "type": "string"
          },
          "sender_constrained_tokens": {
            "type": "string"
          },
          "mandate_scoping": {
            "type": "boolean"
          },
          "required_identity_fields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "AgentContractRequest": {
        "type": "object",
        "required": [
          "intent_id",
          "mandate_id"
        ],
        "properties": {
          "request_id": {
            "type": "string"
          },
          "intent_id": {
            "type": "string"
          },
          "mandate_id": {
            "type": "string"
          },
          "clinic_id": {
            "type": "string"
          },
          "principal_id": {
            "type": "string"
          },
          "patient_ref": {
            "type": "string"
          },
          "plan_ref": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "AgentContractResponse": {
        "type": "object",
        "required": [
          "ok",
          "endpoint",
          "operation_id",
          "mode",
          "status",
          "requires_clinic_mandate",
          "dentist_approval_required",
          "auth_model",
          "input_schema",
          "output_schema",
          "safety"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "endpoint": {
            "type": "string"
          },
          "operation_id": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "agent_native_contract"
            ]
          },
          "status": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "requires_clinic_mandate": {
            "type": "boolean"
          },
          "dentist_approval_required": {
            "type": "boolean"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "timestamp": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "data_classes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auth_model": {
            "$ref": "#/components/schemas/AgentAuthModel"
          },
          "input_schema": {
            "type": "object"
          },
          "output_schema": {
            "type": "object"
          },
          "example": {
            "type": "object"
          },
          "safety": {
            "$ref": "#/components/schemas/SafetyBoundary"
          }
        },
        "additionalProperties": true
      },
      "DemoDataResponse": {
        "type": "object",
        "required": [
          "ok",
          "endpoint",
          "mode",
          "timestamp",
          "safety"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "endpoint": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live_demo_data"
            ]
          },
          "timestamp": {
            "type": "string"
          },
          "patient": {
            "type": "object"
          },
          "patients": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "plan": {
            "type": "object"
          },
          "plans": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "presentation": {
            "type": "object"
          },
          "safety": {
            "$ref": "#/components/schemas/SafetyBoundary"
          }
        },
        "additionalProperties": true
      },
      "AgentPlanGenerateRequest": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "clinical_request": {
            "type": "string"
          },
          "chief_complaint": {
            "type": "string"
          },
          "patient_ref": {
            "type": "string"
          },
          "patient": {
            "type": "object"
          },
          "clinical_findings": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "procedures": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "additionalProperties": true
      },
      "AgentPlanGenerateResponse": {
        "type": "object",
        "required": [
          "ok",
          "endpoint",
          "mode",
          "status",
          "plan_draft",
          "billing",
          "audit",
          "safety"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "endpoint": {
            "type": "string"
          },
          "operation_id": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "live_demo_plan_generation"
            ]
          },
          "status": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "persistent_memory": {
            "type": "boolean"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "timestamp": {
            "type": "string"
          },
          "plan_draft": {
            "type": "object"
          },
          "billing": {
            "type": "object",
            "properties": {
              "unit": {
                "type": "string"
              },
              "required_credits": {
                "type": "integer"
              },
              "charged": {
                "type": "boolean"
              },
              "metering_mode": {
                "type": "string"
              },
              "production_metering": {
                "type": "string"
              }
            }
          },
          "audit": {
            "type": "object"
          },
          "safety": {
            "$ref": "#/components/schemas/SafetyBoundary"
          }
        },
        "additionalProperties": true
      }
    }
  }
}
