{
  "name": "setup",
  "title": "Set up Meetly and optional routines",
  "description": "Read Meetly setup, standing rules, workflow index, and optional host-owned routines. Returns userPreferences profile/revision with granted preferences:read OAuth access; otherwise null/capabilities false by default. preference_access read requests read consent; read_write requests read/write consent only for user-requested persistence, before obtaining the real revision. setup never writes. Ordinary setup loads no workflow bodies; pass skill_keys for selected verified workflows. Hosts own schedules. Use update_user_preferences separately for a confirmed replacement.",
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "openWorldHint": false,
    "idempotentHint": true
  },
  "securitySchemes": [
    {
      "type": "oauth2",
      "scopes": [
        "meetings:read"
      ]
    }
  ],
  "_meta": {
    "securitySchemes": [
      {
        "type": "oauth2",
        "scopes": [
          "meetings:read"
        ]
      }
    ]
  },
  "inputSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "preference_access": {
        "type": "string",
        "enum": [
          "if_authorized",
          "read",
          "read_write"
        ],
        "default": "if_authorized",
        "description": "Default reads only already-authorized preferences without step-up. Request read for profile read consent, or read_write only when the user asks to persist preferences. Missing scopes return an OAuth challenge without writing or guessing a revision."
      },
      "host_environment": {
        "type": "string",
        "enum": [
          "hosted",
          "local"
        ],
        "description": "Defaults to local for codex/cursor and hosted otherwise. ChatGPT always uses human upload. Specify local for Claude Code."
      },
      "host": {
        "type": "string",
        "enum": [
          "chatgpt",
          "codex",
          "claude",
          "cursor",
          "other"
        ]
      },
      "channel": {
        "type": "string",
        "enum": [
          "latest",
          "beta"
        ],
        "default": "latest"
      },
      "skills_held": {
        "type": "array",
        "maxItems": 32,
        "items": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "key": {
              "type": "string"
            },
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "files_held": {
              "type": "array",
              "maxItems": 64,
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "path",
                  "sha256"
                ]
              }
            }
          },
          "required": [
            "key",
            "sha256"
          ]
        }
      },
      "guide_held_sha256": {
        "type": "string",
        "pattern": "^[a-f0-9]{64}$"
      },
      "include_bodies": {
        "type": "boolean",
        "description": "Include verified guide and selected skill files. Defaults true when skill_keys is nonempty, false otherwise for every host. Without skill_keys, true retrieves only the guide."
      },
      "skill_keys": {
        "type": "array",
        "maxItems": 32,
        "uniqueItems": true,
        "items": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "description": "Select relevant skills from the index for progressive body retrieval; omitted or empty means no skill bodies. Unknown or removed keys fail closed. Drift still checks the entire manifest."
      }
    }
  },
  "outputSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "userPreferences": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "profile": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "description": "User-approved preference notes only; at most 8192 UTF-8 JSON bytes. Never store secrets, transcripts, full host memory, or unrelated documents. Schedule notes are preferences, not a scheduler.",
                "properties": {
                  "userContext": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "writingStyle": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "output": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "detail": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "research": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "briefing": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "schedule": {
                    "type": "string",
                    "maxLength": 1000
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "capabilities": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "read": {
                "type": "boolean"
              },
              "write": {
                "type": "boolean"
              }
            },
            "required": [
              "read",
              "write"
            ]
          },
          "requiredScopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "profile",
          "revision",
          "capabilities",
          "requiredScopes"
        ]
      },
      "channel": {
        "type": "string",
        "enum": [
          "latest",
          "beta"
        ]
      },
      "ref": {
        "type": "string"
      },
      "sha": {
        "type": "string",
        "pattern": "^[a-f0-9]{40}$"
      },
      "manifestUrl": {
        "type": "string",
        "format": "uri"
      },
      "currency": {
        "type": "string",
        "enum": [
          "metadata_verified",
          "bodies_verified"
        ],
        "description": "Metadata means release schema and pinned URLs were validated; bodies_verified confirms only returned body hashes and byte lengths. bodyVerification identifies the verified guide and selected skills; unselected bodies remain metadata only. Drift compares host-reported hashes to manifest metadata."
      },
      "bodyVerification": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "guide": {
            "type": "boolean"
          },
          "skillKeys": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "guide",
          "skillKeys"
        ]
      },
      "drift": {
        "type": "boolean"
      },
      "nextAction": {
        "type": "string",
        "enum": [
          "none",
          "install",
          "update"
        ]
      },
      "removedSkills": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "recommendedSkill": {
        "type": "string",
        "enum": [
          "setup-meetly"
        ]
      },
      "instructions": {
        "type": "string"
      },
      "standingRules": {
        "type": "string"
      },
      "workflowRouting": {
        "type": "string"
      },
      "skillsZip": {
        "type": [
          "object",
          "null"
        ],
        "additionalProperties": false,
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10485760
          }
        },
        "required": [
          "url",
          "sha256",
          "bytes"
        ]
      },
      "zipIntegrity": {
        "type": "string",
        "enum": [
          "metadata_only",
          "not_available"
        ]
      },
      "installation": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "owner": {
            "type": "string",
            "enum": [
              "human",
              "host"
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "human_upload",
              "per_file"
            ]
          },
          "instructions": {
            "type": "string"
          }
        },
        "required": [
          "owner",
          "mode",
          "instructions"
        ]
      },
      "optionalRoutine": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "owner": {
            "type": "string",
            "enum": [
              "host"
            ]
          },
          "optional": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "skill": {
            "type": "string",
            "enum": [
              "setup-meetly"
            ]
          },
          "requiredPreferences": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "schedulingGate": {
            "type": "string",
            "enum": [
              "host_confirms_authenticated_meetly_access_in_scheduled_execution"
            ]
          },
          "instructions": {
            "type": "string"
          }
        },
        "required": [
          "owner",
          "optional",
          "skill",
          "requiredPreferences",
          "schedulingGate",
          "instructions"
        ]
      },
      "guide": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "path": {
            "type": "string"
          },
          "src": {
            "type": "string"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "bytes": {
            "type": "integer",
            "minimum": 0
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "text": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "current",
              "update",
              "install"
            ]
          }
        },
        "required": [
          "src",
          "sha256",
          "bytes",
          "url",
          "status"
        ]
      },
      "skills": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "key": {
              "type": "string"
            },
            "version": {
              "type": "integer",
              "minimum": 1
            },
            "removedFiles": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": {
              "type": "string"
            },
            "sha256": {
              "type": "string"
            },
            "status": {
              "type": "string",
              "enum": [
                "current",
                "update",
                "install"
              ]
            },
            "files": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "path": {
                    "type": "string"
                  },
                  "src": {
                    "type": "string"
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "bytes": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "text": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "current",
                      "update",
                      "install"
                    ]
                  }
                },
                "required": [
                  "path",
                  "src",
                  "sha256",
                  "bytes",
                  "url",
                  "status"
                ]
              }
            }
          },
          "required": [
            "key",
            "version",
            "description",
            "sha256",
            "status",
            "files",
            "removedFiles"
          ]
        }
      }
    },
    "required": [
      "userPreferences",
      "channel",
      "ref",
      "sha",
      "manifestUrl",
      "currency",
      "bodyVerification",
      "drift",
      "nextAction",
      "removedSkills",
      "recommendedSkill",
      "skillsZip",
      "zipIntegrity",
      "installation",
      "optionalRoutine",
      "instructions",
      "standingRules",
      "workflowRouting",
      "guide",
      "skills"
    ]
  }
}
