{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "title": "CopilotApi",
  "description": "Describes all JSON-RPC methods exposed by the Copilot CLI server. SDK codegen tools consume this to produce typed client wrappers.",
  "server": {
    "ping": {
      "rpcMethod": "ping",
      "params": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Optional message to echo back"
          }
        },
        "additionalProperties": false
      },
      "result": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Echoed message (or default greeting)"
          },
          "timestamp": {
            "type": "number",
            "description": "Server timestamp in milliseconds"
          },
          "protocolVersion": {
            "type": "number",
            "description": "Server protocol version number"
          }
        },
        "required": [
          "message",
          "timestamp",
          "protocolVersion"
        ],
        "additionalProperties": false
      }
    },
    "models": {
      "list": {
        "rpcMethod": "models.list",
        "params": null,
        "result": {
          "type": "object",
          "properties": {
            "models": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Model identifier (e.g., \"claude-sonnet-4.5\")"
                  },
                  "name": {
                    "type": "string",
                    "description": "Display name"
                  },
                  "capabilities": {
                    "type": "object",
                    "properties": {
                      "supports": {
                        "type": "object",
                        "properties": {
                          "vision": {
                            "type": "boolean",
                            "description": "Whether this model supports vision/image input"
                          },
                          "reasoningEffort": {
                            "type": "boolean",
                            "description": "Whether this model supports reasoning effort configuration"
                          }
                        },
                        "additionalProperties": false,
                        "description": "Feature flags indicating what the model supports"
                      },
                      "limits": {
                        "type": "object",
                        "properties": {
                          "max_prompt_tokens": {
                            "type": "number",
                            "description": "Maximum number of prompt/input tokens"
                          },
                          "max_output_tokens": {
                            "type": "number",
                            "description": "Maximum number of output/completion tokens"
                          },
                          "max_context_window_tokens": {
                            "type": "number",
                            "description": "Maximum total context window size in tokens"
                          }
                        },
                        "required": [
                          "max_context_window_tokens"
                        ],
                        "additionalProperties": false,
                        "description": "Token limits for prompts, outputs, and context window"
                      }
                    },
                    "required": [
                      "supports",
                      "limits"
                    ],
                    "additionalProperties": false,
                    "description": "Model capabilities and limits"
                  },
                  "policy": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "description": "Current policy state for this model"
                      },
                      "terms": {
                        "type": "string",
                        "description": "Usage terms or conditions for this model"
                      }
                    },
                    "required": [
                      "state",
                      "terms"
                    ],
                    "additionalProperties": false,
                    "description": "Policy state (if applicable)"
                  },
                  "billing": {
                    "type": "object",
                    "properties": {
                      "multiplier": {
                        "type": "number",
                        "description": "Billing cost multiplier relative to the base rate"
                      }
                    },
                    "required": [
                      "multiplier"
                    ],
                    "additionalProperties": false,
                    "description": "Billing information"
                  },
                  "supportedReasoningEfforts": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Supported reasoning effort levels (only present if model supports reasoning effort)"
                  },
                  "defaultReasoningEffort": {
                    "type": "string",
                    "description": "Default reasoning effort level (only present if model supports reasoning effort)"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "capabilities"
                ],
                "additionalProperties": false
              },
              "description": "List of available models with full metadata"
            }
          },
          "required": [
            "models"
          ],
          "additionalProperties": false
        }
      }
    },
    "tools": {
      "list": {
        "rpcMethod": "tools.list",
        "params": {
          "type": "object",
          "properties": {
            "model": {
              "type": "string",
              "description": "Optional model ID — when provided, the returned tool list reflects model-specific overrides"
            }
          },
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "tools": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Tool identifier (e.g., \"bash\", \"grep\", \"str_replace_editor\")"
                  },
                  "namespacedName": {
                    "type": "string",
                    "description": "Optional namespaced name for declarative filtering (e.g., \"playwright/navigate\" for MCP tools)"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of what the tool does"
                  },
                  "parameters": {
                    "type": "object",
                    "additionalProperties": {},
                    "description": "JSON Schema for the tool's input parameters"
                  },
                  "instructions": {
                    "type": "string",
                    "description": "Optional instructions for how to use this tool effectively"
                  }
                },
                "required": [
                  "name",
                  "description"
                ],
                "additionalProperties": false
              },
              "description": "List of available built-in tools with metadata"
            }
          },
          "required": [
            "tools"
          ],
          "additionalProperties": false
        }
      }
    },
    "account": {
      "getQuota": {
        "rpcMethod": "account.getQuota",
        "params": null,
        "result": {
          "type": "object",
          "properties": {
            "quotaSnapshots": {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "properties": {
                  "entitlementRequests": {
                    "type": "number",
                    "description": "Number of requests included in the entitlement"
                  },
                  "usedRequests": {
                    "type": "number",
                    "description": "Number of requests used so far this period"
                  },
                  "remainingPercentage": {
                    "type": "number",
                    "description": "Percentage of entitlement remaining"
                  },
                  "overage": {
                    "type": "number",
                    "description": "Number of overage requests made this period"
                  },
                  "overageAllowedWithExhaustedQuota": {
                    "type": "boolean",
                    "description": "Whether pay-per-request usage is allowed when quota is exhausted"
                  },
                  "resetDate": {
                    "type": "string",
                    "description": "Date when the quota resets (ISO 8601)"
                  }
                },
                "required": [
                  "entitlementRequests",
                  "usedRequests",
                  "remainingPercentage",
                  "overage",
                  "overageAllowedWithExhaustedQuota"
                ],
                "additionalProperties": false
              },
              "description": "Quota snapshots keyed by type (e.g., chat, completions, premium_interactions)"
            }
          },
          "required": [
            "quotaSnapshots"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "session": {
    "model": {
      "getCurrent": {
        "rpcMethod": "session.model.getCurrent",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "modelId": {
              "type": "string",
              "description": "Currently active model identifier"
            }
          },
          "additionalProperties": false
        }
      },
      "switchTo": {
        "rpcMethod": "session.model.switchTo",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "modelId": {
              "type": "string",
              "description": "Model identifier to switch to"
            },
            "reasoningEffort": {
              "type": "string",
              "description": "Reasoning effort level to use for the model"
            }
          },
          "required": [
            "sessionId",
            "modelId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "modelId": {
              "type": "string",
              "description": "Currently active model identifier after the switch"
            }
          },
          "additionalProperties": false
        }
      }
    },
    "mode": {
      "get": {
        "rpcMethod": "session.mode.get",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "interactive",
                "plan",
                "autopilot"
              ],
              "description": "The current agent mode."
            }
          },
          "required": [
            "mode"
          ],
          "additionalProperties": false
        }
      },
      "set": {
        "rpcMethod": "session.mode.set",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "mode": {
              "type": "string",
              "enum": [
                "interactive",
                "plan",
                "autopilot"
              ],
              "description": "The mode to switch to. Valid values: \"interactive\", \"plan\", \"autopilot\"."
            }
          },
          "required": [
            "sessionId",
            "mode"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "interactive",
                "plan",
                "autopilot"
              ],
              "description": "The agent mode after switching."
            }
          },
          "required": [
            "mode"
          ],
          "additionalProperties": false
        }
      }
    },
    "plan": {
      "read": {
        "rpcMethod": "session.plan.read",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "exists": {
              "type": "boolean",
              "description": "Whether the plan file exists in the workspace"
            },
            "content": {
              "type": [
                "string",
                "null"
              ],
              "description": "The content of the plan file, or null if it does not exist"
            },
            "path": {
              "type": [
                "string",
                "null"
              ],
              "description": "Absolute file path of the plan file, or null if workspace is not enabled"
            }
          },
          "required": [
            "exists",
            "content",
            "path"
          ],
          "additionalProperties": false
        }
      },
      "update": {
        "rpcMethod": "session.plan.update",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "content": {
              "type": "string",
              "description": "The new content for the plan file"
            }
          },
          "required": [
            "sessionId",
            "content"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      "delete": {
        "rpcMethod": "session.plan.delete",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      }
    },
    "workspace": {
      "listFiles": {
        "rpcMethod": "session.workspace.listFiles",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "files": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Relative file paths in the workspace files directory"
            }
          },
          "required": [
            "files"
          ],
          "additionalProperties": false
        }
      },
      "readFile": {
        "rpcMethod": "session.workspace.readFile",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "path": {
              "type": "string",
              "description": "Relative path within the workspace files directory"
            }
          },
          "required": [
            "sessionId",
            "path"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "content": {
              "type": "string",
              "description": "File content as a UTF-8 string"
            }
          },
          "required": [
            "content"
          ],
          "additionalProperties": false
        }
      },
      "createFile": {
        "rpcMethod": "session.workspace.createFile",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "path": {
              "type": "string",
              "description": "Relative path within the workspace files directory"
            },
            "content": {
              "type": "string",
              "description": "File content to write as a UTF-8 string"
            }
          },
          "required": [
            "sessionId",
            "path",
            "content"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      }
    },
    "fleet": {
      "start": {
        "rpcMethod": "session.fleet.start",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "prompt": {
              "type": "string",
              "description": "Optional user prompt to combine with fleet instructions"
            }
          },
          "additionalProperties": false,
          "required": [
            "sessionId"
          ]
        },
        "result": {
          "type": "object",
          "properties": {
            "started": {
              "type": "boolean",
              "description": "Whether fleet mode was successfully activated"
            }
          },
          "required": [
            "started"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      }
    },
    "agent": {
      "list": {
        "rpcMethod": "session.agent.list",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "agents": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Unique identifier of the custom agent"
                  },
                  "displayName": {
                    "type": "string",
                    "description": "Human-readable display name"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of the agent's purpose"
                  }
                },
                "required": [
                  "name",
                  "displayName",
                  "description"
                ],
                "additionalProperties": false
              },
              "description": "Available custom agents"
            }
          },
          "required": [
            "agents"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "getCurrent": {
        "rpcMethod": "session.agent.getCurrent",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "agent": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Unique identifier of the custom agent"
                    },
                    "displayName": {
                      "type": "string",
                      "description": "Human-readable display name"
                    },
                    "description": {
                      "type": "string",
                      "description": "Description of the agent's purpose"
                    }
                  },
                  "required": [
                    "name",
                    "displayName",
                    "description"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ],
              "description": "Currently selected custom agent, or null if using the default agent"
            }
          },
          "required": [
            "agent"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "select": {
        "rpcMethod": "session.agent.select",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "name": {
              "type": "string",
              "description": "Name of the custom agent to select"
            }
          },
          "required": [
            "sessionId",
            "name"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "agent": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Unique identifier of the custom agent"
                },
                "displayName": {
                  "type": "string",
                  "description": "Human-readable display name"
                },
                "description": {
                  "type": "string",
                  "description": "Description of the agent's purpose"
                }
              },
              "required": [
                "name",
                "displayName",
                "description"
              ],
              "additionalProperties": false,
              "description": "The newly selected custom agent"
            }
          },
          "required": [
            "agent"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "deselect": {
        "rpcMethod": "session.agent.deselect",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "reload": {
        "rpcMethod": "session.agent.reload",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "agents": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Unique identifier of the custom agent"
                  },
                  "displayName": {
                    "type": "string",
                    "description": "Human-readable display name"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of the agent's purpose"
                  }
                },
                "required": [
                  "name",
                  "displayName",
                  "description"
                ],
                "additionalProperties": false
              },
              "description": "Reloaded custom agents"
            }
          },
          "required": [
            "agents"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      }
    },
    "skills": {
      "list": {
        "rpcMethod": "session.skills.list",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "skills": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Unique identifier for the skill"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of what the skill does"
                  },
                  "source": {
                    "type": "string",
                    "description": "Source location type (e.g., project, personal, plugin)"
                  },
                  "userInvocable": {
                    "type": "boolean",
                    "description": "Whether the skill can be invoked by the user as a slash command"
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "Whether the skill is currently enabled"
                  },
                  "path": {
                    "type": "string",
                    "description": "Absolute path to the skill file"
                  }
                },
                "required": [
                  "name",
                  "description",
                  "source",
                  "userInvocable",
                  "enabled"
                ],
                "additionalProperties": false
              },
              "description": "Available skills"
            }
          },
          "required": [
            "skills"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "enable": {
        "rpcMethod": "session.skills.enable",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "name": {
              "type": "string",
              "description": "Name of the skill to enable"
            }
          },
          "required": [
            "sessionId",
            "name"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "disable": {
        "rpcMethod": "session.skills.disable",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "name": {
              "type": "string",
              "description": "Name of the skill to disable"
            }
          },
          "required": [
            "sessionId",
            "name"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "reload": {
        "rpcMethod": "session.skills.reload",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      }
    },
    "mcp": {
      "list": {
        "rpcMethod": "session.mcp.list",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "servers": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Server name (config key)"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "connected",
                      "failed",
                      "pending",
                      "disabled",
                      "not_configured"
                    ],
                    "description": "Connection status: connected, failed, pending, disabled, or not_configured"
                  },
                  "source": {
                    "type": "string",
                    "description": "Configuration source: user, workspace, plugin, or builtin"
                  },
                  "error": {
                    "type": "string",
                    "description": "Error message if the server failed to connect"
                  }
                },
                "required": [
                  "name",
                  "status"
                ],
                "additionalProperties": false
              },
              "description": "Configured MCP servers"
            }
          },
          "required": [
            "servers"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "enable": {
        "rpcMethod": "session.mcp.enable",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "serverName": {
              "type": "string",
              "description": "Name of the MCP server to enable"
            }
          },
          "required": [
            "sessionId",
            "serverName"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "disable": {
        "rpcMethod": "session.mcp.disable",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "serverName": {
              "type": "string",
              "description": "Name of the MCP server to disable"
            }
          },
          "required": [
            "sessionId",
            "serverName"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "reload": {
        "rpcMethod": "session.mcp.reload",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      }
    },
    "plugins": {
      "list": {
        "rpcMethod": "session.plugins.list",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "plugins": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Plugin name"
                  },
                  "marketplace": {
                    "type": "string",
                    "description": "Marketplace the plugin came from"
                  },
                  "version": {
                    "type": "string",
                    "description": "Installed version"
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "Whether the plugin is currently enabled"
                  }
                },
                "required": [
                  "name",
                  "marketplace",
                  "enabled"
                ],
                "additionalProperties": false
              },
              "description": "Installed plugins"
            }
          },
          "required": [
            "plugins"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      }
    },
    "extensions": {
      "list": {
        "rpcMethod": "session.extensions.list",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "extensions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper')"
                  },
                  "name": {
                    "type": "string",
                    "description": "Extension name (directory name)"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "project",
                      "user"
                    ],
                    "description": "Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/)"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "running",
                      "disabled",
                      "failed",
                      "starting"
                    ],
                    "description": "Current status: running, disabled, failed, or starting"
                  },
                  "pid": {
                    "type": "integer",
                    "description": "Process ID if the extension is running"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "source",
                  "status"
                ],
                "additionalProperties": false
              },
              "description": "Discovered extensions and their current status"
            }
          },
          "required": [
            "extensions"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "enable": {
        "rpcMethod": "session.extensions.enable",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "id": {
              "type": "string",
              "description": "Source-qualified extension ID to enable"
            }
          },
          "required": [
            "sessionId",
            "id"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "disable": {
        "rpcMethod": "session.extensions.disable",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "id": {
              "type": "string",
              "description": "Source-qualified extension ID to disable"
            }
          },
          "required": [
            "sessionId",
            "id"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      },
      "reload": {
        "rpcMethod": "session.extensions.reload",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        },
        "stability": "experimental"
      }
    },
    "compaction": {
      "compact": {
        "rpcMethod": "session.compaction.compact",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            }
          },
          "required": [
            "sessionId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean",
              "description": "Whether compaction completed successfully"
            },
            "tokensRemoved": {
              "type": "number",
              "description": "Number of tokens freed by compaction"
            },
            "messagesRemoved": {
              "type": "number",
              "description": "Number of messages removed during compaction"
            }
          },
          "required": [
            "success",
            "tokensRemoved",
            "messagesRemoved"
          ],
          "additionalProperties": false
        },
        "stability": "experimental"
      }
    },
    "tools": {
      "handlePendingToolCall": {
        "rpcMethod": "session.tools.handlePendingToolCall",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "requestId": {
              "type": "string"
            },
            "result": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "object",
                  "properties": {
                    "textResultForLlm": {
                      "type": "string"
                    },
                    "resultType": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    },
                    "toolTelemetry": {
                      "type": "object",
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "textResultForLlm"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "error": {
              "type": "string"
            }
          },
          "required": [
            "sessionId",
            "requestId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean",
              "description": "Whether the tool call result was handled successfully"
            }
          },
          "required": [
            "success"
          ],
          "additionalProperties": false
        }
      }
    },
    "commands": {
      "handlePendingCommand": {
        "rpcMethod": "session.commands.handlePendingCommand",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "requestId": {
              "type": "string",
              "description": "Request ID from the command invocation event"
            },
            "error": {
              "type": "string",
              "description": "Error message if the command handler failed"
            }
          },
          "required": [
            "sessionId",
            "requestId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean"
            }
          },
          "required": [
            "success"
          ],
          "additionalProperties": false
        }
      }
    },
    "ui": {
      "elicitation": {
        "rpcMethod": "session.ui.elicitation",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "message": {
              "type": "string",
              "description": "Message describing what information is needed from the user"
            },
            "requestedSchema": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "object",
                  "description": "Schema type indicator (always 'object')"
                },
                "properties": {
                  "type": "object",
                  "additionalProperties": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "enum": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "enumNames": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "default": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "enum"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "oneOf": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "const": {
                                  "type": "string"
                                },
                                "title": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "const",
                                "title"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "default": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "oneOf"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "array"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "minItems": {
                            "type": "number"
                          },
                          "maxItems": {
                            "type": "number"
                          },
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "string"
                              },
                              "enum": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "type",
                              "enum"
                            ],
                            "additionalProperties": false
                          },
                          "default": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "type",
                          "items"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "array"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "minItems": {
                            "type": "number"
                          },
                          "maxItems": {
                            "type": "number"
                          },
                          "items": {
                            "type": "object",
                            "properties": {
                              "anyOf": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "const": {
                                      "type": "string"
                                    },
                                    "title": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "const",
                                    "title"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "anyOf"
                            ],
                            "additionalProperties": false
                          },
                          "default": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "type",
                          "items"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "boolean"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "default": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "minLength": {
                            "type": "number"
                          },
                          "maxLength": {
                            "type": "number"
                          },
                          "format": {
                            "type": "string",
                            "enum": [
                              "email",
                              "uri",
                              "date",
                              "date-time"
                            ]
                          },
                          "default": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "number",
                              "integer"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "minimum": {
                            "type": "number"
                          },
                          "maximum": {
                            "type": "number"
                          },
                          "default": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "description": "Form field definitions, keyed by field name"
                },
                "required": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "List of required field names"
                }
              },
              "required": [
                "type",
                "properties"
              ],
              "additionalProperties": false,
              "description": "JSON Schema describing the form fields to present to the user"
            }
          },
          "required": [
            "sessionId",
            "message",
            "requestedSchema"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "accept",
                "decline",
                "cancel"
              ],
              "description": "The user's response: accept (submitted), decline (rejected), or cancel (dismissed)"
            },
            "content": {
              "type": "object",
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              },
              "description": "The form values submitted by the user (present when action is 'accept')"
            }
          },
          "required": [
            "action"
          ],
          "additionalProperties": false
        }
      }
    },
    "permissions": {
      "handlePendingPermissionRequest": {
        "rpcMethod": "session.permissions.handlePendingPermissionRequest",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "requestId": {
              "type": "string"
            },
            "result": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "approved"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "denied-by-rules"
                    },
                    "rules": {
                      "type": "array",
                      "items": {}
                    }
                  },
                  "required": [
                    "kind",
                    "rules"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "denied-no-approval-rule-and-could-not-request-from-user"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "denied-interactively-by-user"
                    },
                    "feedback": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "denied-by-content-exclusion-policy"
                    },
                    "path": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "path",
                    "message"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": [
            "sessionId",
            "requestId",
            "result"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean",
              "description": "Whether the permission request was handled successfully"
            }
          },
          "required": [
            "success"
          ],
          "additionalProperties": false
        }
      }
    },
    "log": {
      "rpcMethod": "session.log",
      "params": {
        "type": "object",
        "properties": {
          "sessionId": {
            "type": "string",
            "description": "Target session identifier"
          },
          "message": {
            "type": "string",
            "description": "Human-readable message"
          },
          "level": {
            "type": "string",
            "enum": [
              "info",
              "warning",
              "error"
            ],
            "description": "Log severity level. Determines how the message is displayed in the timeline. Defaults to \"info\"."
          },
          "ephemeral": {
            "type": "boolean",
            "description": "When true, the message is transient and not persisted to the session event log on disk"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Optional URL the user can open in their browser for more details"
          }
        },
        "required": [
          "sessionId",
          "message"
        ],
        "additionalProperties": false
      },
      "result": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the emitted session event"
          }
        },
        "required": [
          "eventId"
        ],
        "additionalProperties": false
      }
    },
    "shell": {
      "exec": {
        "rpcMethod": "session.shell.exec",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "command": {
              "type": "string",
              "description": "Shell command to execute"
            },
            "cwd": {
              "type": "string",
              "description": "Working directory (defaults to session working directory)"
            },
            "timeout": {
              "type": "number",
              "description": "Timeout in milliseconds (default: 30000)"
            }
          },
          "required": [
            "sessionId",
            "command"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "processId": {
              "type": "string",
              "description": "Unique identifier for tracking streamed output"
            }
          },
          "required": [
            "processId"
          ],
          "additionalProperties": false
        }
      },
      "kill": {
        "rpcMethod": "session.shell.kill",
        "params": {
          "type": "object",
          "properties": {
            "sessionId": {
              "type": "string",
              "description": "Target session identifier"
            },
            "processId": {
              "type": "string",
              "description": "Process identifier returned by shell.exec"
            },
            "signal": {
              "type": "string",
              "enum": [
                "SIGTERM",
                "SIGKILL",
                "SIGINT"
              ],
              "description": "Signal to send (default: SIGTERM)"
            }
          },
          "required": [
            "sessionId",
            "processId"
          ],
          "additionalProperties": false
        },
        "result": {
          "type": "object",
          "properties": {
            "killed": {
              "type": "boolean",
              "description": "Whether the signal was sent successfully"
            }
          },
          "required": [
            "killed"
          ],
          "additionalProperties": false
        }
      }
    }
  }
}
