{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/myrmigo-com/json-schema/myrmigo-com-reference-route-result-schema.json",
  "title": "ReferenceRouteResult",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/myrmigo-com-openapi.json#/components/schemas/ReferenceRouteResult",
  "type": "object",
  "properties": {
    "schema": {
      "type": "string",
      "const": "myrmigo.route/1",
      "description": "The format id of this answer."
    },
    "surface": {
      "type": "string",
      "description": "reference: POST /v1/reference and the anonymous MCP server. agent: POST /v1/route with a key."
    },
    "match": {
      "type": "string",
      "description": "How the request matched a step guide, not whether the site was found. none: no guide for this task; with coverage L0 or L1 it is a normal reference answer. question, servicing_question, need_site: ask the user `question.ask_user` (when present), then call again with the chosen option's task or booked_via. For an option without booked_via (another site or travel agent), send the name the user gives as booked_via, or \"not sure\". out_of_scope: see `refusal`. exact, likely: a guide was found (agent surface, where the site allows it)."
    },
    "coverage": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "L0: official site, entry page and channels. L1: also what to have ready, where the person acts and up to 3 dated facts. L2: also a step guide. null when no site was resolved."
    },
    "task": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "schema_action": {
              "type": "string"
            },
            "schema_object": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "schema_action",
            "schema_object"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "The task Myrmigo understood: an id from GET /v1/intents. null when none fits."
    },
    "site": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "domain": {
              "type": "string"
            },
            "owner": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name",
            "domain",
            "owner"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "The site that services the booking. It can differ from `where` when booked_via names another company."
    },
    "servicing_party": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "site": {
              "type": "string"
            },
            "entity": {
              "type": "string"
            },
            "reference_type": {
              "type": "string"
            },
            "basis": {
              "type": "string"
            }
          },
          "required": [
            "site",
            "entity",
            "reference_type",
            "basis"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "Which company services this booking, which booking reference it takes, and why."
    },
    "mode": {
      "type": "string",
      "description": "How Myrmigo reads the site's terms for agents. unsigned: reference only. excluded: only the official route is given."
    },
    "best_route": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string"
            },
            "ref": {
              "type": "string"
            },
            "label": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "ref",
            "label"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "Where to go first. `ref` is a URL, or an MCP or API endpoint when type is official_channel."
    },
    "also_channels": {
      "description": "Further official channels for the task, after best_route.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "ref",
          "label"
        ]
      }
    },
    "disclosure": {
      "description": "A conflict-of-interest line about a company this answer names (its site, operator or seller). Show it to the user with the answer whenever it is present.",
      "type": "string"
    },
    "entry_url": {
      "description": "The official page where the task starts.",
      "type": [
        "string",
        "null"
      ]
    },
    "official_domains": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "envelope": {
      "type": "object",
      "properties": {
        "allowed_domains": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "allowed_domains"
      ],
      "description": "The hosts the agent navigates on for this task. Not a network allowlist: payment, bank approval (3-D Secure) and CAPTCHA load from other hosts."
    },
    "ask_user_first": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "prompt"
        ]
      },
      "description": "What to ask the user for before starting."
    },
    "human_only": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "note"
        ]
      },
      "description": "Where the person acts themselves: payment, ID, sign-in, CAPTCHA, bank approval."
    },
    "checkpoints": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "facts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "topic": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "source_url": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "as_of": {
            "type": "string"
          },
          "confirm_on_site": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "topic",
          "value",
          "source_url",
          "as_of",
          "confirm_on_site"
        ]
      },
      "description": "Dated facts with their source. Confirm them on the site; quotes belong to their owners."
    },
    "health": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "state": {
              "type": "string"
            },
            "success": {
              "type": "object",
              "properties": {
                "rate": {
                  "type": "number"
                },
                "ci95": {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "items": false,
                  "minItems": 2,
                  "maxItems": 2
                },
                "n": {
                  "type": "number"
                }
              },
              "required": [
                "rate",
                "ci95",
                "n"
              ]
            },
            "reported_by_orgs": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "string",
                  "const": "<3"
                }
              ]
            },
            "working_orgs": {
              "type": "number"
            }
          },
          "required": [
            "state",
            "reported_by_orgs"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "How reliable the guide has been in reports, when there is one."
    },
    "guide": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "version": {
              "type": "number"
            },
            "status": {
              "type": "string"
            },
            "verified": {
              "type": "object",
              "properties": {
                "by": {
                  "type": "string"
                },
                "day": {
                  "type": "string"
                }
              },
              "required": [
                "by",
                "day"
              ]
            },
            "body_hash": {
              "type": "string"
            },
            "signature": {
              "type": [
                "string",
                "null"
              ]
            },
            "rendering": {
              "type": "string"
            },
            "summary": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "steps": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "n": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 40
                  },
                  "id": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,40}$"
                  },
                  "do": {
                    "type": "string"
                  },
                  "target": {
                    "type": "object",
                    "properties": {
                      "role": {
                        "type": "string"
                      },
                      "name": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                        },
                        "additionalProperties": {
                          "minItems": 1,
                          "maxItems": 3,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          }
                        }
                      },
                      "match": {
                        "type": "string"
                      },
                      "within": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "name": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                            },
                            "additionalProperties": {
                              "minItems": 1,
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 60
                              }
                            }
                          }
                        },
                        "required": [
                          "role"
                        ]
                      },
                      "nth": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10
                      }
                    },
                    "required": [
                      "role"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\{[a-z][a-z0-9_]{0,30}\\}$"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "option": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                            },
                            "additionalProperties": {
                              "minItems": 1,
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 60
                              }
                            }
                          }
                        },
                        "required": [
                          "option"
                        ]
                      }
                    ]
                  },
                  "picker": {
                    "type": "object",
                    "properties": {
                      "open": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "name": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                            },
                            "additionalProperties": {
                              "minItems": 1,
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 60
                              }
                            }
                          },
                          "match": {
                            "type": "string"
                          },
                          "within": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "name": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                                },
                                "additionalProperties": {
                                  "minItems": 1,
                                  "maxItems": 3,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 60
                                  }
                                }
                              }
                            },
                            "required": [
                              "role"
                            ]
                          },
                          "nth": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10
                          }
                        },
                        "required": [
                          "role"
                        ]
                      },
                      "next_month": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "name": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                            },
                            "additionalProperties": {
                              "minItems": 1,
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 60
                              }
                            }
                          },
                          "match": {
                            "type": "string"
                          },
                          "within": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "name": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                                },
                                "additionalProperties": {
                                  "minItems": 1,
                                  "maxItems": 3,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 60
                                  }
                                }
                              }
                            },
                            "required": [
                              "role"
                            ]
                          },
                          "nth": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10
                          }
                        },
                        "required": [
                          "role"
                        ]
                      },
                      "day_label_format": {
                        "type": "string",
                        "maxLength": 40
                      },
                      "typed_input_ignored": {
                        "type": "boolean"
                      }
                    }
                  },
                  "key": {
                    "type": "string"
                  },
                  "extract": {
                    "maxItems": 6,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,30}$"
                    }
                  },
                  "expect": {
                    "type": "object",
                    "properties": {
                      "url_contains": {
                        "type": "string",
                        "maxLength": 80,
                        "pattern": "^[/a-z0-9\\-_.{}]+$"
                      },
                      "text": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                        },
                        "additionalProperties": {
                          "minItems": 1,
                          "maxItems": 3,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          }
                        }
                      },
                      "sees": {
                        "type": "object",
                        "properties": {
                          "role": {
                            "type": "string"
                          },
                          "name": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                            },
                            "additionalProperties": {
                              "minItems": 1,
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 60
                              }
                            }
                          },
                          "match": {
                            "type": "string"
                          },
                          "within": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "name": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                                },
                                "additionalProperties": {
                                  "minItems": 1,
                                  "maxItems": 3,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 60
                                  }
                                }
                              }
                            },
                            "required": [
                              "role"
                            ]
                          },
                          "nth": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10
                          }
                        },
                        "required": [
                          "role"
                        ]
                      },
                      "absent": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[a-z]{2}(-[a-z]{4})?$"
                        },
                        "additionalProperties": {
                          "minItems": 1,
                          "maxItems": 3,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          }
                        }
                      },
                      "timeout_s": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 60
                      }
                    }
                  },
                  "optional": {
                    "type": "boolean"
                  },
                  "for_each": {
                    "type": "string"
                  },
                  "checkpoint": {
                    "type": "string"
                  },
                  "gate": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string"
                      },
                      "show_user": {
                        "maxItems": 6,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\{[a-z][a-z0-9_]{0,30}\\}$"
                            },
                            {
                              "type": "string",
                              "pattern": "^\\$[a-z][a-z0-9_]{0,30}$"
                            }
                          ]
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "show_user"
                    ]
                  },
                  "pitfall": {
                    "type": "string"
                  },
                  "tip": {
                    "type": "string",
                    "maxLength": 140
                  }
                },
                "required": [
                  "n",
                  "id",
                  "do"
                ]
              }
            }
          },
          "required": [
            "id",
            "version",
            "status",
            "body_hash",
            "signature",
            "rendering",
            "summary"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "The step guide, when one is served (guide text: CC BY-SA 4.0, credit Myrmigo)."
    },
    "alternatives": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "why": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "why"
        ]
      }
    },
    "question": {
      "description": "Ask the user this, then call again with the chosen option's task or booked_via. For an option without booked_via (another site or travel agent), send the name the user gives as booked_via, or \"not sure\".",
      "type": "object",
      "properties": {
        "ask_user": {
          "type": "string"
        },
        "options": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "task": {
                "type": "string"
              },
              "booked_via": {
                "type": "string"
              }
            },
            "required": [
              "label"
            ]
          }
        }
      },
      "required": [
        "ask_user",
        "options"
      ]
    },
    "refusal": {
      "description": "Why the request is out of scope (match out_of_scope).",
      "type": "string"
    },
    "warning": {
      "description": "For example \"NOT MAPPED: …\" when the named site is not in the catalog.",
      "type": "string"
    },
    "rights_check": {
      "description": "On answers about a disrupted flight or a compensation claim (and an airline refund): the EU261/UK261 check for the flight, as the MCP tool and its REST route (POST /v1/rights), with the operating airline to send when the site maps to one. Not legal advice.",
      "type": "object",
      "properties": {
        "tool": {
          "type": "string",
          "const": "check_flight_compensation"
        },
        "rest": {
          "type": "string"
        },
        "carrier": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "tool",
        "rest",
        "carrier"
      ]
    },
    "not_covered": {
      "description": "What Myrmigo has no data for, on answers where it matters (the NOT COVERED line): on a ferry disruption, ferry_routes (routes, ports and timetables) and ferry_rights (passenger rights under Regulation (EU) 1177/2010). Absent: nothing to say.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "flag_url": {
      "type": "string",
      "description": "Where to report wrong or outdated content."
    },
    "card": {
      "type": "string",
      "description": "The same answer as compact text for a model (what the MCP tool returns). Not a stable format: parse the fields, not the card."
    },
    "notice": {
      "type": "string",
      "const": "unverified_third_party_reference"
    }
  },
  "required": [
    "schema",
    "surface",
    "match",
    "coverage",
    "task",
    "site",
    "servicing_party",
    "mode",
    "best_route",
    "entry_url",
    "official_domains",
    "envelope",
    "ask_user_first",
    "human_only",
    "checkpoints",
    "facts",
    "health",
    "guide",
    "alternatives",
    "flag_url",
    "card",
    "notice"
  ]
}