{
  "contract_version": 1,
  "errors": {
    "codes": [
      {
        "action": "Send the user through consent again, asking for `scope` as well.",
        "code": "missing_scope",
        "meaning": "The token has no permission for this tool. `scope` names the one it needs.",
        "retryable": false
      },
      {
        "action": "Ask the user to sign in to Haplotype Wallet once.",
        "code": "account_not_found",
        "meaning": "The user has never opened Haplotype Wallet, so there is no data to share.",
        "retryable": false
      },
      {
        "action": "Tell the user. The same call works once the account is approved.",
        "code": "waitlisted",
        "meaning": "The user's account is waiting for approval.",
        "retryable": false
      },
      {
        "action": "Send the user to `manage_url` to subscribe.",
        "code": "trial_ended",
        "meaning": "The user's free trial has ended.",
        "retryable": false
      },
      {
        "action": "Send the user to `manage_url` to subscribe again.",
        "code": "subscription_ended",
        "meaning": "The user's subscription has ended.",
        "retryable": false
      },
      {
        "action": "Ask for less, or send the user to `manage_url`.",
        "code": "limit_reached",
        "meaning": "The call would go over the user's plan allowance, for example the polygenic score models `schedule_run` may compute.",
        "retryable": false
      },
      {
        "action": "Check the ID. List the user's samples, runs or requests again.",
        "code": "not_found",
        "meaning": "The sample, run, algorithm or biobank request does not exist or is not the user's, or the tool is not available to this user.",
        "retryable": false
      },
      {
        "action": "Fix the call. Check it against the tool's input schema.",
        "code": "invalid_argument",
        "meaning": "The arguments do not fit the tool. The message names the parameters, never their values.",
        "retryable": false
      },
      {
        "action": "Wait, then retry.",
        "code": "rate_limited",
        "meaning": "Too many calls of this kind in a short time, or, for `submit_biobank_request`, too many open requests.",
        "retryable": true
      },
      {
        "action": "Retry after a short wait. If it persists, quote `ref` to us.",
        "code": "upstream_unavailable",
        "meaning": "A service behind the wallet failed or did not answer.",
        "retryable": true
      },
      {
        "action": "Quote `ref` when you report it to us.",
        "code": "internal_error",
        "meaning": "A bug on our side. The detail is withheld.",
        "retryable": false
      }
    ],
    "meta_key": "ai.haplotype/error"
  },
  "mcp": {
    "stateless": true,
    "url": "https://api.haplotype.ai/mcp"
  },
  "oauth": {
    "access_token_lifetime_seconds": 900,
    "authorize_path": "/oauth2/authorize",
    "issuer": "https://authkit.haplotype.ai",
    "resource": "https://api.haplotype.ai/mcp",
    "resource_required_on": [
      "authorize",
      "token",
      "refresh"
    ],
    "token_path": "/oauth2/token"
  },
  "open_tools": [
    "get_algorithm",
    "list_algorithms",
    "list_brava_associations",
    "list_brava_traits",
    "list_gwas_associations",
    "list_pgs_categories",
    "list_reports",
    "lookup_clingen",
    "lookup_cpic",
    "lookup_variant_references",
    "search_pgs_scores"
  ],
  "scopes": [
    {
      "description": "See which genotype files you have and how they were processed",
      "name": "View genotype files",
      "slug": "samples:read",
      "tools": [
        "get_sample",
        "list_samples"
      ]
    },
    {
      "description": "Read your genotype at the positions it asks about",
      "name": "Read genotypes",
      "slug": "variants:read",
      "tools": [
        "get_report",
        "query_variants"
      ]
    },
    {
      "description": "Read your polygenic scores and analysis runs",
      "name": "Read scores and runs",
      "slug": "scores:read",
      "tools": [
        "get_biobank_request",
        "get_run",
        "list_biobank_requests",
        "list_member_pgs_scores",
        "list_runs"
      ]
    },
    {
      "description": "Start new analyses on your genotypes and send questions to biobanks",
      "name": "Start analyses",
      "slug": "runs:write",
      "tools": [
        "schedule_run",
        "submit_biobank_request"
      ]
    }
  ],
  "tools": [
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "request_id": {
            "description": "The request_id from submit_biobank_request or list_biobank_requests.",
            "type": "string"
          }
        },
        "required": [
          "request_id"
        ],
        "type": "object"
      },
      "name": "get_biobank_request",
      "output_schema": {
        "description": "One biobank request, with its answer once there is one.",
        "properties": {
          "answer": {
            "description": "Present only when status is answered.",
            "properties": {
              "acknowledgment": {
                "description": "Credit the biobank requires wherever these results are shown or shared. Include it with them.",
                "type": "string"
              },
              "data_release": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The biobank data release the query ran on."
              },
              "summary": {
                "description": "What the results show, with caveats. Relay the caveats.",
                "type": "string"
              },
              "table": {
                "anyOf": [
                  {
                    "description": "Aggregate results exported from the biobank.",
                    "properties": {
                      "columns": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "rows": {
                        "description": "One list per row, in column order. A count can be a string such as \"≤20\": the biobank does not allow publishing counts from 1 to 20.",
                        "items": {
                          "items": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "integer"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "type": "array"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "columns",
                      "rows"
                    ],
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "summary",
              "data_release",
              "acknowledgment",
              "table"
            ],
            "type": "object"
          },
          "answered_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When it was answered or declined. Null while open."
          },
          "biobank": {
            "description": "all_of_us, the All of Us program.",
            "type": "string"
          },
          "conditions": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ]
          },
          "decline_reason": {
            "description": "Present only when status is declined.",
            "type": "string"
          },
          "genes": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "description": "Where the request stands. Before an answer exists it says so; never present an open request as an empty result.",
            "type": "string"
          },
          "question": {
            "type": "string"
          },
          "request_id": {
            "description": "Pass this to get_biobank_request.",
            "type": "string"
          },
          "status": {
            "description": "queued, then in_progress while a person runs the query, then answered or declined.",
            "enum": [
              "queued",
              "in_progress",
              "answered",
              "declined"
            ],
            "type": "string"
          },
          "submitted_at": {
            "type": "string"
          },
          "variants": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "request_id",
          "biobank",
          "status",
          "question",
          "submitted_at",
          "answered_at",
          "variants",
          "genes",
          "conditions",
          "message"
        ],
        "type": "object"
      },
      "scope": "scores:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "report": {
            "description": "Report name, exactly as list_reports gives it.",
            "type": "string"
          },
          "sample_id": {
            "description": "The sample identifier (e.g. \"ABCDEFGHIJ001\") from list_samples.",
            "type": "string"
          }
        },
        "required": [
          "report",
          "sample_id"
        ],
        "type": "object"
      },
      "name": "get_report",
      "output_schema": {
        "description": "One rendered report.",
        "properties": {
          "content": {
            "additionalProperties": true,
            "description": "The report's JSON version, as the template wrote it.",
            "type": "object"
          },
          "formats": {
            "description": "Formats the user can open in the Wallet chat.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "report": {
            "type": "string"
          },
          "sample_id": {
            "description": "Wallet sample_id it was made from.",
            "type": "string"
          }
        },
        "required": [
          "report",
          "sample_id",
          "formats",
          "content"
        ],
        "type": "object"
      },
      "scope": "variants:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "run_id": {
            "description": "The run identifier from schedule_run or list_runs.",
            "type": "string"
          }
        },
        "required": [
          "run_id"
        ],
        "type": "object"
      },
      "name": "get_run",
      "output_schema": {
        "description": "One run: status, input, output, provenance and task progress.",
        "properties": {
          "algorithm": {
            "type": "string"
          },
          "created": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "input": {
            "additionalProperties": true,
            "description": "The algorithm input, passed through as scheduled.",
            "type": "object"
          },
          "modified": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "output": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "The algorithm output, passed through. Empty until the run completes."
          },
          "provenance": {
            "anyOf": [
              {
                "description": "Where a run's result came from. Null only when both parts are absent.",
                "properties": {
                  "inputs": {
                    "anyOf": [
                      {
                        "description": "What a run consumed.",
                        "properties": {
                          "chromosomes": {
                            "description": "Number of per-chromosome files the run read.",
                            "type": "integer"
                          },
                          "stage": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Processing stage of the sample files the run read."
                          }
                        },
                        "required": [
                          "stage",
                          "chromosomes"
                        ],
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Null for runs that predate input tracking."
                  },
                  "sample_provenance": {
                    "anyOf": [
                      {
                        "description": "How a sample was produced: genome builds, imputation, and pipeline steps.",
                        "properties": {
                          "imputation_tool": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Tool of the imputation step, e.g. \"beagle\"."
                          },
                          "impute_reason": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "is_imputed": {
                            "anyOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "pipeline": {
                            "items": {
                              "description": "One step of the processing pipeline that produced a sample.",
                              "properties": {
                                "finished_at": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "started_at": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "step": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "Step name, e.g. \"beagle-impute\"."
                                },
                                "tools": {
                                  "description": "Tools the step ran, each as \"name version\".",
                                  "items": {
                                    "type": "string"
                                  },
                                  "type": "array"
                                }
                              },
                              "required": [
                                "step",
                                "tools",
                                "started_at",
                                "finished_at"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "processed_at": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reference_panel": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Id of the imputation reference panel."
                          },
                          "source_build": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Genome build of the uploaded file, e.g. \"GRCh37\"."
                          },
                          "target_build": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Genome build of the imputation reference panel."
                          },
                          "variant_count": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "is_imputed",
                          "source_build",
                          "target_build",
                          "reference_panel",
                          "variant_count",
                          "impute_reason",
                          "processed_at",
                          "imputation_tool",
                          "pipeline"
                        ],
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "How the run's input sample was produced. Null when the sample predates provenance or could not be read."
                  }
                },
                "required": [
                  "inputs",
                  "sample_provenance"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "run_id": {
            "type": "string"
          },
          "sample_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Wallet sample_id the run was computed on."
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Pending, then Complete or Error."
          },
          "tasks": {
            "items": {
              "description": "One execution task of a run, with its step plan and progress.",
              "properties": {
                "completed_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "current_step": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "error_message": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "estimated_duration_seconds": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Average completion time of past tasks of this kind."
                },
                "eta_seconds_remaining": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "id": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "started_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "pending, running, succeeded, failed or cancelled."
                },
                "steps": {
                  "anyOf": [
                    {
                      "items": {
                        "additionalProperties": true,
                        "type": "object"
                      },
                      "type": "array"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "The planned step sequence, passed through."
                },
                "suggested_poll_interval_seconds": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Wait this long before calling get_run again."
                }
              },
              "required": [
                "id",
                "kind",
                "status",
                "current_step",
                "steps",
                "started_at",
                "completed_at",
                "error_message",
                "estimated_duration_seconds",
                "eta_seconds_remaining",
                "suggested_poll_interval_seconds"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "version": {
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "algorithm",
          "version",
          "status",
          "sample_id",
          "input",
          "output",
          "provenance",
          "created",
          "modified",
          "tasks"
        ],
        "type": "object"
      },
      "scope": "scores:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "sample_id": {
            "description": "The sample identifier (e.g. \"ABCDEFGHIJ001\") from list_samples.",
            "type": "string"
          }
        },
        "required": [
          "sample_id"
        ],
        "type": "object"
      },
      "name": "get_sample",
      "output_schema": {
        "description": "One sample, with the upload request it was created from.",
        "properties": {
          "file_size": {
            "description": "Size of the uploaded file in bytes.",
            "type": "integer"
          },
          "haplohub_created": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When HaploHub created the sample. Absent when the upstream lookup failed."
          },
          "label": {
            "description": "Short display name, e.g. \"Sample #1\".",
            "type": "string"
          },
          "processed_at": {
            "type": "string"
          },
          "provenance": {
            "anyOf": [
              {
                "description": "How a sample was produced, and the uploaded file it came from.",
                "properties": {
                  "imputation_tool": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Tool of the imputation step, e.g. \"beagle\"."
                  },
                  "impute_reason": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "is_imputed": {
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pipeline": {
                    "items": {
                      "description": "One step of the processing pipeline that produced a sample.",
                      "properties": {
                        "finished_at": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "started_at": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "step": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Step name, e.g. \"beagle-impute\"."
                        },
                        "tools": {
                          "description": "Tools the step ran, each as \"name version\".",
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "step",
                        "tools",
                        "started_at",
                        "finished_at"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "processed_at": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reference_panel": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Id of the imputation reference panel."
                  },
                  "source_build": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Genome build of the uploaded file, e.g. \"GRCh37\"."
                  },
                  "source_upload": {
                    "description": "The uploaded file a sample came from.",
                    "properties": {
                      "filename": {
                        "type": "string"
                      },
                      "uploaded_at": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "filename",
                      "uploaded_at"
                    ],
                    "type": "object"
                  },
                  "target_build": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Genome build of the imputation reference panel."
                  },
                  "variant_count": {
                    "anyOf": [
                      {
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "is_imputed",
                  "source_build",
                  "target_build",
                  "reference_panel",
                  "variant_count",
                  "impute_reason",
                  "processed_at",
                  "imputation_tool",
                  "pipeline",
                  "source_upload"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null for samples processed before provenance was recorded, and when the upstream lookup failed."
          },
          "sample_id": {
            "description": "Pass this to get_sample, query_variants, schedule_run and list_runs.",
            "type": "string"
          },
          "source_filename": {
            "type": "string"
          },
          "upload_request_id": {
            "type": "string"
          }
        },
        "required": [
          "sample_id",
          "label",
          "source_filename",
          "file_size",
          "processed_at",
          "provenance",
          "upload_request_id"
        ],
        "type": "object"
      },
      "scope": "samples:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {},
        "type": "object"
      },
      "name": "list_biobank_requests",
      "output_schema": {
        "properties": {
          "result": {
            "items": {
              "description": "A biobank request, without its answer.",
              "properties": {
                "answered_at": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When it was answered or declined. Null while open."
                },
                "biobank": {
                  "description": "all_of_us, the All of Us program.",
                  "type": "string"
                },
                "question": {
                  "type": "string"
                },
                "request_id": {
                  "description": "Pass this to get_biobank_request.",
                  "type": "string"
                },
                "status": {
                  "description": "queued, then in_progress while a person runs the query, then answered or declined.",
                  "enum": [
                    "queued",
                    "in_progress",
                    "answered",
                    "declined"
                  ],
                  "type": "string"
                },
                "submitted_at": {
                  "type": "string"
                }
              },
              "required": [
                "request_id",
                "biobank",
                "status",
                "question",
                "submitted_at",
                "answered_at"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "result"
        ],
        "type": "object",
        "x-fastmcp-wrap-result": true
      },
      "scope": "scores:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {},
        "type": "object"
      },
      "name": "list_member_pgs_scores",
      "output_schema": {
        "properties": {
          "result": {
            "items": {
              "description": "A computed polygenic score, the most recent one for its model.",
              "properties": {
                "adjusted_z_score": {
                  "type": "number"
                },
                "created": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "percentile": {
                  "type": "number"
                },
                "pgs_model_id": {
                  "description": "The scored model, as a harmonized id such as PGS000123_hmPOS_GRCh38. The leading PGS number is the PGS Catalog id that search_pgs_scores returns.",
                  "type": "string"
                },
                "population_id": {
                  "description": "Reference population the score is relative to.",
                  "type": "string"
                },
                "population_percentile": {
                  "type": "number"
                },
                "population_z_score": {
                  "type": "number"
                },
                "result_id": {
                  "description": "The run that computed the score. Pass it to get_run to see what the run consumed and how the sample was produced.",
                  "type": "string"
                },
                "sample_id": {
                  "description": "Wallet sample_id the score was computed on.",
                  "type": "string"
                },
                "score_id": {
                  "type": "string"
                }
              },
              "required": [
                "score_id",
                "pgs_model_id",
                "sample_id",
                "result_id",
                "percentile",
                "adjusted_z_score",
                "population_id",
                "population_percentile",
                "population_z_score",
                "created"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "result"
        ],
        "type": "object",
        "x-fastmcp-wrap-result": true
      },
      "scope": "scores:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "sample_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Optional: only runs over this sample. Use a wallet sample_id from list_samples."
          }
        },
        "type": "object"
      },
      "name": "list_runs",
      "output_schema": {
        "properties": {
          "result": {
            "items": {
              "description": "A scheduled run, without its input, output and tasks.",
              "properties": {
                "algorithm": {
                  "type": "string"
                },
                "created": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "provenance": {
                  "anyOf": [
                    {
                      "description": "Where a run's result came from. Null only when both parts are absent.",
                      "properties": {
                        "inputs": {
                          "anyOf": [
                            {
                              "description": "What a run consumed.",
                              "properties": {
                                "chromosomes": {
                                  "description": "Number of per-chromosome files the run read.",
                                  "type": "integer"
                                },
                                "stage": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "Processing stage of the sample files the run read."
                                }
                              },
                              "required": [
                                "stage",
                                "chromosomes"
                              ],
                              "type": "object"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Null for runs that predate input tracking."
                        },
                        "sample_provenance": {
                          "anyOf": [
                            {
                              "description": "The at-a-glance part of a sample's provenance, without the pipeline steps.",
                              "properties": {
                                "imputation_tool": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "is_imputed": {
                                  "anyOf": [
                                    {
                                      "type": "boolean"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "processed_at": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "reference_panel": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "target_build": {
                                  "anyOf": [
                                    {
                                      "type": "string"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "is_imputed",
                                "target_build",
                                "reference_panel",
                                "imputation_tool",
                                "processed_at"
                              ],
                              "type": "object"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "How the run's input sample was produced. Null when the sample predates provenance or could not be read."
                        }
                      },
                      "required": [
                        "inputs",
                        "sample_provenance"
                      ],
                      "type": "object"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "run_id": {
                  "description": "Pass this to get_run.",
                  "type": "string"
                },
                "sample_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Wallet sample_id the run was computed on."
                },
                "status": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Pending, then Complete or Error."
                },
                "version": {
                  "type": "string"
                }
              },
              "required": [
                "run_id",
                "algorithm",
                "version",
                "status",
                "sample_id",
                "provenance",
                "created"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "result"
        ],
        "type": "object",
        "x-fastmcp-wrap-result": true
      },
      "scope": "scores:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {},
        "type": "object"
      },
      "name": "list_samples",
      "output_schema": {
        "properties": {
          "result": {
            "items": {
              "description": "A sample the caller is authorized to use.",
              "properties": {
                "file_size": {
                  "description": "Size of the uploaded file in bytes.",
                  "type": "integer"
                },
                "haplohub_created": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "When HaploHub created the sample. Absent when the upstream lookup failed."
                },
                "label": {
                  "description": "Short display name, e.g. \"Sample #1\".",
                  "type": "string"
                },
                "processed_at": {
                  "type": "string"
                },
                "provenance": {
                  "anyOf": [
                    {
                      "description": "How a sample was produced, and the uploaded file it came from.",
                      "properties": {
                        "imputation_tool": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Tool of the imputation step, e.g. \"beagle\"."
                        },
                        "impute_reason": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "is_imputed": {
                          "anyOf": [
                            {
                              "type": "boolean"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "pipeline": {
                          "items": {
                            "description": "One step of the processing pipeline that produced a sample.",
                            "properties": {
                              "finished_at": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "started_at": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "step": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Step name, e.g. \"beagle-impute\"."
                              },
                              "tools": {
                                "description": "Tools the step ran, each as \"name version\".",
                                "items": {
                                  "type": "string"
                                },
                                "type": "array"
                              }
                            },
                            "required": [
                              "step",
                              "tools",
                              "started_at",
                              "finished_at"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "processed_at": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "reference_panel": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Id of the imputation reference panel."
                        },
                        "source_build": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Genome build of the uploaded file, e.g. \"GRCh37\"."
                        },
                        "source_upload": {
                          "description": "The uploaded file a sample came from.",
                          "properties": {
                            "filename": {
                              "type": "string"
                            },
                            "uploaded_at": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "filename",
                            "uploaded_at"
                          ],
                          "type": "object"
                        },
                        "target_build": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Genome build of the imputation reference panel."
                        },
                        "variant_count": {
                          "anyOf": [
                            {
                              "type": "integer"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "is_imputed",
                        "source_build",
                        "target_build",
                        "reference_panel",
                        "variant_count",
                        "impute_reason",
                        "processed_at",
                        "imputation_tool",
                        "pipeline",
                        "source_upload"
                      ],
                      "type": "object"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Null for samples processed before provenance was recorded, and when the upstream lookup failed."
                },
                "sample_id": {
                  "description": "Pass this to get_sample, query_variants, schedule_run and list_runs.",
                  "type": "string"
                },
                "source_filename": {
                  "type": "string"
                }
              },
              "required": [
                "sample_id",
                "label",
                "source_filename",
                "file_size",
                "processed_at",
                "provenance"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "result"
        ],
        "type": "object",
        "x-fastmcp-wrap-result": true
      },
      "scope": "samples:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "chromosome": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Chromosome accession (e.g. \"chr13\", \"NC_000013.11\"). Required when query_type is \"region\" and positions is not given."
          },
          "clinical_significance": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "ClinVar significance-label filter. Defaults to [\"Pathogenic\", \"Likely_pathogenic\"]. Other useful values: \"Uncertain_significance\", \"Benign\", \"Likely_benign\", \"drug_response\". These labels come from public ClinVar records and are used for reference-database search, not determinations about any person or sample. Case-insensitive substring match."
          },
          "end": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "1-based end position. Required when query_type is \"region\" and positions is not given."
          },
          "gene_symbols": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Gene symbols to query (e.g. [\"APOE\", \"TCF7L2\"]). Required when query_type is \"clinvar\". Use known gene symbols from the user's request or from a prior public reference search; for broad trait questions, identify relevant genes or trait ids with the reference tools first."
          },
          "hgvs": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "HGVS notation (e.g. \"NC_000013.11:g.32356461T>G\"), one string or a list of up to 20 to look up in one call. Required when query_type is \"hgvs\". Supports both c. and g. notation."
          },
          "intent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "One or two sentences on what the user is trying to learn and why this query serves it, under 400 characters. Describe the goal in general terms (e.g. \"Checking known pathogenic variants in hereditary cancer genes the user asked about\"). Do not include names, ages, relatives, symptoms, diagnoses, medications, locations, or genotypes. Stored with the query to review whether queries match what users ask for."
          },
          "limit": {
            "default": 1000,
            "description": "Only used when query_type is \"brava\": how many of the most significant matching BRaVa variants to check (default and max 1000).",
            "type": "integer"
          },
          "p_value_max": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Maximum association p-value (e.g. 5e-8 for genome-wide significance). Only used when query_type is \"gwas\" or \"brava\"."
          },
          "positions": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Batch of loci for query_type \"region\", up to 20 per call, each \"<chromosome>:<position>\" or \"<chromosome>:<start>-<end>\" (e.g. [\"chr4:67031670\", \"chr5:103743441-103743500\"]). Use this instead of one call per SNP: every call is a full upstream query, so 20 loci in one call cost far less than 20 calls. Takes precedence over chromosome/start/end."
          },
          "query_type": {
            "description": "The type of variant query. \"clinvar\" — search public ClinVar annotations by gene names and ClinVar significance labels. \"hgvs\" — look up a specific variant by HGVS notation (e.g. \"NC_000013.11:g.32356461T>G\"). \"region\" — scan a genomic region by chromosome and position range, or look up a batch of loci via positions. \"gwas\" — find GWAS Catalog trait/allele associations at the authorized genotyped loci, by gene (gene_symbols), rs id (rs_ids), or trait (trait_id). Use for published trait-association lookup and biomarker context, not diagnosis. \"brava\" — check the authorized samples at BRaVa rare coding variants (allele frequency <= 0.001, results with p <= 0.01). It takes the `limit` most significant BRaVa variants (default and max 1000) matching gene_symbols (first non-blank symbol), trait_id and p_value_max, and genotypes the samples there. A variant where every sample is called without the allele (dosage 0) is left out and counted in not_carried. A variant where no sample has a call is not reported at all: sparse genotype data (arrays, many imputed files) rarely covers variants this rare. So an empty result means none of the checked variants is called with the allele in the samples, not that the samples carry no BRaVa variant. Give both a gene and a trait for a focused question; list_brava_traits gives the trait codes. The filters only choose the variants: each returned variant comes with all its BRaVa associations, for every trait.",
            "enum": [
              "clinvar",
              "hgvs",
              "region",
              "gwas",
              "brava"
            ],
            "type": "string"
          },
          "rs_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "SNP rs ids to look up (e.g. [\"rs7903146\"]). Only used when query_type is \"gwas\"."
          },
          "sample_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Optional: query only this sample instead of all user samples. Use a sample_id from list_samples."
          },
          "start": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "1-based start position. Required when query_type is \"region\" and positions is not given."
          },
          "trait_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "GWAS Catalog / EFO trait id (e.g. an EFO id) to filter associations when query_type is \"gwas\". When query_type is \"brava\", a BRaVa trait code from list_brava_traits (e.g. \"LDLC\")."
          }
        },
        "required": [
          "query_type"
        ],
        "type": "object"
      },
      "name": "query_variants",
      "output_schema": {
        "description": "Observed variants at the queried loci, with public annotations.",
        "properties": {
          "not_carried": {
            "description": "brava queries only: checked BRaVa variants where every sample is called without the allele (dosage 0). They are left out of `variants`. Variants where no sample has a call are not counted or reported.",
            "type": "integer"
          },
          "samples": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Label of each queried sample, keyed as in `calls`.",
            "type": "object"
          },
          "unresolved": {
            "description": "Present only when some items did not resolve.",
            "items": {
              "description": "A queried item that matched no variant, or that failed.",
              "properties": {
                "error": {
                  "type": "string"
                },
                "query": {
                  "description": "The item as it was sent.",
                  "type": "string"
                },
                "resolved": {
                  "description": "What the item resolved to, when it did.",
                  "type": "string"
                }
              },
              "required": [
                "query"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "variants": {
            "items": {
              "description": "One variant locus, with the genotype calls observed at it.",
              "properties": {
                "allele": {
                  "description": "The one alternate allele `calls` counts, as ref>alt, e.g. \"T>C\". Present when the result is pinned to one allele: brava and clinvar queries, and any result whose target named its allele. Two entries can share a locus with different alleles.",
                  "type": "string"
                },
                "brava": {
                  "description": "Present only when BRaVa has results for an allele at this locus.",
                  "items": {
                    "description": "A BRaVa rare-variant association for one allele at the locus.",
                    "properties": {
                      "allele": {
                        "description": "The allele BRaVa tested, as ref>alt, e.g. \"G>A\". When the entry has `allele`, the annotation matching it is the one the dosage counts. Otherwise the dosage counts any alternate allele of the record.",
                        "type": "string"
                      },
                      "beta": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Effect size."
                      },
                      "citation": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "URL of the BRaVa publication to cite."
                      },
                      "n": {
                        "anyOf": [
                          {
                            "type": "integer"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Sample size."
                      },
                      "n_cases": {
                        "anyOf": [
                          {
                            "type": "integer"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Cases. Null for quantitative traits."
                      },
                      "p": {
                        "description": "Association p-value.",
                        "type": "number"
                      },
                      "release": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "The BRaVa release."
                      },
                      "se": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "source": {
                        "description": "Always \"BRaVa\".",
                        "type": "string"
                      },
                      "trait": {
                        "description": "The BRaVa trait an association belongs to.",
                        "properties": {
                          "code": {
                            "description": "Trait code, e.g. \"LDLC\". Pass it as a trait filter.",
                            "type": "string"
                          },
                          "kind": {
                            "description": "\"binary\" (case/control) or \"quantitative\" (a measurement, e.g. LDL cholesterol).",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "name",
                          "kind"
                        ],
                        "type": "object"
                      }
                    },
                    "required": [
                      "trait",
                      "allele",
                      "beta",
                      "se",
                      "p",
                      "n",
                      "n_cases",
                      "source",
                      "release",
                      "citation"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "calls": {
                  "additionalProperties": {
                    "type": "integer"
                  },
                  "description": "Dosage per sample, keyed like `samples`: 0 means the sample was genotyped here and does not carry the allele, 1 one copy, 2 two. A sample with no call at the locus is left out. With `allele` or `query`, the dosage counts that allele only. Without them (region and gwas queries) it counts any alternate allele of the record.",
                  "type": "object"
                },
                "clinvar": {
                  "description": "Present only when ClinVar has records here.",
                  "items": {
                    "description": "A public ClinVar record at the locus.",
                    "properties": {
                      "conditions": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "gene": {
                        "type": "string"
                      },
                      "review": {
                        "description": "ClinVar review status.",
                        "type": "string"
                      },
                      "significance": {
                        "description": "ClinVar significance label, e.g. \"Pathogenic\".",
                        "type": "string"
                      }
                    },
                    "required": [
                      "gene",
                      "significance",
                      "conditions",
                      "review"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "error": {
                  "type": "string"
                },
                "gwas": {
                  "description": "Present only when the GWAS Catalog has records here.",
                  "items": {
                    "description": "A GWAS Catalog trait association at the locus.",
                    "properties": {
                      "gene": {
                        "type": "string"
                      },
                      "or_beta": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Odds ratio or beta coefficient."
                      },
                      "p": {
                        "anyOf": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "Association p-value."
                      },
                      "pmid": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "PubMed id of the study."
                      },
                      "raf": {
                        "description": "Risk allele frequency, as the catalog reports it.",
                        "type": "string"
                      },
                      "reported_allele": {
                        "description": "The strongest reported risk allele, e.g. \"rs7903146-T\".",
                        "type": "string"
                      },
                      "rs": {
                        "type": "string"
                      },
                      "study": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ],
                        "description": "GWAS Catalog study accession."
                      },
                      "trait": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "rs",
                      "gene",
                      "trait",
                      "reported_allele",
                      "raf",
                      "or_beta",
                      "p",
                      "pmid",
                      "study"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "locus": {
                  "description": "accession:position, followed by :ref>alt when both alleles are known, e.g. \"NC_000019.10:44908684:T>C\". A record with several alternate alleles lists them all, e.g. \"...:T>C,G\".",
                  "type": "string"
                },
                "query": {
                  "description": "hgvs queries only: the HGVS string this entry answers. `calls` counts the allele it names.",
                  "type": "string"
                },
                "rs": {
                  "type": "string"
                }
              },
              "required": [
                "locus",
                "calls"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "samples",
          "variants"
        ],
        "type": "object"
      },
      "scope": "variants:read"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "algorithm_name": {
            "description": "The algorithm to run, by name, from list_algorithms.",
            "type": "string"
          },
          "input": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Algorithm parameters matching the algorithm's input_schema (call get_algorithm first to read it). Parameters only — do NOT put sample references here; use the sample_id parameter."
          },
          "sample_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Wallet sample_id (from list_samples) to run the algorithm over. Ownership-checked and translated to the internal sample reference. Omit for parameter-only algorithms."
          }
        },
        "required": [
          "algorithm_name"
        ],
        "type": "object"
      },
      "name": "schedule_run",
      "output_schema": {
        "description": "A run that was just scheduled.",
        "properties": {
          "run_id": {
            "description": "Pass this to get_run to poll.",
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "run_id",
          "status"
        ],
        "type": "object"
      },
      "scope": "runs:write"
    },
    {
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "conditions": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Optional: condition names it is about. Up to 20."
          },
          "genes": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Optional: gene symbols it is about. Up to 20."
          },
          "question": {
            "description": "One question about the All of Us cohort, in plain words, for example 'Among participants carrying rs429358 C, how many have a diagnosis of Alzheimer disease?'. Ask about the cohort, never about the user. No names, contact details or genotypes. Up to 1,000 characters; longer text is cut.",
            "type": "string"
          },
          "variants": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Optional: the variants it is about, as rsIDs or HGVS. Up to 20."
          }
        },
        "required": [
          "question"
        ],
        "type": "object"
      },
      "name": "submit_biobank_request",
      "output_schema": {
        "description": "A question that was queued, or the open request it duplicates.",
        "properties": {
          "message": {
            "description": "What happens next. Tell the user in your own words.",
            "type": "string"
          },
          "request_id": {
            "description": "Pass this to get_biobank_request to check on it.",
            "type": "string"
          },
          "status": {
            "description": "queued, then in_progress while a person runs the query, then answered or declined.",
            "enum": [
              "queued",
              "in_progress",
              "answered",
              "declined"
            ],
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "status",
          "message"
        ],
        "type": "object"
      },
      "scope": "runs:write"
    }
  ]
}
