diff --git a/.github/CI.md b/.github/CI.md new file mode 100644 index 00000000000..271311ede03 --- /dev/null +++ b/.github/CI.md @@ -0,0 +1,50 @@ +# CI selection and acceptance ownership + +The `changes` job runs Turborepo 2.9.14's `affectedTasks` query before installing application dependencies or provisioning services. `turbo.json` records package dependency propagation; `apps/sim/turbo.json` partitions the app into shared runtime, server, workspace UI, and acceptance tasks. `.github/ci-suites.json` turns those tasks into job matrices. The uploaded `ci-plan` artifact names changed files, selected tasks, attribution reasons, and any fallback. + +A PR compares its merge base with the checked-out merge commit. Main/staging pushes execute all checks; the parent `ci` workflow skips checks on `dev` pushes, while PRs targeting `dev` still run checks. A manual `checks` run executes all checks unless supplied a full base commit SHA to reproduce a scoped plan. Missing history, an empty diff, unknown files outside the workspace graph, root script/CI changes, or a planner error run every check. Missing selection outputs fail the aggregate gate. The gate also rejects an omitted dependency, any failed/cancelled job, and any skip that its explicit selection flag did not authorize. + +| Change | Expensive checks selected | +| --- | --- | +| Independent SDK | That workspace's tests and type-check; no app build, services, or browsers | +| App unit test | App test shards and test type check | +| Integration test | Both provision paths; no HTTP/browser job merely for the test edit | +| Workspace UI | Database integration, mobile, SEO and live Electron, plus app tests/build | +| Landing content | SEO, app tests/build; no database integration or Electron | +| Shared runtime or transitive dependency | All dependent boundaries | +| One E2E harness | Its acceptance group and the shared production build | + +The server boundary deliberately includes all API routes and backend domains. Shared modules and unclassified app source remain broad inputs: this is safer than pretending a route's static imports describe database, dynamic registry, or background-worker dependencies. Files read outside a package graph need explicit inputs: CLI acceptance imports `packages/sim-cli/src/embed.ts`, app tests read docs content, and live Electron and realtime acceptance cross app boundaries. When adding such a dependency, update the corresponding task inputs/dependencies and the real Git/Turbo selector scenarios. + +Integration also depends on workspace UI because the desktop executor integration suite runs the production workspace stream dispatcher against PostgreSQL and Redis. Its explicit harness inputs include the database and realtime Vitest configs and integration setup files, which runtime tasks exclude. + +SEO depends on workspace UI and server code: landing pages reuse workspace pricing and preview components, provider models/pricing, and the block registry. These directory boundaries are not isolated application dependency graphs. + +`affectedTasks` already uses task inputs. Do not enable `futureFlags.affectedUsingTaskInputs` just for this planner: that flag also changes pruning, which can pull CI-only cross-app task dependencies into production Docker contexts. + +Affected type-checks follow the package graph too; repository audits and lint run whenever the checks workflow runs. Workspace-only unit jobs use a free GitHub runner and do not start the app test shards. + +Database integration and lightweight HTTP suites run on free standard GitHub runners with matching GitHub cache setup. A same-source integration comparison of 16 jobs per provider (32 total) had a slowest shard of 6m 04s on 2-vCPU Blacksmith versus 6m 55s on free GitHub, with identical coverage. GitHub trades the observed 51 seconds for zero runner compute cost. This is one paired sample, not a long-run percentile estimate. These explicitly selected GitHub jobs do not follow `CI_PROVIDER`. + +Memory-heavy builds and browser jobs retain appropriately sized Blacksmith runners. Electron uses 4-vCPU Blacksmith: both shards passed within 14 seconds of the 8-vCPU control; the free GitHub rest shard was slower and its lease run stalled. + +Every HTTP and browser group consumes the same production build in an isolated job/database. Electron also uses that build and skips its development-route warm-up. Local HTTP and Electron development runs retain their dev-server behavior. Build inputs exclude test-only files so a harness edit can reuse an unchanged production build. + +SCIM's production app uses a `sim.ai` fixture hostname mapped to loopback, since `NEXT_PUBLIC_FORCE_HOSTED` is ignored in production. Readiness, HTTP tests, and internal API requests still connect to loopback. The SCIM suite verifies that ending an Enterprise subscription rejects both owner administration and an existing bearer token, and that restoring it restores access. + +## Coverage removed or consolidated + +- SEO is plain HTTP, independent of browser and viewport. Its complete suite runs once in the SEO job, instead of repeating in each of four mobile shards. +- The MCP suite's homepage-returns-200 control duplicated SEO's stronger real-homepage Markdown/content-negotiation check. SEO owns that positive control; MCP retains host isolation, ownership challenge, discovery, API catalogs, unknown-page/API behavior, and refusal of Markdown. +- CLI CI uses one cold/warm-up iteration and one measured iteration instead of three identical measured repetitions. Both retain run completion, selected output, file-reference size, trace, and omitted-workflow-snapshot assertions. The standalone benchmark keeps its configurable sample size. +- A precompiled Electron app needs no route-compilation warm-up, which repeated read/import/chat-switch/Stop flows before each shard. The actual acceptance tests still exercise those behaviors. + +The long-import and lease-expiration checks remain: they prove distinct survival/uncertain-outcome behavior across real process failure. Likewise, the two integration provision paths remain because migrations create constraints/triggers that schema push does not. + +Local planner validation is `bun run test:scripts scripts/ci-changes.test.ts scripts/ci-gate.test.ts`. It executes real Turbo queries in small Git fixtures; no application build or database is required. Full builds, services, browser suites, and Electron checks run on hosted CI. + +The separate `desktop-e2e` workflow retains its desktop-specific path filters. Its macOS shell smoke suite runs whole files across three isolated runners, with one worker per runner. `scripts/desktop-e2e.ts` asks Playwright to discover the complete suite, then assigns longer files first to the currently lightest shard using `apps/desktop/e2e-durations.json`. Exact escaped file filters preserve serial fixtures. Unmeasured files receive the median measured weight, deleted files cannot select tests, and invalid or empty selections fail. Normal local runs, packaging smoke and the weekly Electron canary keep their existing commands. + +The initial weights are median test durations in seconds from runs [39734295953](https://github.com/simstudioai/sim/actions/runs/39734295953), [39833640524](https://github.com/simstudioai/sim/actions/runs/39833640524), and [39836596108](https://github.com/simstudioai/sim/actions/runs/39836596108). Refresh them from complete `desktop-smoke-reports-*` artifacts when the workload changes: sum `tests[].results[].duration` by `spec.file` in each run, take the median across runs, and divide milliseconds by 1,000. The weights steer scheduling only; Playwright discovery owns coverage. Before adopting new weights, compare repeated paired runs and the complete case/status multiset, including skipped cases and retries. + +Each shard uploads its coverage/timing report, the complete discovery report, and its deterministic shard plan. `bun run test:scripts scripts/duration-shards.test.ts scripts/desktop-e2e.test.ts` checks partition coverage, unknown files, deterministic ordering, and balancing. The CLI regression executes tiny browser-free Playwright fixtures to prove that imported test factories and paths containing regex characters are selected correctly; it launches no Electron or browser. diff --git a/.github/ci-suites.json b/.github/ci-suites.json new file mode 100644 index 00000000000..8e18cf9fe18 --- /dev/null +++ b/.github/ci-suites.json @@ -0,0 +1,62 @@ +{ + "http": [ + { + "group": "scim", + "task": "ci:e2e-scim" + }, + { + "group": "cli", + "task": "ci:e2e-cli" + }, + { + "group": "stop-after", + "task": "ci:e2e-stop-after" + }, + { + "group": "desktop-inbox", + "task": "ci:e2e-desktop-inbox" + }, + { + "group": "seo", + "task": "ci:e2e-seo" + }, + { + "group": "project-files", + "task": "ci:e2e-project-files" + } + ], + "production": [ + { + "group": "mobile", + "name": "mobile, chromium, 1/2", + "browser": "chromium", + "shard": "1/2", + "artifact": "mobile-chromium-1", + "task": "ci:e2e-mobile" + }, + { + "group": "mobile", + "name": "mobile, chromium, 2/2", + "browser": "chromium", + "shard": "2/2", + "artifact": "mobile-chromium-2", + "task": "ci:e2e-mobile" + }, + { + "group": "mobile", + "name": "mobile, webkit, 1/2", + "browser": "webkit", + "shard": "1/2", + "artifact": "mobile-webkit-1", + "task": "ci:e2e-mobile" + }, + { + "group": "mobile", + "name": "mobile, webkit, 2/2", + "browser": "webkit", + "shard": "2/2", + "artifact": "mobile-webkit-2", + "task": "ci:e2e-mobile" + } + ] +} diff --git a/.github/scripts/ci-changes.sh b/.github/scripts/ci-changes.sh index c506a2149bf..f31502f4ef8 100755 --- a/.github/scripts/ci-changes.sh +++ b/.github/scripts/ci-changes.sh @@ -1,65 +1,6 @@ #!/usr/bin/env bash -# Prints which checks a pull request's changes can affect, as `=true|false` lines for -# $GITHUB_OUTPUT. A flag is `false` only when every changed file is on an allowlist whose jobs -# fully cover it. A file on no allowlist sets every flag but `desktop_live` (which keeps its own -# skip list) to `true`; a change under .github/, an empty diff, or any failure to work out the -# diff sets all of them. -# -# full integration, e2e, e2e-build, e2e-mobile: any file not allowlisted below -# test the Vitest shards and test-types: content, docs app, and desktop changes, -# plus `full` -# build the app's `next build`: content changes, plus `full` -# desktop_live the live Electron suite: any file outside its own skip list -# -# lint always runs and is not gated. -# -# Usage: ci-changes.sh -set -u - -# Posts, author profiles, and the public assets only posts reference. The test shards read them -# (lib/content/og-image.test.ts) and `next build` prerenders every post with its MDX components, -# which check:library-content compiles but never renders. Components under content/ are code. -content='^apps/sim/content/([^/]+/)*[^/]+\.mdx?$|^apps/sim/content/authors/[^/]+\.json$|^apps/sim/public/(authors|blog|changelog|library)/' -# Its own workspace tests, its type-check and docs-manifest audit in lint, and apps/sim tests -# that read its pages (tools/netsuite/netsuite.test.ts). -docs='^apps/docs/' -# Nothing outside the Electron app imports it; the desktop bridge and protocol packages are -# consumed by apps/sim and stay unlisted. -desktop='^apps/desktop/' -# Agent guidance, read only by the lint job's audits. -guidance='^(\.agents|\.claude|\.cursor)/|^([^/]+/)*(AGENTS|CLAUDE)\.md$|^README\.md$' -# The live desktop suite drives apps/desktop against the app, so it skips more than the rest. -desktop_live_skip="$guidance"'|^(apps/docs/|apps/pii/|apps/sim/content/|apps/sim/public/(authors|blog|changelog|library)/|packages/(python-sdk|ts-sdk)/)|\.mdx?$|(^|/)LICENSE$' - -emit() { - printf 'full=%s\ntest=%s\nbuild=%s\ndesktop_live=%s\n' "$1" "$2" "$3" "$4" -} -run_all() { - emit true true true true - echo "Running every check: $1" >&2 - exit 0 -} -matches() { printf '%s\n' "$names" | grep -qE "$1"; } -outside() { printf '%s\n' "$names" | grep -qvE "$1"; } - -base=${1:-} -[ -n "$base" ] || run_all 'no base commit' -git fetch --quiet --depth=1 origin "$base" || run_all "could not fetch $base" -names=$(git diff --no-renames --name-only "$base" HEAD) || run_all "could not diff against $base" -[ -n "$names" ] || run_all 'no changed files listed' -if matches '^\.github/'; then run_all 'a CI file changed'; fi - -desktop_live=false -if outside "$desktop_live_skip"; then desktop_live=true; fi -if outside "$content|$docs|$desktop|$guidance"; then - emit true true true "$desktop_live" - unlisted=$(printf '%s\n' "$names" | grep -vE "$content|$docs|$desktop|$guidance" | head -n 1) - echo "Running every check (desktop_live=$desktop_live): $unlisted is not on an allowlist" >&2 - exit 0 -fi - -test=false build=false -if matches "$content|$docs|$desktop"; then test=true; fi -if matches "$content"; then build=true; fi -emit false "$test" "$build" "$desktop_live" -echo "Scoped checks: test=$test build=$build desktop_live=$desktop_live" >&2 +# Select tasks from the committed Turborepo graph; unknown files or failed attribution run all. +# Usage: ci-changes.sh [base-sha]. No base runs the complete push/dispatch gate. +set -euo pipefail +script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +exec bun "$script_dir/../../scripts/ci-plan.ts" "${1:-}" diff --git a/.github/scripts/ci-gate.sh b/.github/scripts/ci-gate.sh index c5303551763..38b91d37ca0 100755 --- a/.github/scripts/ci-gate.sh +++ b/.github/scripts/ci-gate.sh @@ -5,10 +5,7 @@ # # A skip passes only for a gated job whose `changes` flag is exactly `false`: # -# integration, e2e, e2e-build, e2e-mobile full -# test, test-types test -# build build -# desktop-live desktop_live +# Each job maps to its own explicit selection flag below. No inferred skip is accepted. # # Every other skip fails: an ungated job (lint, `changes` itself), a gated job whose flag is # `true`, missing, or anything else (a failed or skipped `changes` leaves no outputs). A failure @@ -24,13 +21,21 @@ if ! jq -e 'type == "object"' <<< "$needs" > /dev/null 2>&1; then fi failed="$(jq -r ' - {"integration": "full", "e2e": "full", "e2e-build": "full", "e2e-mobile": "full", "test": "test", - "test-types": "test", "build": "build", "desktop-live": "desktop_live"} as $gate + {"integration": "integration", "e2e": "http", "e2e-build": "e2e_build", "e2e-production": "production", "test": "test", + "test-types": "test_app", "build": "build", "desktop-live": "desktop_live"} as $gate + | . as $needs + | (($gate | keys) + ["changes", "lint"]) as $required + | ($required - keys) as $missing + | if ($missing | length) > 0 then + $missing[] | "\(.): missing" + else + $needs | (.changes.outputs // {}) as $flags | to_entries[] | select(.value.result != "success") | select(.value.result != "skipped" or $gate[.key] == null or $flags[$gate[.key]] != "false") | "\(.key): \(.value.result)" + end ' <<< "$needs")" if [ -n "$failed" ]; then echo "::error::Checks did not pass:" diff --git a/.github/scripts/ci-plan.gql b/.github/scripts/ci-plan.gql new file mode 100644 index 00000000000..db015cb2441 --- /dev/null +++ b/.github/scripts/ci-plan.gql @@ -0,0 +1,23 @@ +query($base: String!, $head: String!) { + packages { items { name path } } + affectedTasks(base: $base, head: $head, tasks: [ + "test", "build", "type-check", "ci:integration", "ci:desktop-live", + "ci:e2e-scim", "ci:e2e-cli", "ci:e2e-stop-after", "ci:e2e-desktop-inbox", + "ci:e2e-project-files", "ci:e2e-mobile", "ci:e2e-seo" + ]) { + items { + name + fullName + package { name } + reason { + __typename + ... on TaskFileChanged { filePath } + ... on TaskGlobalFileChanged { filePath } + ... on TaskGlobalDepsChanged { filePath } + ... on TaskDependencyTaskChanged { taskName packageName } + ... on TaskPackageDependencyChanged { packageName } + ... on TaskAllChanged { description } + } + } + } +} diff --git a/.github/scripts/http-e2e.sh b/.github/scripts/http-e2e.sh index a1d62419ca5..381c2006049 100755 --- a/.github/scripts/http-e2e.sh +++ b/.github/scripts/http-e2e.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # Runs one end-to-end suite group over real HTTP, each against its own app: `next dev`, except -# mobile, which serves the production build the `e2e-build` job uploads with `next start` (the -# job extracts it into apps/sim/.next first). +# CI groups, which reuse the production build from `e2e-build`. +# The job extracts it into apps/sim/.next before running these suites. # -# Usage: http-e2e.sh (run from apps/sim) +# Usage: http-e2e.sh (run from apps/sim) # # The job provides DATABASE_URL, BETTER_AUTH_SECRET and ENCRYPTION_KEY; each group sets the rest of # its app's environment here. Reports and server logs land in $RUNNER_TEMP/e2e. @@ -20,7 +20,7 @@ # telemetry flush runs detached and still writes .next/dev). set -euo pipefail -group=${1:?usage: http-e2e.sh } +group=${1:?usage: http-e2e.sh } report_dir="$RUNNER_TEMP/e2e" ready_timeout_seconds=600 mkdir -p "$report_dir" @@ -33,8 +33,9 @@ realtime_pid='' realtime_tag='' realtime_log='' browsers_pid='' +local_app_url='' # `dev` or `start`; a group sets it before start_app. -app_server=dev +app_server=${E2E_APP_SERVER:-dev} finish() { local status=$? @@ -78,7 +79,8 @@ start_app() { status_log="$report_dir/$name-http-status.log" fi app_tag="$name-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT-$$" - export NEXT_PUBLIC_APP_URL="http://127.0.0.1:$port" + local_app_url="http://127.0.0.1:$port" + export NEXT_PUBLIC_APP_URL="${E2E_APP_PUBLIC_URL:-$local_app_url}" export BETTER_AUTH_URL="$NEXT_PUBLIC_APP_URL" export DISABLE_TELEMETRY=true NEXT_TELEMETRY_DISABLED=1 if [ "$app_server" = start ]; then @@ -96,7 +98,7 @@ start_app() { --port "$port" > "$server_log" 2>&1 & fi server_pid=$! - wait_ready "$server_pid" "$NEXT_PUBLIC_APP_URL/api/health" "$label app" + wait_ready "$server_pid" "$local_app_url/api/health" "$label app" } # start_realtime : the Socket.IO server the app's browser clients connect to, so pages @@ -143,12 +145,12 @@ case "$group" in export DB_TX_TRIPWIRE=throw export NEXT_PUBLIC_CHAT_DISABLED=true start_app scim 3017 SCIM record-http-status - SCIM_E2E_BASE_URL="$NEXT_PUBLIC_APP_URL" \ + SCIM_E2E_BASE_URL="$local_app_url" \ SCIM_E2E_DATABASE_URL="$DATABASE_URL" \ SCIM_E2E_AUTH_SECRET="$BETTER_AUTH_SECRET" \ SCIM_E2E_REPORT_PATH="$report_dir/scim-e2e-report.json" \ bun run test:scim:e2e - VERSION_COMPARE_E2E_BASE_URL="$NEXT_PUBLIC_APP_URL" \ + VERSION_COMPARE_E2E_BASE_URL="$local_app_url" \ VERSION_COMPARE_E2E_DATABASE_URL="$DATABASE_URL" \ VERSION_COMPARE_E2E_AUTH_SECRET="$BETTER_AUTH_SECRET" \ VERSION_COMPARE_E2E_REPORT_PATH="$report_dir/version-compare-http-report.json" \ @@ -174,7 +176,7 @@ case "$group" in bun --no-env-file scripts/test-mcp-host-e2e.ts CLI_LATENCY_E2E_BASE_URL="$NEXT_PUBLIC_APP_URL" \ CLI_LATENCY_E2E_DATABASE_URL="$DATABASE_URL" \ - CLI_LATENCY_E2E_RUNS=3 \ + CLI_LATENCY_E2E_RUNS=1 \ CLI_LATENCY_E2E_WARMUP=1 \ CLI_LATENCY_E2E_REPORT_PATH="$report_dir/cli-run-latency-report.json" \ bun run test:cli-run-latency:e2e @@ -246,7 +248,13 @@ case "$group" in MOBILE_E2E_AUTH_SECRET="$BETTER_AUTH_SECRET" \ MOBILE_E2E_REPORT_PATH="$report_dir/mobile-e2e-report.json" \ bun run test:mobile:e2e - # The same production build answers as a crawler sees it: statuses, robots, sitemap, JSON-LD. + ;; + + seo) + app_server=start + export NEXT_PUBLIC_FORCE_HOSTED=false + start_app seo 3024 'landing SEO' record-http-status + # Plain HTTP assertions have no browser-specific behavior. LANDING_SEO_E2E_BASE_URL="$NEXT_PUBLIC_APP_URL" \ LANDING_SEO_E2E_REPORT_PATH="$report_dir/landing-seo-e2e-report.json" \ bun run test:landing-seo:e2e diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 062af93df7c..ef97d255b12 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -2,42 +2,66 @@ name: checks on: workflow_call: + inputs: + base: + description: Optional comparison commit for a scoped manual check + type: string + required: false workflow_dispatch: + inputs: + base: + description: Compare to this full commit SHA (empty runs all checks) + type: string + required: false permissions: contents: read jobs: - # Which checks a pull request's changes can affect (.github/scripts/ci-changes.sh). A job is - # skipped only when the script prints `false` for its flag; an unset flag, and every push or - # dispatch (the deploy chain's checks), runs it. Every gated job needs this one, so its failure - # skips them and fails `ci` below. + # Attribute changes before dependency installation or service startup. Unknown inputs run all. changes: name: changes - runs-on: &runner-2vcpu ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }} + runs-on: &runner-2vcpu ubuntu-24.04 timeout-minutes: 5 outputs: - full: ${{ github.event_name != 'pull_request' || steps.classify.outputs.full != 'false' }} - test: ${{ github.event_name != 'pull_request' || steps.classify.outputs.test != 'false' }} - build: ${{ github.event_name != 'pull_request' || steps.classify.outputs.build != 'false' }} - desktop_live: ${{ github.event_name != 'pull_request' || steps.classify.outputs.desktop_live != 'false' }} + integration: ${{ steps.classify.outputs.integration }} + http: ${{ steps.classify.outputs.http }} + production: ${{ steps.classify.outputs.production }} + e2e_build: ${{ steps.classify.outputs.e2e_build }} + desktop_live: ${{ steps.classify.outputs.desktop_live }} + test: ${{ steps.classify.outputs.test }} + test_app: ${{ steps.classify.outputs.test_app }} + build: ${{ steps.classify.outputs.build }} + http_matrix: ${{ steps.classify.outputs.http_matrix }} + production_matrix: ${{ steps.classify.outputs.production_matrix }} + test_matrix: ${{ steps.classify.outputs.test_matrix }} + test_packages: ${{ steps.classify.outputs.test_packages }} + typecheck_packages: ${{ steps.classify.outputs.typecheck_packages }} steps: - - name: Checkout code (mirror) - if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork - uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1.8.1 - with: - fetch-depth: 2 - name: Checkout code - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: fetch-depth: 2 - - name: Classify the pull request's changes + - name: Setup Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 + with: + bun-version: 1.4.2 + - name: Install only the pinned task planner + continue-on-error: true + run: bun install --global "turbo@$(jq -r .devDependencies.turbo package.json)" + - name: Attribute changes to CI tasks id: classify - if: github.event_name == 'pull_request' env: - BASE: ${{ github.event.pull_request.base.sha }} + BASE: ${{ github.event.pull_request.base.sha || inputs.base }} + CI_PLAN_PATH: ${{ runner.temp }}/ci-plan.json run: bash .github/scripts/ci-changes.sh "$BASE" >> "$GITHUB_OUTPUT" + - name: Upload task attribution + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: ci-plan + path: ${{ runner.temp }}/ci-plan.json + retention-days: 7 integration: # Runs the real-infrastructure test layer: every `*.integration.ts` in packages/db and @@ -46,19 +70,19 @@ jobs: # # The two paths build different schemas (migrations add triggers, checks and NOT VALID # constraints that `db:push` does not), so each runs the whole suite. Vitest splits each - # suite's files across four shards by measured duration (DurationBalancedSequencer in vitest.shared.ts); a - # shard runs its files one at a time against its own database. Files run serially, so a shard - # barely uses more than one core: 4 vCPU is enough. - name: integration (${{ matrix.provision }}, ${{ matrix.shard }}/4) + # application's files across eight shards by measured duration (DurationBalancedSequencer in + # vitest.shared.ts). Database-package checks run alongside them, so their longest files do + # not delay application tests. Each job has its own database. + name: integration (${{ matrix.provision }}, ${{ matrix.shard == 'db' && 'db' || format('{0}/8', matrix.shard) }}) needs: changes - if: needs.changes.outputs.full == 'true' - runs-on: &runner-4vcpu ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} + if: needs.changes.outputs.integration == 'true' + runs-on: ubuntu-24.04 timeout-minutes: 20 strategy: fail-fast: false matrix: provision: [push, migrate] - shard: [1, 2, 3, 4] + shard: [db, 1, 2, 3, 4, 5, 6, 7, 8] services: redis: image: redis:8.2-alpine @@ -82,9 +106,9 @@ jobs: --health-interval 5s --health-timeout 5s --health-retries 10 - # Only push/1 runs the PostgreSQL 16 step below; an empty image skips the service elsewhere. + # Only push/db runs the PostgreSQL 16 step below; an empty image skips the service elsewhere. postgres-legacy: - image: ${{ matrix.provision == 'push' && matrix.shard == 1 && 'postgres:16-alpine' || '' }} + image: ${{ matrix.provision == 'push' && matrix.shard == 'db' && 'postgres:16-alpine' || '' }} env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -105,24 +129,13 @@ jobs: ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' steps: - # A same-repository pull request checks out through a git mirror on a sticky disk, so a slow - # clone from GitHub (1 in 10 took a minute or more, up to 4) no longer sets the run's pace. - # The mirror is one disk per repository that job steps can write to, so fork pull requests - # and pushes, whose checks gate a deploy, keep the plain checkout: same trust split as the - # setup action's caches. - - &checkout-mirror - name: Checkout code (mirror) - if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork - uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1.8.1 - - &checkout-plain - name: Checkout code - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 - name: Setup workspace uses: ./.github/actions/setup with: - provider: ${{ vars.CI_PROVIDER }} + provider: github - name: Provision a fresh database through the supported command working-directory: packages/db @@ -131,28 +144,30 @@ jobs: bun run db:${{ matrix.provision }} - name: Verify migration replay is a no-op - if: matrix.provision == 'migrate' && matrix.shard == 1 + if: matrix.provision == 'migrate' && matrix.shard == 'db' working-directory: packages/db run: bun run db:migrate - name: Run packages/db integration tests + if: matrix.shard == 'db' working-directory: packages/db - run: bun run test --mode integration --shard=${{ matrix.shard }}/4 + run: bun run test --mode integration - name: Run apps/sim integration tests + if: matrix.shard != 'db' working-directory: apps/sim # A non-UTC process zone keeps timestamp-without-time-zone handling honest. env: TZ: America/Los_Angeles - run: bun run test --mode integration --shard=${{ matrix.shard }}/4 + run: bun run test --mode integration --shard=${{ matrix.shard }}/8 - name: Run apps/realtime integration tests - if: matrix.shard == 1 + if: matrix.shard == 'db' working-directory: apps/realtime run: bun run test --mode integration - name: Verify cumulative billing timeout recovery on PostgreSQL 16 - if: matrix.provision == 'push' && matrix.shard == 1 + if: matrix.provision == 'push' && matrix.shard == 'db' working-directory: apps/sim env: TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5433/sim_test @@ -178,28 +193,16 @@ jobs: # The suites exercise HTTP behavior rather than a provisioning path, so they run once, against # the production (migrate) path. Each group's app environment lives in http-e2e.sh. # - # SCIM's hosted suites use 8 vCPU; the other self-hosted suites fit on 4. The mobile browser - # suite runs in e2e-mobile below. + # All groups reuse the production build; compiling routes is not part of HTTP acceptance. e2e: name: e2e (${{ matrix.group }}) - needs: changes - if: needs.changes.outputs.full == 'true' - runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && matrix.runner || 'ubuntu-latest' }} + needs: [changes, e2e-build] + if: needs.changes.outputs.http == 'true' + runs-on: ubuntu-24.04 timeout-minutes: 20 strategy: fail-fast: false - matrix: - include: - - group: scim - runner: blacksmith-8vcpu-ubuntu-2404 - - group: cli - runner: blacksmith-4vcpu-ubuntu-2404 - - group: stop-after - runner: blacksmith-4vcpu-ubuntu-2404 - - group: project-files - runner: blacksmith-8vcpu-ubuntu-2404 - - group: desktop-inbox - runner: blacksmith-4vcpu-ubuntu-2404 + matrix: ${{ fromJSON(needs.changes.outputs.http_matrix) }} services: postgres: image: pgvector/pgvector:pg17 @@ -214,9 +217,9 @@ jobs: --health-interval 5s --health-timeout 5s --health-retries 10 - # Project file subscriptions and the desktop executor use Redis. + # Desktop inbox and Project Files use Redis. redis: - image: redis:8.2-alpine + image: ${{ (matrix.group == 'desktop-inbox' || matrix.group == 'project-files') && 'redis:8.2-alpine' || '' }} ports: - 6379:6379 options: >- @@ -227,22 +230,46 @@ jobs: env: DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/sim_test BETTER_AUTH_SECRET: http-e2e-ci-secret-at-least-32-characters + E2E_APP_SERVER: start + E2E_APP_PUBLIC_URL: ${{ matrix.group == 'scim' && 'http://scim-e2e.sim.ai:3017' || '' }} + INTERNAL_API_BASE_URL: ${{ matrix.group == 'scim' && 'http://127.0.0.1:3017' || '' }} + TRUSTED_ORIGINS: ${{ matrix.group == 'scim' && 'http://127.0.0.1:3017' || '' }} + PROJECT_FILES_E2E_APP_SERVER: start ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' steps: - - *checkout-mirror - - *checkout-plain + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 - name: Setup workspace uses: ./.github/actions/setup with: - provider: ${{ vars.CI_PROVIDER }} + provider: github # Migrations create their own extensions, as on a fresh self-hosted install. - name: Provision the database through migrations + if: matrix.group != 'project-files' working-directory: packages/db run: bun run db:migrate + - &download-e2e-build + name: Download the production build + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: next-build + path: ${{ runner.temp }} + + # A hosted build (NEXT_PUBLIC_APP_URL on sim.ai) prerenders every post; the build production + # images use prerenders none. The URL itself is no marker: next.config's redirects name + # www.sim.ai in every build. + - &extract-e2e-build + name: Extract the production build + run: | + tar -I zstd -xf "$RUNNER_TEMP/next-build.tar.zst" -C apps/sim + jq -e '[.routes[].srcRoute] | any(. == "/blog/[slug]" or . == "/library/[slug]") | not' \ + apps/sim/.next/prerender-manifest.json > /dev/null || + { echo "::error::The build prerendered posts (a hosted build) or has no prerender manifest."; exit 1; } + # JOBS=4 caps node-gyp parallelism as docker/app.Dockerfile does (laverdet/isolated-vm#428). - name: Build native isolate addon for Project file rendering if: matrix.group == 'project-files' @@ -254,12 +281,25 @@ jobs: cd "$addon_dir" bun run install + - name: Map the hosted SCIM fixture to loopback + if: matrix.group == 'scim' + run: printf '127.0.0.1 scim-e2e.sim.ai\n' | sudo tee -a /etc/hosts + # No step timeout: the job's bound covers a hang without cutting a slow but healthy suite # short of writing its report. - name: Run end-to-end suites working-directory: apps/sim run: bash ../../.github/scripts/http-e2e.sh "${{ matrix.group }}" + - name: Upload acceptance timing and coverage reports + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: e2e-reports-${{ matrix.group }} + path: ${{ runner.temp }}/e2e/**/*.json + if-no-files-found: ignore + retention-days: 7 + - name: Upload end-to-end reports and server logs if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 @@ -269,23 +309,22 @@ jobs: if-no-files-found: ignore retention-days: 7 - # The mobile browser suite against the production build e2e-build uploads, served by - # `next start` (http-e2e.sh), one browser per job: Chromium and WebKit no longer run back to - # back, and no route waits on a dev compile. Gated like `e2e`, on a build that already ran. + # Browser suites reuse the production build, avoiding dev-route compiles. + # Each job has its own database and runtime flags; the build reads public env at startup. + # Each browser partitions the full viewport list across two shards, including future additions. # # 8 vCPU: `next start`, Postgres, the realtime server and one Playwright browser would fit a 4 # vCPU runner's 16 GB, but the suite is timing-sensitive, and CPU contention between the browser # and the server is what turns a slow tap into a flake. - e2e-mobile: - name: e2e (mobile, ${{ matrix.browser }}) + e2e-production: + name: e2e (${{ matrix.name }}) needs: [changes, e2e-build] - if: needs.changes.outputs.full == 'true' + if: needs.changes.outputs.production == 'true' runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }} timeout-minutes: 25 strategy: fail-fast: false - matrix: - browser: [chromium, webkit] + matrix: ${{ fromJSON(needs.changes.outputs.production_matrix) }} services: postgres: image: pgvector/pgvector:pg17 @@ -306,8 +345,20 @@ jobs: ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' steps: - - *checkout-mirror - - *checkout-plain + # A same-repository pull request checks out through a git mirror on a sticky disk, so a slow + # clone from GitHub (1 in 10 took a minute or more, up to 4) no longer sets the run's pace. + # The mirror is one disk per repository that job steps can write to, so fork pull requests + # and pushes, whose checks gate a deploy, keep the plain checkout: same trust split as the + # setup action's caches. + - &checkout-mirror + name: Checkout code (mirror) + if: (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork + uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1.8.1 + - &checkout-plain + name: Checkout code + if: (vars.CI_PROVIDER != '' && vars.CI_PROVIDER != 'blacksmith') || github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + - name: Setup workspace uses: ./.github/actions/setup @@ -318,46 +369,43 @@ jobs: working-directory: packages/db run: bun run db:migrate - - name: Download the production build - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - name: next-build - path: ${{ runner.temp }} - - # A hosted build (NEXT_PUBLIC_APP_URL on sim.ai) prerenders every post; the build production - # images use prerenders none. The URL itself is no marker: next.config's redirects name - # www.sim.ai in every build. - - name: Extract the production build - run: | - tar -I zstd -xf "$RUNNER_TEMP/next-build.tar.zst" -C apps/sim - jq -e '[.routes[].srcRoute] | any(. == "/blog/[slug]" or . == "/library/[slug]") | not' \ - apps/sim/.next/prerender-manifest.json > /dev/null || - { echo "::error::The build prerendered posts (a hosted build) or has no prerender manifest."; exit 1; } + - *download-e2e-build + - *extract-e2e-build - name: Run end-to-end suites working-directory: apps/sim env: MOBILE_E2E_BROWSER: ${{ matrix.browser }} - run: bash ../../.github/scripts/http-e2e.sh mobile + MOBILE_E2E_SHARD: ${{ matrix.shard }} + run: bash ../../.github/scripts/http-e2e.sh "${{ matrix.group }}" - name: Upload end-to-end reports and server logs if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: http-e2e-mobile-${{ matrix.browser }} + name: http-e2e-${{ matrix.artifact }} path: ${{ runner.temp }}/e2e/ if-no-files-found: ignore retention-days: 7 - # Desktop tools in the real Electron app against a local app, on its own runner: the - # Electron app, the dev app and its realtime server together outgrow the e2e runner. + - name: Upload acceptance timing and coverage reports + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: e2e-reports-${{ matrix.artifact }} + path: ${{ runner.temp }}/e2e/**/*.json + if-no-files-found: ignore + retention-days: 7 + + # Desktop tools exercise the real Electron app against the shared production build. + # Hosted 4-vCPU runs passed both shards within 14 seconds of 8-vCPU; production peak ~4 GB. # Two runners: the lease-lapse test sleeps through a long import and then a lease (~3 min), as # long as the rest of the spec together, so on one runner it set the time for every run. desktop-live: name: desktop-live (${{ matrix.tests }}) - needs: changes + needs: [changes, e2e-build] if: needs.changes.outputs.desktop_live == 'true' - runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-16vcpu-ubuntu-2404' || 'ubuntu-latest' }} + runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} timeout-minutes: 30 strategy: fail-fast: false @@ -408,22 +456,8 @@ jobs: working-directory: packages/db run: bun run db:migrate - # Turbopack's dev cache turns the spec's route warm-up from a cold compile (~4 min) into a - # restore. It is content-addressed, so a pull request's changed modules still recompile; the - # key carries the installed Next version so an upgrade starts from an empty cache, and the - # event and fork segments keep untrusted runs off the cache trusted runs read. - - name: Resolve Turbopack dev cache key - id: next-cache - run: echo "key=${GITHUB_REPOSITORY}-next-dev-desktop-live-${GITHUB_EVENT_NAME}${FORK_SUFFIX}-$(jq -r .version node_modules/next/package.json)" >> "$GITHUB_OUTPUT" - env: - FORK_SUFFIX: ${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} - - - name: Mount Turbopack dev cache - uses: ./.github/actions/cache - with: - provider: ${{ vars.CI_PROVIDER }} - key: ${{ steps.next-cache.outputs.key }} - path: ./apps/sim/.next/dev + - *download-e2e-build + - *extract-e2e-build # Chat switches, Stop, sign-out, approval, the dormant-executor round trip, and background # runs across a chat switch and a network cut. The spec runs the recording proxy (the app's @@ -434,6 +468,7 @@ jobs: BETTER_AUTH_URL: http://127.0.0.1:3020 REDIS_URL: redis://127.0.0.1:6379 SIM_AGENT_API_URL: http://127.0.0.1:3022 + SIM_DESKTOP_E2E_APP_SERVER: start NEXT_PUBLIC_SOCKET_URL: http://127.0.0.1:3023 SOCKET_SERVER_URL: http://127.0.0.1:3023 NEXT_PUBLIC_FORCE_HOSTED: 'false' @@ -452,37 +487,12 @@ jobs: # every process it started has exited. realtime_tag="desktop-realtime-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT-$$" server_tag="desktop-tools-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT-$$" - # Keeps the restored cache under the cap the dev scripts apply locally. - (cd apps/sim && bun run dev:cache:cap) start_sim() { - (cd apps/sim && E2E_APP="$server_tag" exec setsid node ../../node_modules/next/dist/bin/next dev --hostname 127.0.0.1 \ + (cd apps/sim && E2E_APP="$server_tag" LOG_LEVEL=INFO exec setsid node ../../node_modules/next/dist/bin/next start --hostname 127.0.0.1 \ --port 3021 >> "$next_log" 2>&1) & server_pid=$! } - # A corrupted cache aborts Turbopack instead of falling back. Only then is the shared cache - # dropped: a failing test must not cost every later run its warm cache. - cache_broken() { - grep -qiE 'cache corruption|turbopack.*panic|panicked' "$next_log" 2>/dev/null - } - # The cache directory is a mount point: empty it rather than remove it. Absolute, because - # the EXIT trap runs after the step has moved into apps/desktop. - clear_cache() { - find "$GITHUB_WORKSPACE/apps/sim/.next/dev" -mindepth 1 -maxdepth 1 -exec rm -rf {} + - } - # A sticky disk keeps nothing from a failed job, so a clear here sticks only when the job - # passes. The marker names the cache for desktop-live-cache-reset, which empties it after - # a failed job; written on each panic, it survives the restart truncating the log. - mark_cache_broken() { - jq -r .version "$GITHUB_WORKSPACE/node_modules/next/package.json" > "$report_dir/turbopack-cache-broken" - } - # SIGINT first: `next dev` SIGKILLs its server 100ms after SIGTERM, which discards a cache - # write in flight. stop-session.sh then removes anything still running. - # SIGINT is best-effort; the cleanup always runs, since workers and the detached telemetry - # flush can outlive a server that has already exited. stop_sim() { - if kill -INT "$server_pid" 2>/dev/null; then - for _ in $(seq 1 30); do kill -0 "$server_pid" 2>/dev/null || break; sleep 1; done - fi bash "$GITHUB_WORKSPACE/.github/scripts/stop-session.sh" "$server_pid" "$server_tag" } (cd apps/realtime && PORT=3023 SIM_DB_ROLE=realtime ALLOWED_ORIGINS="$NEXT_PUBLIC_APP_URL" \ @@ -494,11 +504,6 @@ jobs: stop_sim || status=1 bash "$GITHUB_WORKSPACE/.github/scripts/stop-session.sh" "$realtime_pid" "$realtime_tag" || status=1 wait "$server_pid" "$realtime_pid" 2>/dev/null || true - if cache_broken; then - echo "::warning::Turbopack reported a broken dev cache; clearing it for the next run." - mark_cache_broken - clear_cache - fi exit "$status" } trap finish EXIT @@ -510,21 +515,10 @@ jobs: # which a Linux run does not use. (cd apps/desktop && bun run scripts/build.ts) started=$SECONDS - retried=0 until curl --fail --silent --max-time 10 http://127.0.0.1:3021/api/health > /dev/null && curl --fail --silent --max-time 10 http://127.0.0.1:3023/health > /dev/null; do if ! kill -0 "$server_pid" 2>/dev/null; then tail -n 200 "$next_log" - if [ "$retried" = 0 ] && cache_broken; then - echo "::warning::Turbopack rejected the restored dev cache; restarting from an empty cache." - bash "$GITHUB_WORKSPACE/.github/scripts/stop-session.sh" "$server_pid" "$server_tag" - mark_cache_broken - clear_cache - : > "$next_log" - retried=1 - start_sim - continue - fi exit 1 fi kill -0 "$realtime_pid" 2>/dev/null || { tail -n 200 "$report_dir/desktop-tools-realtime.log"; exit 1; } @@ -536,11 +530,21 @@ jobs: SIM_DESKTOP_E2E_SIM_URL=http://127.0.0.1:3021 \ SIM_DESKTOP_E2E_PROXY_PORT=3020 \ SIM_DESKTOP_E2E_AGENT_PORT=3022 \ + PLAYWRIGHT_JSON_OUTPUT_FILE="$report_dir/desktop-tests.json" \ SIM_DESKTOP_E2E_DATABASE_URL="$DATABASE_URL" \ SIM_DESKTOP_E2E_REDIS_URL="$REDIS_URL" \ SIM_DESKTOP_E2E_AUTH_SECRET="$BETTER_AUTH_SECRET" \ xvfb-run -a -s '-screen 0 1920x1200x24' bunx playwright test e2e/desktop-tools-live-sim.spec.ts \ - ${{ matrix.filter }} --output "$report_dir/desktop-tools-results" --retries=0 + ${{ matrix.filter }} --output "$report_dir/desktop-tools-results" --retries=0 --reporter=line,json + + - name: Upload Electron coverage and timings + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: desktop-reports-${{ matrix.tests }} + path: ${{ runner.temp }}/e2e/desktop-tests.json + if-no-files-found: ignore + retention-days: 7 - name: Upload Electron E2E results and server logs if: failure() @@ -551,68 +555,12 @@ jobs: if-no-files-found: ignore retention-days: 7 - # Empties a dev cache Turbopack panicked on in a failed desktop-live run. The run's own clear is - # discarded with the rest of its failed job, so every later run would restore the same broken - # cache and fail; emptied in this passing job, the empty cache is what the next run mounts. A - # failure the cache did not cause leaves no marker, and the warm cache stays. - desktop-live-cache-reset: - name: desktop-live cache reset - needs: desktop-live - if: ${{ always() && needs.desktop-live.result == 'failure' }} - runs-on: *runner-2vcpu - timeout-minutes: 5 - steps: - - name: Download desktop-live results - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 - with: - pattern: desktop-live-e2e-results-* - path: ${{ runner.temp }}/desktop-live - merge-multiple: true - - # The marker carries only the Next version; the rest of the key comes from this run's own - # context, as in desktop-live, so a fork's marker can name no cache but its own. - - name: Resolve the broken cache's key - id: broken - env: - MARKER: ${{ runner.temp }}/desktop-live/turbopack-cache-broken - FORK_SUFFIX: ${{ github.event.pull_request.head.repo.fork && '-fork' || '' }} - run: | - if [ ! -s "$MARKER" ]; then - echo "No broken dev cache reported; keeping the warm cache." - exit 0 - fi - next_version="$(head -n 1 "$MARKER")" - if ! [[ "$next_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+[0-9A-Za-z.-]*$ ]]; then - echo "::error::The broken cache marker holds no Next version: '$next_version'" - exit 1 - fi - echo "key=${GITHUB_REPOSITORY}-next-dev-desktop-live-${GITHUB_EVENT_NAME}${FORK_SUFFIX}-${next_version}" >> "$GITHUB_OUTPUT" - - - *checkout-mirror - - *checkout-plain - - # A desktop-live leg that passed may have saved this run's actions/cache entry already; the - # suffix gives the emptied cache its own, newer entry for the next run's prefix restore. - - name: Mount the broken dev cache - if: steps.broken.outputs.key != '' - uses: ./.github/actions/cache - with: - provider: ${{ vars.CI_PROVIDER }} - key: ${{ steps.broken.outputs.key }} - path: ./apps/sim/.next/dev - save-suffix: -reset - - - name: Empty the dev cache - if: steps.broken.outputs.key != '' - run: | - mkdir -p apps/sim/.next/dev - find apps/sim/.next/dev -mindepth 1 -maxdepth 1 -exec rm -rf {} + - # Lint, audits, type-check and the schema sync check: about two minutes of mostly cached work, # kept off the test shards so neither waits on the other. lint: name: lint - runs-on: *runner-4vcpu + needs: changes + runs-on: &runner-4vcpu ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} timeout-minutes: 15 steps: @@ -624,16 +572,14 @@ jobs: # Worth stating because the failure was invisible for so long: the migration # audit read the resulting `git diff` failure as "no migrations changed" and # exited 0, so it had never actually run on a push build. - # Same mirror/plain split as the integration job's checkout. - - &checkout-mirror-depth2 - name: Checkout code (mirror) - if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork + # Same provider/trust split as the build jobs' checkout. + - name: Checkout code (mirror) + if: (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1.8.1 with: fetch-depth: 2 - - &checkout-plain-depth2 - name: Checkout code - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + - name: Checkout code + if: (vars.CI_PROVIDER != '' && vars.CI_PROVIDER != 'blacksmith') || github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: fetch-depth: 2 @@ -744,14 +690,23 @@ jobs: - name: Migration safety (zero-downtime) audit run: bun run check:migrations "${{ steps.audit_base.outputs.ref }}" - # Every workspace, not just realtime. packages/emcn, packages/utils, + # Every affected workspace, following the same real task graph as tests. Root/unknown + # changes select all. packages/emcn, packages/utils, # apps/desktop and apps/docs had no type check in CI at all; apps/sim's # source was covered only as a side effect of `next build` in the separate # `build` job. This does NOT cover apps/sim's tests — its tsconfig # excludes *.test.ts(x), which carry ~2.2k errors; the `test-types` job # ratchets those per file instead. - - name: Type-check all workspaces - run: bunx turbo run type-check + - name: Type-check affected workspaces + env: + TYPECHECK_PACKAGES: ${{ needs.changes.outputs.typecheck_packages }} + run: | + jq -e 'type == "array" and all(.[]; type == "string")' <<< "$TYPECHECK_PACKAGES" > /dev/null + filters=() + while IFS= read -r package; do filters+=("--filter=$package"); done < <(jq -r '.[]' <<< "$TYPECHECK_PACKAGES") + if [ "${#filters[@]}" -gt 0 ]; then + bunx turbo run type-check "${filters[@]}" + fi - name: Check schema and migrations are in sync working-directory: packages/db @@ -776,7 +731,7 @@ jobs: test-types: name: test-types needs: changes - if: needs.changes.outputs.test == 'true' + if: needs.changes.outputs.test_app == 'true' runs-on: *runner-4vcpu timeout-minutes: 10 @@ -806,24 +761,32 @@ jobs: # the other workspaces. Each shard keeps its own Turbo cache: pass-through args are part of the # task hash, so a shard only ever replays its own result. test: - name: test (${{ matrix.shard }}/2) + name: test (${{ matrix.shard }}/${{ needs.changes.outputs.test_app == 'true' && '2' || '1' }}) needs: changes if: needs.changes.outputs.test == 'true' - runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }} + runs-on: ${{ needs.changes.outputs.test_app == 'true' && (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-24.04' }} timeout-minutes: 15 strategy: fail-fast: false - matrix: - shard: [1, 2] + matrix: ${{ fromJSON(needs.changes.outputs.test_matrix) }} + steps: - - *checkout-mirror-depth2 - - *checkout-plain-depth2 + - name: Checkout code (mirror) + if: needs.changes.outputs.test_app == 'true' && (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork + uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1.8.1 + with: + fetch-depth: 2 + - name: Checkout code + if: needs.changes.outputs.test_app != 'true' || (vars.CI_PROVIDER != '' && vars.CI_PROVIDER != 'blacksmith') || github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + fetch-depth: 2 - name: Setup workspace uses: ./.github/actions/setup with: - provider: ${{ vars.CI_PROVIDER }} + provider: ${{ needs.changes.outputs.test_app != 'true' && 'github' || vars.CI_PROVIDER }} turbo-cache-key: turbo-cache-test-${{ matrix.shard }} # cloud-review-tools.test.ts runs the real helper on the runner, which shells @@ -832,7 +795,7 @@ jobs: run: command -v rg || (sudo apt-get update && sudo apt-get install -y ripgrep) - name: Verify shell placeholder compilation in Bash - if: matrix.shard == 1 + if: matrix.shard == 1 && needs.changes.outputs.test_app == 'true' working-directory: apps/sim env: SHELL_PLACEHOLDERS_REPORT_PATH: ${{ runner.temp }}/shell-placeholders.json @@ -854,13 +817,22 @@ jobs: DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/simstudio' ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' # dummy key for CI only TURBO_CACHE_DIR: .turbo + TEST_APP: ${{ needs.changes.outputs.test_app }} + TEST_PACKAGES: ${{ needs.changes.outputs.test_packages }} SHARD: ${{ matrix.shard }} run: | if [ "$SHARD" = 1 ]; then bun run test:scripts - bunx turbo run test --filter='!@sim/app' + jq -e 'type == "array" and all(.[]; type == "string")' <<< "$TEST_PACKAGES" > /dev/null + filters=() + while IFS= read -r package; do filters+=("--filter=$package"); done < <(jq -r '.[]' <<< "$TEST_PACKAGES") + if [ "${#filters[@]}" -gt 0 ]; then + bunx turbo run test "${filters[@]}" --filter='!@sim/app' + fi + fi + if [ "$TEST_APP" = true ]; then + bunx turbo run test --filter=@sim/app -- --shard="$SHARD/2" fi - bunx turbo run test --filter=@sim/app -- --shard="$SHARD/2" # Next.js production build, in parallel with lint + tests. Sticky disks are # cloned from the last committed snapshot per job and committed last-writer- @@ -931,7 +903,7 @@ jobs: TURBO_CACHE_DIR: .turbo run: bunx turbo run build --filter=@sim/app - # The production build e2e-mobile serves with `next start`, built in the public-env mode + # The production build e2e-production serves with `next start`, built in the public-env mode # production images use: NEXT_PUBLIC_APP_URL is docker/app.Dockerfile's localhost default, so # every route is dynamic and NEXT_PUBLIC_* are read at start. (Images run the standalone # DOCKER_BUILD server; this is the plain `next build` output.) The `build` job above keeps the @@ -941,7 +913,7 @@ jobs: e2e-build: name: build (e2e) needs: changes - if: needs.changes.outputs.full == 'true' + if: needs.changes.outputs.e2e_build == 'true' runs-on: ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-16vcpu-ubuntu-2404' || 'linux-x64-8-core' }} timeout-minutes: 25 @@ -974,24 +946,26 @@ jobs: AWS_REGION: 'us-west-2' ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000' # dummy key for CI only TURBO_CACHE_DIR: .turbo - # This build is on the e2e-mobile critical path; its ~30 s TypeScript pass repeats what + # This build is on the e2e-production critical path; its ~30 s TypeScript pass repeats what # lint's type-check and the `build` job's own `next build` (generated route types too) # already enforce. NEXT_BUILD_SKIP_TYPE_CHECK: 'true' run: bunx turbo run build --filter=@sim/app - # Everything `next start` reads; node_modules and the source tree come from e2e-mobile's own - # checkout and setup, at the same workspace path and lockfile. Source maps are over half the - # build and only serve stack traces and devtools, which the suite never reads. - - name: Package the build for e2e-mobile + # Everything `next start` reads, including the spreadsheet parse worker it spawns (named, so a + # missing bundle fails packaging as it fails docker/app.Dockerfile); node_modules and the source + # tree come from e2e-production's own checkout and setup, at the same workspace path and + # lockfile. Source maps are over half the build and only serve stack traces and devtools, which + # the suite never reads. + - name: Package the build for e2e-production run: >- tar -I 'zstd -T0' -cf "$RUNNER_TEMP/next-build.tar.zst" -C apps/sim - --exclude .next/cache --exclude .next/trace --exclude '*.map' .next + --exclude .next/cache --exclude .next/trace --exclude '*.map' .next dist/xlsx-worker.mjs # Already zstd-compressed, so stored without zip compression. `overwrite` lets a re-run of # this job replace the earlier attempt's build; three days covers re-running a failed shard # after a weekend. - - name: Upload the build for e2e-mobile + - name: Upload the build for e2e-production uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: next-build @@ -1011,13 +985,15 @@ jobs: ci: name: ci needs: - [changes, integration, e2e, e2e-mobile, desktop-live, lint, test-types, test, build, e2e-build] + [changes, integration, e2e, e2e-production, desktop-live, lint, test-types, test, build, e2e-build] if: ${{ always() }} runs-on: *runner-2vcpu timeout-minutes: 5 steps: - - *checkout-mirror - - *checkout-plain + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + sparse-checkout: .github/scripts - name: Require every check to pass env: NEEDS: ${{ toJSON(needs) }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6482b395ea2..62879db98f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,8 @@ name: ci # A repo variable, not a committed value: during a Blacksmith outage there is no # working CI to merge a switchover through. Only unset/'blacksmith' selects # Blacksmith; anything unrecognized selects GitHub so a typo can't queue jobs -# against the provider you're escaping. Every runs-on and both composite actions -# share this predicate and must change together. +# against the provider you're escaping. Paid build/browser jobs and their cache actions share +# this predicate. Task planning, the aggregate gate, HTTP acceptance and integration tests use free GitHub runners. # # GitHub mode is break-glass, not a peer — cold layers, slower runs. The app image # is the one job on a paid larger runner: next build needs ~32 GB and OOM-kills diff --git a/.github/workflows/desktop-e2e.yml b/.github/workflows/desktop-e2e.yml index 3acd0e4b6b4..a91e7010363 100644 --- a/.github/workflows/desktop-e2e.yml +++ b/.github/workflows/desktop-e2e.yml @@ -1,6 +1,8 @@ name: desktop-e2e -# Smoke coverage of the real Electron shell on desktop changes, plus a weekly +# Smoke coverage of the real Electron shell on desktop changes. Three isolated runners +# partition complete test files by measured duration; workers remain serial per runner. +# The weekly # advisory canary against electron@latest so Chromium-cadence breakage surfaces # before an upgrade is attempted. @@ -45,6 +47,8 @@ on: - 'packages/utils/**' - 'bun.lock' - 'package.json' + - 'scripts/desktop-e2e.ts' + - 'scripts/duration-shards.ts' schedule: - cron: '23 9 * * 1' workflow_dispatch: @@ -58,10 +62,14 @@ concurrency: jobs: e2e: - name: e2e + name: e2e (${{ matrix.shard }}/3) if: github.event_name != 'schedule' runs-on: macos-26 timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + shard: [1, 2, 3] steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 @@ -102,8 +110,9 @@ jobs: - name: Run Playwright _electron smoke suite working-directory: apps/desktop - run: bunx playwright test + run: bun run ../../scripts/desktop-e2e.ts ${{ matrix.shard }}/3 env: + PLAYWRIGHT_JSON_OUTPUT_FILE: test-results/desktop-smoke.json BACKGROUND_EXECUTOR_REPORT_PATH: test-results/background-executor-report.json TERMINAL_CANCEL_REPORT_PATH: test-results/terminal-cancel-report.json @@ -111,10 +120,22 @@ jobs: if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: desktop-e2e-results-pinned + name: desktop-e2e-results-pinned-${{ matrix.shard }} path: apps/desktop/test-results retention-days: 7 + - name: Upload smoke coverage and timings + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: desktop-smoke-reports-${{ matrix.shard }} + path: | + apps/desktop/test-results/desktop-smoke.json + apps/desktop/test-results/desktop-shard-plan.json + apps/desktop/test-results/desktop-discovery.json + if-no-files-found: ignore + retention-days: 7 + e2e-canary: name: e2e-canary if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' diff --git a/apps/desktop/e2e-durations.json b/apps/desktop/e2e-durations.json new file mode 100644 index 00000000000..2557a2730a8 --- /dev/null +++ b/apps/desktop/e2e-durations.json @@ -0,0 +1,20 @@ +{ + "background-executor.spec.ts": 131.12, + "browser-chrome.spec.ts": 15.28, + "browser-focus.spec.ts": 6.53, + "browser-page-dialogs.spec.ts": 11.81, + "browser-tools.spec.ts": 94.66, + "chat-panel.spec.ts": 31.08, + "check-report.spec.ts": 3.78, + "computer-use.spec.ts": 2.07, + "desktop-tools-live-sim.spec.ts": 0.0, + "local-files.spec.ts": 27.68, + "packaged-smoke.spec.ts": 0.0, + "password-autofill.spec.ts": 46.56, + "session-cookies.spec.ts": 11.45, + "smoke.spec.ts": 25.56, + "source-connect.spec.ts": 41.49, + "terminal-cancel.spec.ts": 199.76, + "update-notification.spec.ts": 19.55, + "updater.spec.ts": 2.48 +} diff --git a/apps/desktop/e2e/desktop-tools-live-sim.spec.ts b/apps/desktop/e2e/desktop-tools-live-sim.spec.ts index 8feb023bd96..f83e6c61917 100644 --- a/apps/desktop/e2e/desktop-tools-live-sim.spec.ts +++ b/apps/desktop/e2e/desktop-tools-live-sim.spec.ts @@ -79,7 +79,8 @@ test.describe('desktop tools against a live Sim', () => { db = new SimDatabase(sim) await Promise.all([proxy.start(), agent.start()]) proxy.rewriteAnswer(REGISTRATION_PATH, executorUnavailable) - await test.step('warm up the routes the tests use', warmUp) + if (process.env.SIM_DESKTOP_E2E_APP_SERVER !== 'start') + await test.step('warm up the routes the tests use', warmUp) }) test.afterAll(async () => { diff --git a/apps/docs/components/icons.tsx b/apps/docs/components/icons.tsx index dcb707bcf4b..5fab254e1bd 100644 --- a/apps/docs/components/icons.tsx +++ b/apps/docs/components/icons.tsx @@ -7251,6 +7251,18 @@ export function LambdaIcon(props: SVGProps) { ) } +export function EC2Icon(props: SVGProps) { + return ( + + + + ) +} + export function AthenaIcon(props: SVGProps) { return ( = { duckduckgo: DuckDuckGoIcon, dynamodb: DynamoDBIcon, dynatrace: DynatraceIcon, + ec2: EC2Icon, elasticsearch: ElasticsearchIcon, elevenlabs: ElevenLabsIcon, emailbison: EmailBisonIcon, diff --git a/apps/docs/content/docs/cli/knowledge.mdx b/apps/docs/content/docs/cli/knowledge.mdx index 29bad7ed758..b08a06d5396 100644 --- a/apps/docs/content/docs/cli/knowledge.mdx +++ b/apps/docs/content/docs/cli/knowledge.mdx @@ -173,7 +173,7 @@ sim knowledge restore API request and response schemas: [restoreKnowledgeBase](/api-reference/knowledge-bases/restoreKnowledgeBase). -## Search and export +## Search ### Search knowledge @@ -201,6 +201,8 @@ sim knowledge search [options] API request and response schemas: [searchKnowledge](/api-reference/knowledge-bases/searchKnowledge). +## Export and import + ### Export a knowledge base as a .simkb.zip bundle ```bash @@ -231,6 +233,71 @@ sim knowledge export [options] API request and response schemas: [exportKnowledgeBase](/api-reference/knowledge-bases/exportKnowledgeBase). +### Create a knowledge base from an exported .simkb.zip bundle + +```bash +sim knowledge import [options] +``` + +**Arguments** + + + +| Argument | Required | Description | +| --- | --- | --- | +| `path` | Yes | Bundle archive written by `sim knowledge export` | + + + +**Options** + + + +| Option | Required | Description | +| --- | --- | --- | +| `--name ` | No | Name for the new knowledge base; defaults to the bundle's own name. | +| `--no-wait` | No | Return once the import is started instead of watching it. | + + + +API request and response schemas: [createKnowledgeImport](/api-reference/knowledge-bases/createKnowledgeImport), [createKnowledgeImportPartUrls](/api-reference/knowledge-bases/createKnowledgeImportPartUrls), [completeKnowledgeImport](/api-reference/knowledge-bases/completeKnowledgeImport), [cancelKnowledgeImport](/api-reference/knowledge-bases/cancelKnowledgeImport), [getKnowledgeImport](/api-reference/knowledge-bases/getKnowledgeImport). + +### Get knowledge base import + +```bash +sim knowledge imports get +``` + +**Arguments** + + + +| Argument | Required | Description | +| --- | --- | --- | +| `importId` | Yes | Unique knowledge-base import identifier. | + + + +API request and response schemas: [getKnowledgeImport](/api-reference/knowledge-bases/getKnowledgeImport). + +### Stop a running import + +```bash +sim knowledge imports cancel +``` + +**Arguments** + + + +| Argument | Required | Description | +| --- | --- | --- | +| `importId` | Yes | Unique knowledge-base import identifier. | + + + +API request and response schemas: [cancelKnowledgeImport](/api-reference/knowledge-bases/cancelKnowledgeImport). + ## Documents ### List documents diff --git a/apps/docs/content/docs/cli/reference.mdx b/apps/docs/content/docs/cli/reference.mdx index a7ad4a0f55b..5e6b7136d8e 100644 --- a/apps/docs/content/docs/cli/reference.mdx +++ b/apps/docs/content/docs/cli/reference.mdx @@ -2491,6 +2491,46 @@ sim knowledge documents upload [options] API request and response schemas: [createKnowledgeDocumentUpload](/api-reference/knowledge-bases/createKnowledgeDocumentUpload), [createKnowledgeDocumentUploadPartUrls](/api-reference/knowledge-bases/createKnowledgeDocumentUploadPartUrls), [completeKnowledgeDocumentUpload](/api-reference/knowledge-bases/completeKnowledgeDocumentUpload), [abortKnowledgeDocumentUpload](/api-reference/knowledge-bases/abortKnowledgeDocumentUpload). +### sim knowledge imports cancel + +Stop a running import + +```bash +sim knowledge imports cancel +``` + +**Arguments** + + + +| Argument | Required | Description | +| --- | --- | --- | +| `importId` | Yes | Unique knowledge-base import identifier. | + + + +API request and response schemas: [cancelKnowledgeImport](/api-reference/knowledge-bases/cancelKnowledgeImport). + +### sim knowledge imports get + +Get knowledge base import + +```bash +sim knowledge imports get +``` + +**Arguments** + + + +| Argument | Required | Description | +| --- | --- | --- | +| `importId` | Yes | Unique knowledge-base import identifier. | + + + +API request and response schemas: [getKnowledgeImport](/api-reference/knowledge-bases/getKnowledgeImport). + ### sim knowledge create Create knowledge base @@ -3079,6 +3119,37 @@ sim knowledge export [options] API request and response schemas: [exportKnowledgeBase](/api-reference/knowledge-bases/exportKnowledgeBase). +### sim knowledge import + +Create a knowledge base from an exported .simkb.zip bundle + +```bash +sim knowledge import [options] +``` + +**Arguments** + + + +| Argument | Required | Description | +| --- | --- | --- | +| `path` | Yes | Bundle archive written by `sim knowledge export` | + + + +**Options** + + + +| Option | Required | Description | +| --- | --- | --- | +| `--name ` | No | Name for the new knowledge base; defaults to the bundle's own name. | +| `--no-wait` | No | Return once the import is started instead of watching it. | + + + +API request and response schemas: [createKnowledgeImport](/api-reference/knowledge-bases/createKnowledgeImport), [createKnowledgeImportPartUrls](/api-reference/knowledge-bases/createKnowledgeImportPartUrls), [completeKnowledgeImport](/api-reference/knowledge-bases/completeKnowledgeImport), [cancelKnowledgeImport](/api-reference/knowledge-bases/cancelKnowledgeImport), [getKnowledgeImport](/api-reference/knowledge-bases/getKnowledgeImport). + ### sim knowledge ls List knowledge resources and child folders together diff --git a/apps/docs/content/docs/integrations/ec2.mdx b/apps/docs/content/docs/integrations/ec2.mdx new file mode 100644 index 00000000000..d41a80954c8 --- /dev/null +++ b/apps/docs/content/docs/integrations/ec2.mdx @@ -0,0 +1,1251 @@ +--- +title: Amazon EC2 +description: Manage EC2 instances, Elastic IPs, VPC networking, and EBS +integration: + type: "ec2" + color: "linear-gradient(45deg, #C8511B 0%, #FF9900 100%)" +--- + +import { ReferenceDetails } from "@/components/ui/reference-details" + + +{/* MANUAL-CONTENT-START:intro */} +[Amazon EC2](https://aws.amazon.com/ec2/) provides resizable virtual servers in AWS. The EC2 API also covers the VPC networking around them (subnets, route tables, NAT and internet gateways, security groups, network interfaces, and Elastic IP addresses) and the EBS volumes and snapshots that back them. + +With the Amazon EC2 block, you can: + +- **Inventory and control instances**: List instances with their state, type, IPs, and tags, read status checks and scheduled maintenance events, and start, stop, reboot, or terminate instances +- **Manage Elastic IPs**: List Elastic IP addresses and what they are attached to, allocate new addresses, associate them with an instance or network interface, disassociate them, and release them +- **Inspect VPC networking**: Read VPCs, subnets, route tables with their routes and associations, NAT gateways with their public IPs, internet gateways, network ACLs, VPC endpoints, VPC peering connections, security groups with their inbound and outbound rules, and network interfaces +- **Control security group ingress**: Add an inbound rule, or revoke rules by rule ID or by protocol, ports, and source +- **Work with EBS**: List volumes and snapshots, create a snapshot of a volume, and delete volumes and snapshots +- **Tag resources**: Add, overwrite, or remove tags on any EC2 resource ID +- **Explore the account**: List AMIs, key pairs, Regions, and Availability Zones + +## Credentials and permissions + +The block authenticates with an AWS access key ID and secret access key and runs in the region you set. Grant the IAM principal only the EC2 actions the operations you use require. Each operation maps to the IAM action of the same name, for example `ec2:DescribeAddresses`, `ec2:DescribeNatGateways`, and `ec2:DescribeRouteTables` for a read-only egress audit, or `ec2:StopInstances` and `ec2:StartInstances` for scheduling. + +List operations accept EC2 filters such as `[{"Name": "vpc-id", "Values": ["vpc-0abc123"]}]`. Without IDs they return up to 100 results per page, with a `nextToken` for the next page. + +In Sim, the Amazon EC2 block lets your agents map which public IPs your subnets egress through, find idle Elastic IPs and unattached volumes, audit and close open security group rules, back up volumes and prune old snapshots on a schedule, and stop non-production instances outside working hours. +{/* MANUAL-CONTENT-END */} + +## Use the block [#usage-instructions] + +Integrate Amazon EC2 into workflows. Describe and control instances, manage Elastic IP addresses, inspect VPCs, subnets, route tables, NAT and internet gateways, security groups, and network interfaces, add and revoke security group ingress rules, inspect network ACLs, VPC endpoints, and peering connections, work with EBS volumes and snapshots, list AMIs and key pairs, and tag resources. Requires an AWS access key with the matching ec2:* IAM permissions. + +## Actions + +### EC2 Describe Instances + +List EC2 instances with their state, type, networking, and tags + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `instanceIds` | string | No | Comma-separated instance IDs \(e.g., i-0abc123,i-0def456\). Leave empty to list all | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"instance-state-name","Values":\["running"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `instances` | array | EC2 instances | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `instanceId` | string | Instance ID | +| ↳ `instanceType` | string | Instance type \(e.g., t3.micro\) | +| ↳ `state` | string | Instance state \(pending, running, stopping, stopped, shutting-down, terminated\) | +| ↳ `stateReason` | string | Reason for the most recent state transition | +| ↳ `launchTime` | string | Launch time \(ISO 8601\) | +| ↳ `availabilityZone` | string | Availability Zone | +| ↳ `vpcId` | string | VPC ID | +| ↳ `subnetId` | string | Subnet ID | +| ↳ `privateIpAddress` | string | Primary private IPv4 address | +| ↳ `publicIpAddress` | string | Public IPv4 address | +| ↳ `privateDnsName` | string | Private DNS name | +| ↳ `publicDnsName` | string | Public DNS name | +| ↳ `imageId` | string | AMI ID used to launch the instance | +| ↳ `keyName` | string | Key pair name | +| ↳ `platformDetails` | string | Platform details \(e.g., Linux/UNIX, Windows\) | +| ↳ `architecture` | string | CPU architecture | +| ↳ `iamInstanceProfileArn` | string | ARN of the attached IAM instance profile | +| ↳ `securityGroups` | array | Attached security groups | +| ↳ `groupId` | string | Security group ID | +| ↳ `groupName` | string | Security group name | + + + +### EC2 Describe Instance Status + +Get status checks and scheduled events for EC2 instances + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `instanceIds` | string | No | Comma-separated instance IDs \(max 100\). Leave empty to describe all | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"instance-status.status","Values":\["impaired"\]\}\] | +| `includeAllInstances` | boolean | No | Include instances that are not running \(by default only running instances are returned\) | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `instanceStatuses` | array | Status of each instance | +| ↳ `instanceId` | string | Instance ID | +| ↳ `availabilityZone` | string | Availability Zone | +| ↳ `instanceState` | string | Instance state \(e.g., running, stopped\) | +| ↳ `instanceStatus` | string | Instance status check \(ok, impaired, initializing, insufficient-data, not-applicable\) | +| ↳ `systemStatus` | string | System status check \(ok, impaired, initializing, insufficient-data, not-applicable\) | +| ↳ `attachedEbsStatus` | string | Attached EBS status check | +| ↳ `events` | array | Scheduled events | +| ↳ `code` | string | Event code \(e.g., system-reboot, instance-retirement\) | +| ↳ `description` | string | Event description | +| ↳ `notBefore` | string | Earliest start time \(ISO 8601\) | +| ↳ `notAfter` | string | Latest end time \(ISO 8601\) | + + + +### EC2 Start Instances + +Start one or more stopped EC2 instances + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `instanceIds` | string | Yes | Comma-separated instance IDs to start | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `instances` | array | State transition for each instance | +| ↳ `instanceId` | string | Instance ID | +| ↳ `currentState` | string | State after the request \(e.g., pending, running\) | +| ↳ `previousState` | string | State before the request | + + + +### EC2 Stop Instances + +Stop one or more running EC2 instances + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `instanceIds` | string | Yes | Comma-separated instance IDs to stop | +| `hibernate` | boolean | No | Hibernate the instances instead of stopping them \(hibernation must be enabled on the instance\) | +| `force` | boolean | No | Force the instances to stop without flushing file system caches | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `instances` | array | State transition for each instance | +| ↳ `instanceId` | string | Instance ID | +| ↳ `currentState` | string | State after the request \(e.g., stopping, stopped\) | +| ↳ `previousState` | string | State before the request | + + + +### EC2 Reboot Instances + +Request a reboot of one or more EC2 instances + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `instanceIds` | string | Yes | Comma-separated instance IDs to reboot | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `rebooted` | boolean | Whether the reboot request was accepted | +| `instanceIds` | array | Instance IDs that were sent the reboot request | + + + +### EC2 Terminate Instances + +Permanently terminate one or more EC2 instances + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `instanceIds` | string | Yes | Comma-separated instance IDs to terminate | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `instances` | array | State transition for each instance | +| ↳ `instanceId` | string | Instance ID | +| ↳ `currentState` | string | State after the request \(e.g., shutting-down, terminated\) | +| ↳ `previousState` | string | State before the request | + + + +### EC2 Describe Addresses + +List Elastic IP addresses and what they are associated with + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `publicIps` | string | No | Comma-separated Elastic IP addresses to describe | +| `allocationIds` | string | No | Comma-separated allocation IDs \(e.g., eipalloc-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"domain","Values":\["vpc"\]\}\] | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `addresses` | array | Elastic IP addresses | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `publicIp` | string | Elastic IP address | +| ↳ `allocationId` | string | Allocation ID | +| ↳ `associationId` | string | Association ID when associated | +| ↳ `domain` | string | Address scope \(vpc or standard\) | +| ↳ `instanceId` | string | Associated instance ID | +| ↳ `networkInterfaceId` | string | Associated network interface ID | +| ↳ `networkInterfaceOwnerId` | string | AWS account ID that owns the network interface | +| ↳ `privateIpAddress` | string | Associated private IP address | +| ↳ `publicIpv4Pool` | string | Public IPv4 pool the address came from | +| ↳ `networkBorderGroup` | string | Network border group the address is advertised from | +| ↳ `serviceManaged` | string | AWS service managing the address, if any \(e.g., alb, nlb\) | + + + +### EC2 Allocate Address + +Allocate a new Elastic IP address for use in a VPC + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `networkBorderGroup` | string | No | Network border group to allocate from \(defaults to the region\) | +| `publicIpv4Pool` | string | No | BYOIP address pool to allocate from \(defaults to the Amazon pool\) | +| `tags` | json | No | Tags to apply as a JSON object, e.g. \{"Name":"web-eip"\} | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `allocationId` | string | Allocation ID of the new Elastic IP | +| `publicIp` | string | Allocated Elastic IP address | +| `domain` | string | Address scope \(vpc\) | +| `networkBorderGroup` | string | Network border group | +| `publicIpv4Pool` | string | Public IPv4 pool | + + + +### EC2 Associate Address + +Associate an Elastic IP address with an instance or network interface + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `allocationId` | string | Yes | Allocation ID of the Elastic IP \(e.g., eipalloc-0abc123\) | +| `instanceId` | string | No | Instance ID to associate with \(provide this or networkInterfaceId\) | +| `networkInterfaceId` | string | No | Network interface ID to associate with \(provide this or instanceId\) | +| `privateIpAddress` | string | No | Private IP address on the target to associate with | +| `allowReassociation` | boolean | No | Allow moving an Elastic IP that is already associated | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `associationId` | string | ID of the new association | + + + +### EC2 Disassociate Address + +Disassociate an Elastic IP address from its instance or network interface + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `associationId` | string | Yes | Association ID of the Elastic IP \(e.g., eipassoc-0abc123\) | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `disassociated` | boolean | Whether the address was disassociated | +| `associationId` | string | Association ID that was removed | + + + +### EC2 Release Address + +Release an Elastic IP address back to AWS + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `allocationId` | string | Yes | Allocation ID of the Elastic IP to release | +| `networkBorderGroup` | string | No | Network border group the address was allocated from | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `released` | boolean | Whether the address was released | +| `allocationId` | string | Allocation ID that was released | + + + +### EC2 Describe NAT Gateways + +List NAT gateways with their state, subnet, and IP addresses + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `natGatewayIds` | string | No | Comma-separated NAT gateway IDs \(e.g., nat-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `natGateways` | array | NAT gateways | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `natGatewayId` | string | NAT gateway ID | +| ↳ `state` | string | State \(pending, failed, available, deleting, deleted\) | +| ↳ `connectivityType` | string | Connectivity type \(public or private\) | +| ↳ `vpcId` | string | VPC ID | +| ↳ `subnetId` | string | Subnet ID | +| ↳ `createTime` | string | Creation time \(ISO 8601\) | +| ↳ `deleteTime` | string | Deletion time \(ISO 8601\) | +| ↳ `failureCode` | string | Failure code when state is failed | +| ↳ `failureMessage` | string | Failure message when state is failed | +| ↳ `addresses` | array | IP addresses of the NAT gateway | +| ↳ `allocationId` | string | Elastic IP allocation ID | +| ↳ `networkInterfaceId` | string | Network interface ID | +| ↳ `privateIp` | string | Private IP address | +| ↳ `publicIp` | string | Elastic IP address | +| ↳ `associationId` | string | Association ID | +| ↳ `isPrimary` | boolean | Whether this is the primary address | +| ↳ `status` | string | Address status | + + + +### EC2 Describe Route Tables + +List VPC route tables with their routes and subnet associations + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `routeTableIds` | string | No | Comma-separated route table IDs \(e.g., rtb-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-100, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `routeTables` | array | Route tables | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `routeTableId` | string | Route table ID | +| ↳ `vpcId` | string | VPC ID | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `routes` | array | Routes in the table | +| ↳ `destinationCidrBlock` | string | IPv4 destination CIDR | +| ↳ `destinationIpv6CidrBlock` | string | IPv6 destination CIDR | +| ↳ `destinationPrefixListId` | string | Destination prefix list ID | +| ↳ `gatewayId` | string | Internet or virtual private gateway ID \(local for VPC-local routes\) | +| ↳ `natGatewayId` | string | NAT gateway ID | +| ↳ `transitGatewayId` | string | Transit gateway ID | +| ↳ `vpcPeeringConnectionId` | string | VPC peering connection ID | +| ↳ `networkInterfaceId` | string | Network interface ID | +| ↳ `instanceId` | string | NAT instance ID | +| ↳ `egressOnlyInternetGatewayId` | string | Egress-only internet gateway ID | +| ↳ `state` | string | Route state \(active or blackhole\) | +| ↳ `origin` | string | How the route was created | +| ↳ `associations` | array | Subnet and gateway associations | +| ↳ `associationId` | string | Association ID | +| ↳ `main` | boolean | Whether this is the main route table for the VPC | +| ↳ `subnetId` | string | Associated subnet ID | +| ↳ `gatewayId` | string | Associated gateway ID | +| ↳ `state` | string | Association state | + + + +### EC2 Describe VPCs + +List VPCs with their CIDR blocks and state + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `vpcIds` | string | No | Comma-separated VPC IDs \(e.g., vpc-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"is-default","Values":\["false"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `vpcs` | array | VPCs | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `vpcId` | string | VPC ID | +| ↳ `cidrBlock` | string | Primary IPv4 CIDR block | +| ↳ `cidrBlocks` | array | All associated IPv4 CIDR blocks | +| ↳ `ipv6CidrBlocks` | array | Associated IPv6 CIDR blocks | +| ↳ `state` | string | State \(pending or available\) | +| ↳ `isDefault` | boolean | Whether this is the default VPC | +| ↳ `instanceTenancy` | string | Instance tenancy | +| ↳ `dhcpOptionsId` | string | DHCP options set ID | +| ↳ `ownerId` | string | Owning AWS account ID | + + + +### EC2 Describe Subnets + +List subnets with their CIDR, Availability Zone, and free IP count + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `subnetIds` | string | No | Comma-separated subnet IDs \(e.g., subnet-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `subnets` | array | Subnets | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `subnetId` | string | Subnet ID | +| ↳ `subnetArn` | string | Subnet ARN | +| ↳ `vpcId` | string | VPC ID | +| ↳ `cidrBlock` | string | IPv4 CIDR block | +| ↳ `ipv6CidrBlocks` | array | Associated IPv6 CIDR blocks | +| ↳ `availabilityZone` | string | Availability Zone | +| ↳ `availabilityZoneId` | string | Availability Zone ID | +| ↳ `availableIpAddressCount` | number | Number of unused private IPv4 addresses | +| ↳ `state` | string | State \(pending, available, unavailable\) | +| ↳ `defaultForAz` | boolean | Whether this is the default subnet for its Availability Zone | +| ↳ `mapPublicIpOnLaunch` | boolean | Whether instances get a public IPv4 address on launch | +| ↳ `ownerId` | string | Owning AWS account ID | + + + +### EC2 Describe Security Groups + +List security groups with their inbound and outbound rules + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `groupIds` | string | No | Comma-separated security group IDs \(e.g., sg-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `securityGroups` | array | Security groups | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `groupId` | string | Security group ID | +| ↳ `groupName` | string | Security group name | +| ↳ `description` | string | Description | +| ↳ `vpcId` | string | VPC ID | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `ingressRules` | array | Inbound rules | +| ↳ `ipProtocol` | string | IP protocol \(tcp, udp, icmp, or -1 for all\) | +| ↳ `fromPort` | number | Start of the port range | +| ↳ `toPort` | number | End of the port range | +| ↳ `ipv4Ranges` | array | IPv4 CIDR ranges | +| ↳ `cidr` | string | IPv4 CIDR | +| ↳ `description` | string | Rule description | +| ↳ `ipv6Ranges` | array | IPv6 CIDR ranges | +| ↳ `cidr` | string | IPv6 CIDR | +| ↳ `description` | string | Rule description | +| ↳ `referencedGroups` | array | Referenced security groups | +| ↳ `groupId` | string | Security group ID | +| ↳ `userId` | string | Owning AWS account ID | +| ↳ `description` | string | Rule description | +| ↳ `prefixListIds` | array | Referenced prefix list IDs | +| ↳ `egressRules` | array | Outbound rules | +| ↳ `ipProtocol` | string | IP protocol \(tcp, udp, icmp, or -1 for all\) | +| ↳ `fromPort` | number | Start of the port range | +| ↳ `toPort` | number | End of the port range | +| ↳ `ipv4Ranges` | array | IPv4 CIDR ranges | +| ↳ `cidr` | string | IPv4 CIDR | +| ↳ `description` | string | Rule description | +| ↳ `ipv6Ranges` | array | IPv6 CIDR ranges | +| ↳ `cidr` | string | IPv6 CIDR | +| ↳ `description` | string | Rule description | +| ↳ `referencedGroups` | array | Referenced security groups | +| ↳ `groupId` | string | Security group ID | +| ↳ `userId` | string | Owning AWS account ID | +| ↳ `description` | string | Rule description | +| ↳ `prefixListIds` | array | Referenced prefix list IDs | + + + +### EC2 Describe Internet Gateways + +List internet gateways and the VPCs they are attached to + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `internetGatewayIds` | string | No | Comma-separated internet gateway IDs \(e.g., igw-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"attachment.vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `internetGateways` | array | Internet gateways | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `internetGatewayId` | string | Internet gateway ID | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `attachments` | array | VPC attachments | +| ↳ `vpcId` | string | Attached VPC ID | +| ↳ `state` | string | Attachment state | + + + +### EC2 Describe Network Interfaces + +List elastic network interfaces with their IPs, attachment, and security groups + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `networkInterfaceIds` | string | No | Comma-separated network interface IDs \(e.g., eni-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `networkInterfaces` | array | Network interfaces | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `networkInterfaceId` | string | Network interface ID | +| ↳ `interfaceType` | string | Interface type \(e.g., interface, nat_gateway, lambda\) | +| ↳ `status` | string | Status \(available, in-use, attaching, detaching\) | +| ↳ `description` | string | Description | +| ↳ `vpcId` | string | VPC ID | +| ↳ `subnetId` | string | Subnet ID | +| ↳ `availabilityZone` | string | Availability Zone | +| ↳ `privateIpAddress` | string | Primary private IPv4 address | +| ↳ `privateIpAddresses` | array | All private IPv4 addresses | +| ↳ `publicIp` | string | Associated public IPv4 address | +| ↳ `macAddress` | string | MAC address | +| ↳ `requesterManaged` | boolean | Whether an AWS service manages the interface | +| ↳ `attachment` | object | Instance attachment, if attached | +| ↳ `attachmentId` | string | Attachment ID | +| ↳ `instanceId` | string | Attached instance ID | +| ↳ `deviceIndex` | number | Device index on the instance | +| ↳ `status` | string | Attachment status | +| ↳ `deleteOnTermination` | boolean | Whether the interface is deleted when the instance terminates | +| ↳ `securityGroups` | array | Attached security groups | +| ↳ `groupId` | string | Security group ID | +| ↳ `groupName` | string | Security group name | + + + +### EC2 Describe Volumes + +List EBS volumes with their size, type, state, and attachments + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `volumeIds` | string | No | Comma-separated volume IDs \(e.g., vol-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"status","Values":\["available"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `volumes` | array | EBS volumes | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `volumeId` | string | Volume ID | +| ↳ `volumeType` | string | Volume type \(gp2, gp3, io1, io2, st1, sc1, standard\) | +| ↳ `size` | number | Size in GiB | +| ↳ `state` | string | State \(creating, available, in-use, deleting, deleted, error\) | +| ↳ `availabilityZone` | string | Availability Zone | +| ↳ `iops` | number | Provisioned IOPS | +| ↳ `throughput` | number | Throughput in MiB/s \(gp3\) | +| ↳ `encrypted` | boolean | Whether the volume is encrypted | +| ↳ `kmsKeyId` | string | KMS key ARN used for encryption | +| ↳ `snapshotId` | string | Snapshot the volume was created from | +| ↳ `createTime` | string | Creation time \(ISO 8601\) | +| ↳ `multiAttachEnabled` | boolean | Whether Multi-Attach is enabled | +| ↳ `attachments` | array | Instance attachments | +| ↳ `instanceId` | string | Attached instance ID | +| ↳ `device` | string | Device name \(e.g., /dev/xvda\) | +| ↳ `state` | string | Attachment state | +| ↳ `attachTime` | string | Attach time \(ISO 8601\) | +| ↳ `deleteOnTermination` | boolean | Whether the volume is deleted when the instance terminates | + + + +### EC2 Describe Snapshots + +List EBS snapshots owned by the account (or by the owners you specify) + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `snapshotIds` | string | No | Comma-separated snapshot IDs \(e.g., snap-0abc123\) | +| `ownerIds` | string | No | Comma-separated owners: AWS account IDs, self, or amazon \(defaults to self\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"volume-id","Values":\["vol-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `snapshots` | array | EBS snapshots | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `snapshotId` | string | Snapshot ID | +| ↳ `volumeId` | string | Source volume ID | +| ↳ `volumeSize` | number | Source volume size in GiB | +| ↳ `state` | string | State \(pending, completed, error, recoverable, recovering\) | +| ↳ `progress` | string | Completion progress \(e.g., 100%\) | +| ↳ `startTime` | string | Start time \(ISO 8601\) | +| ↳ `description` | string | Description | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `encrypted` | boolean | Whether the snapshot is encrypted | +| ↳ `kmsKeyId` | string | KMS key ARN used for encryption | +| ↳ `storageTier` | string | Storage tier \(standard or archive\) | + + + +### EC2 Create Snapshot + +Create a point-in-time snapshot of an EBS volume + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `volumeId` | string | Yes | ID of the EBS volume to snapshot \(e.g., vol-0abc123\) | +| `description` | string | No | Description for the snapshot | +| `tags` | json | No | Tags to apply as a JSON object, e.g. \{"Name":"nightly-backup"\} | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `tags` | json | Resource tags as key/value pairs | +| `snapshotId` | string | ID of the new snapshot | +| `volumeId` | string | Source volume ID | +| `volumeSize` | number | Source volume size in GiB | +| `state` | string | Snapshot state \(pending until complete\) | +| `startTime` | string | Start time \(ISO 8601\) | +| `description` | string | Description | +| `encrypted` | boolean | Whether the snapshot is encrypted | +| `ownerId` | string | Owning AWS account ID | + + + +### EC2 Create Tags + +Add or overwrite tags on one or more EC2 resources + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `resourceIds` | string | Yes | Comma-separated resource IDs to tag \(e.g., i-0abc123,vol-0def456\) | +| `tags` | json | Yes | Tags as a JSON object, e.g. \{"Environment":"prod","Owner":"platform"\} | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `tags` | json | Resource tags as key/value pairs | +| `resourceIds` | array | Resource IDs that were tagged | + + + +### EC2 Delete Tags + +Remove tags from one or more EC2 resources + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `resourceIds` | string | Yes | Comma-separated resource IDs to untag | +| `tagKeys` | string | Yes | Comma-separated tag keys to remove | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `resourceIds` | array | Resource IDs that were untagged | +| `tagKeys` | array | Tag keys that were removed | + + + +### EC2 Describe Regions + +List AWS Regions available to the account + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `regionNames` | string | No | Comma-separated region names to describe | +| `allRegions` | boolean | No | Include Regions that are not enabled for the account | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"opt-in-status","Values":\["opted-in"\]\}\] | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `regions` | array | AWS Regions | +| ↳ `regionName` | string | Region name \(e.g., us-east-1\) | +| ↳ `endpoint` | string | EC2 endpoint for the Region | +| ↳ `optInStatus` | string | Opt-in status \(opt-in-not-required, opted-in, not-opted-in\) | + + + +### EC2 Describe Availability Zones + +List Availability Zones, Local Zones, and Wavelength Zones in the region + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `zoneNames` | string | No | Comma-separated zone names \(e.g., us-east-1a\) | +| `allAvailabilityZones` | boolean | No | Include zones that are not opted in | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"state","Values":\["available"\]\}\] | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `availabilityZones` | array | Zones | +| ↳ `zoneName` | string | Zone name \(e.g., us-east-1a\) | +| ↳ `zoneId` | string | Zone ID \(e.g., use1-az1\) | +| ↳ `zoneType` | string | Zone type \(availability-zone, local-zone, wavelength-zone\) | +| ↳ `state` | string | Zone state | +| ↳ `regionName` | string | Region name | +| ↳ `groupName` | string | Zone group name | +| ↳ `networkBorderGroup` | string | Network border group | +| ↳ `optInStatus` | string | Opt-in status | + + + +### EC2 Authorize Security Group Ingress + +Add an inbound rule to a security group + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `groupId` | string | Yes | Security group ID \(e.g., sg-0abc123\) | +| `ipProtocol` | string | Yes | IP protocol: tcp, udp, icmp, icmpv6, or -1 for all traffic | +| `fromPort` | number | No | Start of the port range \(ICMP type for icmp; omit for -1\) | +| `toPort` | number | No | End of the port range \(ICMP code for icmp; omit for -1\) | +| `cidrIp` | string | No | IPv4 CIDR source \(e.g., 203.0.113.0/24\). Provide exactly one source | +| `cidrIpv6` | string | No | IPv6 CIDR source \(e.g., 2001:db8::/32\). Provide exactly one source | +| `sourceGroupId` | string | No | Source security group ID. Provide exactly one source | +| `description` | string | No | Description for the rule | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `authorized` | boolean | Whether the rule was added | +| `securityGroupRules` | array | Rules that were added | +| ↳ `securityGroupRuleId` | string | Security group rule ID | +| ↳ `groupId` | string | Security group ID | +| ↳ `ipProtocol` | string | IP protocol | +| ↳ `fromPort` | number | Start of the port range | +| ↳ `toPort` | number | End of the port range | +| ↳ `cidrIpv4` | string | IPv4 CIDR source | +| ↳ `cidrIpv6` | string | IPv6 CIDR source | +| ↳ `referencedGroupId` | string | Source security group ID | +| ↳ `description` | string | Rule description | + + + +### EC2 Revoke Security Group Ingress + +Remove inbound rules from a security group by rule ID or by matching protocol, ports, and source + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `groupId` | string | Yes | Security group ID \(e.g., sg-0abc123\) | +| `ipProtocol` | string | No | IP protocol: tcp, udp, icmp, icmpv6, or -1 for all traffic | +| `fromPort` | number | No | Start of the port range \(ICMP type for icmp; omit for -1\) | +| `toPort` | number | No | End of the port range \(ICMP code for icmp; omit for -1\) | +| `cidrIp` | string | No | IPv4 CIDR source \(e.g., 203.0.113.0/24\). Provide exactly one source | +| `cidrIpv6` | string | No | IPv6 CIDR source \(e.g., 2001:db8::/32\). Provide exactly one source | +| `sourceGroupId` | string | No | Source security group ID. Provide exactly one source | +| `securityGroupRuleIds` | string | No | Comma-separated security group rule IDs \(e.g., sgr-0abc123\). Use instead of protocol, ports, and source | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `revoked` | boolean | Whether the request succeeded | +| `revokedRules` | array | Rules that were removed | +| ↳ `securityGroupRuleId` | string | Security group rule ID | +| ↳ `ipProtocol` | string | IP protocol | +| ↳ `fromPort` | number | Start of the port range | +| ↳ `toPort` | number | End of the port range | +| ↳ `cidrIpv4` | string | IPv4 CIDR source | +| ↳ `cidrIpv6` | string | IPv6 CIDR source | +| ↳ `referencedGroupId` | string | Source security group ID | +| ↳ `description` | string | Rule description | +| `unmatchedRuleCount` | number | Number of requested rules that did not match an existing rule | + + + +### EC2 Describe Network ACLs + +List network ACLs with their inbound and outbound rules and subnet associations + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `networkAclIds` | string | No | Comma-separated network ACL IDs \(e.g., acl-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `networkAcls` | array | Network ACLs | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `networkAclId` | string | Network ACL ID | +| ↳ `vpcId` | string | VPC ID | +| ↳ `isDefault` | boolean | Whether this is the default ACL for the VPC | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `entries` | array | Rules, evaluated in ascending rule number | +| ↳ `ruleNumber` | number | Rule number | +| ↳ `egress` | boolean | Whether the rule applies to outbound traffic | +| ↳ `ruleAction` | string | allow or deny | +| ↳ `protocol` | string | Protocol number \(-1 for all, 6 for TCP, 17 for UDP\) | +| ↳ `cidrBlock` | string | IPv4 CIDR | +| ↳ `ipv6CidrBlock` | string | IPv6 CIDR | +| ↳ `fromPort` | number | Start of the port range | +| ↳ `toPort` | number | End of the port range | +| ↳ `icmpType` | number | ICMP type | +| ↳ `icmpCode` | number | ICMP code | +| ↳ `associations` | array | Subnet associations | +| ↳ `associationId` | string | Association ID | +| ↳ `subnetId` | string | Subnet ID | + + + +### EC2 Describe VPC Endpoints + +List VPC endpoints with their service, type, state, and network placement + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `vpcEndpointIds` | string | No | Comma-separated VPC endpoint IDs \(e.g., vpce-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"vpc-id","Values":\["vpc-0abc123"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `vpcEndpoints` | array | VPC endpoints | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `vpcEndpointId` | string | VPC endpoint ID | +| ↳ `vpcEndpointType` | string | Endpoint type \(Interface, Gateway, GatewayLoadBalancer, Resource, ServiceNetwork\) | +| ↳ `vpcId` | string | VPC ID | +| ↳ `serviceName` | string | Service name \(e.g., com.amazonaws.us-east-1.s3\) | +| ↳ `state` | string | Endpoint state | +| ↳ `privateDnsEnabled` | boolean | Whether private DNS is enabled | +| ↳ `routeTableIds` | array | Associated route table IDs \(gateway endpoints\) | +| ↳ `subnetIds` | array | Subnet IDs \(interface endpoints\) | +| ↳ `networkInterfaceIds` | array | Endpoint network interface IDs | +| ↳ `securityGroupIds` | array | Attached security group IDs | +| ↳ `dnsNames` | array | DNS names for the endpoint | +| ↳ `creationTimestamp` | string | Creation time \(ISO 8601\) | +| ↳ `ownerId` | string | Owning AWS account ID | + + + +### EC2 Describe VPC Peering Connections + +List VPC peering connections with their status and both VPCs + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `vpcPeeringConnectionIds` | string | No | Comma-separated VPC peering connection IDs \(e.g., pcx-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"status-code","Values":\["active"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `vpcPeeringConnections` | array | VPC peering connections | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `vpcPeeringConnectionId` | string | VPC peering connection ID | +| ↳ `status` | string | Status code \(e.g., pending-acceptance, active, rejected, deleted\) | +| ↳ `statusMessage` | string | Status message | +| ↳ `requesterVpc` | object | Requester VPC | +| ↳ `vpcId` | string | VPC ID | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `region` | string | Region | +| ↳ `cidrBlock` | string | IPv4 CIDR block | +| ↳ `accepterVpc` | object | Accepter VPC | +| ↳ `vpcId` | string | VPC ID | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `region` | string | Region | +| ↳ `cidrBlock` | string | IPv4 CIDR block | +| ↳ `expirationTime` | string | Time an unaccepted request expires \(ISO 8601\) | + + + +### EC2 Delete Volume + +Permanently delete an EBS volume that is not attached to an instance + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `volumeId` | string | Yes | ID of the EBS volume to delete \(e.g., vol-0abc123\) | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `deleted` | boolean | Whether the volume deletion was accepted | +| `volumeId` | string | Volume ID that was deleted | + + + +### EC2 Delete Snapshot + +Permanently delete an EBS snapshot + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `snapshotId` | string | Yes | ID of the EBS snapshot to delete \(e.g., snap-0abc123\) | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `deleted` | boolean | Whether the snapshot was deleted | +| `snapshotId` | string | Snapshot ID that was deleted | + + + +### EC2 Describe Images + +List AMIs owned by the account (or by the owners you specify) + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `imageIds` | string | No | Comma-separated AMI IDs \(e.g., ami-0abc123\) | +| `owners` | string | No | Comma-separated owners: AWS account IDs, self, amazon, or aws-marketplace \(defaults to self\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"name","Values":\["my-app-*"\]\}\] | +| `maxResults` | number | No | Maximum results per page when no IDs are given \(5-1000, default 100\) | +| `nextToken` | string | No | Pagination token from a previous response | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `nextToken` | string | Pagination token for the next page, or null when there are no more results | +| `images` | array | AMIs | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `imageId` | string | AMI ID | +| ↳ `name` | string | AMI name | +| ↳ `description` | string | Description | +| ↳ `state` | string | State \(pending, available, invalid, deregistered, transient, failed, error, disabled\) | +| ↳ `ownerId` | string | Owning AWS account ID | +| ↳ `ownerAlias` | string | Owner alias \(e.g., amazon\) | +| ↳ `public` | boolean | Whether the AMI is public | +| ↳ `architecture` | string | CPU architecture | +| ↳ `platformDetails` | string | Platform details \(e.g., Linux/UNIX\) | +| ↳ `rootDeviceType` | string | Root device type \(ebs or instance-store\) | +| ↳ `virtualizationType` | string | Virtualization type \(hvm or paravirtual\) | +| ↳ `creationDate` | string | Creation date \(ISO 8601\) | +| ↳ `deprecationTime` | string | Deprecation time \(ISO 8601\) | +| ↳ `lastLaunchedTime` | string | Last time an instance was launched from the AMI \(ISO 8601\) | + + + +### EC2 Describe Key Pairs + +List EC2 key pairs with their type, fingerprint, and creation time + + + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `awsRegion` | string | Yes | AWS region \(e.g., us-east-1\) | +| `awsAccessKeyId` | string | Yes | AWS access key ID | +| `awsSecretAccessKey` | string | Yes | AWS secret access key | +| `keyNames` | string | No | Comma-separated key pair names | +| `keyPairIds` | string | No | Comma-separated key pair IDs \(e.g., key-0abc123\) | +| `filters` | json | No | EC2 filters as a JSON array, e.g. \[\{"Name":"key-name","Values":\["deploy-*"\]\}\] | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `keyPairs` | array | Key pairs | +| ↳ `tags` | json | Resource tags as key/value pairs | +| ↳ `keyPairId` | string | Key pair ID | +| ↳ `keyName` | string | Key pair name | +| ↳ `keyType` | string | Key type \(rsa or ed25519\) | +| ↳ `keyFingerprint` | string | Key fingerprint | +| ↳ `createTime` | string | Creation time \(ISO 8601\) | + + + + diff --git a/apps/docs/content/docs/integrations/meta.json b/apps/docs/content/docs/integrations/meta.json index 3f607bb0487..c2be78df692 100644 --- a/apps/docs/content/docs/integrations/meta.json +++ b/apps/docs/content/docs/integrations/meta.json @@ -71,6 +71,7 @@ "duckduckgo", "dynamodb", "dynatrace", + "ec2", "elasticsearch", "elevenlabs", "emailbison", diff --git a/apps/docs/content/docs/knowledgebase/export-import.mdx b/apps/docs/content/docs/knowledgebase/export-import.mdx index 0b151f397df..61ad1694ca9 100644 --- a/apps/docs/content/docs/knowledgebase/export-import.mdx +++ b/apps/docs/content/docs/knowledgebase/export-import.mdx @@ -1,9 +1,9 @@ --- -title: Export -description: Download a knowledge base's documents, chunks, tags, and settings in one archive. +title: Export and import +description: Move a knowledge base's documents, chunks, tags, and settings between workspaces and deployments in one archive. --- -Export a knowledge base as a `.simkb.zip` archive. It carries the base's configuration, tag definitions and values, stored document files, and completed chunk text, with vectors included by default. +Export a knowledge base as a `.simkb.zip` archive. It carries the base's configuration, tag definitions and values, stored document files, and completed chunk text, with vectors included by default. Import the archive into any workspace, on this deployment or another, to create a new knowledge base from it. ## Access and scope @@ -34,6 +34,60 @@ sim knowledge export --output-file kb.zip --no-vectors The CLI uses the selected workspace profile. An existing output file requires `--force` to overwrite it. See the [CLI reference](/cli/reference). +## Import an archive + +Importing creates a new knowledge base from a `.simkb.zip` archive. It never changes an existing base. + +### Access + +Import requires workspace write access and both the **Knowledge Base Creation** and **Knowledge Base Uploads** capabilities. OAuth callers need `api:write`; a workspace API key is accepted. + +### CLI + +```bash +sim knowledge import ./kb.simkb.zip +sim knowledge import ./kb.simkb.zip --name "Product Documentation (copy)" +sim knowledge import ./kb.simkb.zip --no-wait +``` + +The new base takes the archive's name unless you pass `--name`. Knowledge base names are unique within a workspace, so importing next to the original needs a new name. The command uploads the archive, waits for the import to finish, and prints the new base's id with how many documents were imported. With `--no-wait` it returns as soon as the import starts. + +To check on or stop an import that is still running: + +```bash +sim knowledge imports get +sim knowledge imports cancel +``` + +### API + +An import is three requests, like other large uploads: + +1. `POST /api/v2/knowledge/imports` with the workspace, an optional `name`, and the archive's file name, type, and size. The response carries the import id, an upload token, and signed transfer instructions. +2. Upload the archive's bytes as instructed. Multipart transfers request part URLs from `POST /api/v2/knowledge/imports/{importId}/parts`. +3. `POST /api/v2/knowledge/imports/{importId}/complete` to start the import. + +Poll `GET /api/v2/knowledge/imports/{importId}?workspaceId={workspaceId}` until `status` is `completed`, `failed`, or `canceled`. See [Create knowledge base import](/api-reference/knowledge-bases/createKnowledgeImport) for the request contracts. + +### What the import creates + +The new base is created at the workspace root with the archive's description, chunking configuration, and tag definitions. Each document keeps its filename, tag values, and enabled flag, and its original file when the archive has one. It is attributed to the person who imported it. + +How a document is indexed depends on the embedding model: + +- **Same model**: when the archive includes vectors from the embedding model and dimensions this deployment uses, documents are indexed directly from the archive's chunks and vectors. Nothing is re-embedded, so nothing is billed for embeddings, and chunk enabled flags are kept. +- **Different model or no vectors**: documents are processed from their original files, exactly as uploads are, and appear in the base as their processing finishes. A document with chunks but no original file is re-embedded from its chunk text instead. + +A document the archive carries only as chunks, such as one from a [connector](/knowledgebase/connectors), is stored as a plain-text file holding its chunk text, so it can still be reprocessed later. + +`documentsImported` counts documents created; re-indexed documents may still be processing when the import completes. Documents that cannot be imported, such as an unsupported file type or a storage limit reached partway through, are skipped and reported in `failures`; the rest of the import continues. + +### Limits + +Archives must be `.zip` files of at most **5 GiB**, and every document file at most **100 MB**. The archive is validated before anything is created, so a damaged or modified archive fails without leaving a partial base. Imports count toward storage and usage limits like uploads do. + +Canceling stops after the document in progress. Documents already imported stay in the new base. Starting an import records one audit event, naming the knowledge base it creates. + ## Archive contents ```text diff --git a/apps/docs/content/docs/knowledgebase/index.mdx b/apps/docs/content/docs/knowledgebase/index.mdx index 048fde441ee..223c31a1825 100644 --- a/apps/docs/content/docs/knowledgebase/index.mdx +++ b/apps/docs/content/docs/knowledgebase/index.mdx @@ -63,4 +63,4 @@ A query search across multiple bases requires the same embedding model and dimen - [Tags and filtering](/knowledgebase/tags) for narrowing a search - [Debugging retrieval](/knowledgebase/debugging-retrieval) for missing or irrelevant results - [Chunking strategies](/knowledgebase/chunking-strategies) for passage sizes and boundaries -- [Export](/knowledgebase/export-import) for downloading documents, chunks, tags, and settings +- [Export and import](/knowledgebase/export-import) for moving documents, chunks, tags, and settings between workspaces and deployments diff --git a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx index 5c954c708d1..e5c2f872541 100644 --- a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx +++ b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx @@ -298,7 +298,7 @@ helm template sim oci://ghcr.io/simstudioai/charts/sim --version 1.11.8 -f value | `OTEL_TRACES_SAMPLER_ARG` | Trace sampling ratio | | `OTEL_DEPLOYMENT_ENVIRONMENT` | Environment label on emitted spans | | `TELEMETRY_SAMPLING_RATIO` | Application-level sampling ratio | -| `TELEMETRY_ENDPOINT` | Where anonymous telemetry is sent. Defaults to `https://telemetry.simstudio.ai/v1/traces` — point it at your own collector to keep traces internal | +| `TELEMETRY_ENDPOINT` | Full URL browser telemetry events are posted to, as-is (they never carry `OTEL_EXPORTER_OTLP_HEADERS`). Server traces use it only when `OTEL_EXPORTER_OTLP_ENDPOINT` is unset. Defaults to `https://telemetry.simstudio.ai/v1/traces`, which receives traces only: server logs and metrics are exported only to a collector you configure. `NEXT_TELEMETRY_DISABLED=1` (the Docker and Helm default) turns all of it off | | `NEXT_TELEMETRY_DISABLED` | Set to `1` to disable anonymous telemetry entirely | | `GRAFANA_OTLP_ENDPOINT` / `GRAFANA_OTLP_HEADERS` / `GRAFANA_DEPLOYMENT_ENVIRONMENT` | Grafana Cloud OTLP export | diff --git a/apps/docs/content/docs/platform/self-hosting/observability.mdx b/apps/docs/content/docs/platform/self-hosting/observability.mdx index 0bc1c34471d..4b84f41891b 100644 --- a/apps/docs/content/docs/platform/self-hosting/observability.mdx +++ b/apps/docs/content/docs/platform/self-hosting/observability.mdx @@ -112,9 +112,9 @@ Telemetry has two halves that are decided at different times. | Server SDK | Runtime | **Off** on Helm (`app.envDefaults` sets `NEXT_TELEMETRY_DISABLED: "1"`); **on** for Docker Compose and source runs, which set nothing | | Browser | Server setting at page render, then browser preferences | Disabled when `NEXT_TELEMETRY_DISABLED=1`; otherwise waits for session resolution and the signed-in user's saved preference. Hosted Sim also requires the applicable analytics permission. | -Neither half gates `POST /api/telemetry`, the relay that forwards submitted browser events. Its destination is controlled separately by `TELEMETRY_ENDPOINT`; disabling collection does not disable this endpoint. +`NEXT_TELEMETRY_DISABLED=1` also stops `POST /api/telemetry`, the relay that forwards submitted browser events, from forwarding anything. Otherwise it posts each event to `TELEMETRY_ENDPOINT` as-is, or to the endpoint in `apps/sim/telemetry.config.ts`. Because these events are unauthenticated input, the relay never sends `OTEL_EXPORTER_OTLP_HEADERS` with them. -When the server SDK runs it exports three OTLP signals to the same base endpoint: traces at `/v1/traces`, metrics at `/v1/metrics`, and application **log records** at `/v1/logs`. Default instrumentation records usage, performance, errors, and AI/LLM traces rather than raw workflow content. Error metadata and log records can still contain sensitive values; inspect the signals you send to your collector. +When the server SDK runs against a collector you configure, it exports three OTLP signals to the same base endpoint: traces at `/v1/traces`, metrics at `/v1/metrics`, and application **log records** at `/v1/logs`. On the anonymous default (`https://telemetry.simstudio.ai`) it exports traces only, and never sends `OTEL_EXPORTER_OTLP_HEADERS` there. Default instrumentation records usage, performance, errors, and AI/LLM traces rather than raw workflow content. Error metadata and log records can still contain sensitive values; inspect the signals you send to your collector. Log records at or above `LOG_LEVEL` carry structured metadata, error messages, and stack traces, which can include account IDs, emails, and URLs. Raising `LOG_LEVEL` increases that stream. Configure your collector and retention policy accordingly. @@ -149,7 +149,7 @@ Or point the app at a collector you already run: | `OTEL_TRACES_SAMPLER_ARG` | Sampling ratio, used only when `TELEMETRY_SAMPLING_RATIO` is unset | | `OTEL_DEPLOYMENT_ENVIRONMENT` | Environment label on emitted spans | -The endpoint is resolved by precedence, first match wins: `OTEL_EXPORTER_OTLP_ENDPOINT`, then `TELEMETRY_ENDPOINT`, then the endpoint in `apps/sim/telemetry.config.ts`. This precedence governs the server SDK only — the `/api/telemetry` relay reads `TELEMETRY_ENDPOINT` and nothing else. Sampling resolves the same way: `TELEMETRY_SAMPLING_RATIO`, then `OTEL_TRACES_SAMPLER_ARG`, defaulting to 1.0. Editing `telemetry.config.ts` only changes the last fallback, so an environment variable set anywhere in your stack silently wins over it. +The endpoint is resolved by precedence, first match wins: `OTEL_EXPORTER_OTLP_ENDPOINT`, then `TELEMETRY_ENDPOINT`, then the endpoint in `apps/sim/telemetry.config.ts`. This precedence governs the server SDK only — the `/api/telemetry` relay reads `TELEMETRY_ENDPOINT`, then the endpoint in `telemetry.config.ts`, and never `OTEL_EXPORTER_OTLP_ENDPOINT`. Sampling resolves the same way: `TELEMETRY_SAMPLING_RATIO`, then `OTEL_TRACES_SAMPLER_ARG`, defaulting to 1.0. Editing `telemetry.config.ts` only changes the last fallback, so an environment variable set anywhere in your stack silently wins over it. The app does not read `OTEL_SERVICE_NAME`: server spans use the literal service name `mothership`, even when Helm sets `sim-app`. Use `mothership` in collector filters. diff --git a/apps/docs/openapi-v2-knowledge.json b/apps/docs/openapi-v2-knowledge.json index 18b8770ecdd..cadd389f3d1 100644 --- a/apps/docs/openapi-v2-knowledge.json +++ b/apps/docs/openapi-v2-knowledge.json @@ -668,12 +668,109 @@ } } }, - "/api/v2/knowledge/{knowledgeBaseId}/connectors": { + "/api/v2/knowledge/imports": { + "post": { + "operationId": "createKnowledgeImport", + "summary": "Create knowledge base import", + "description": "Start importing a knowledge base bundle produced by an export. The response carries signed transfer instructions for the archive; once its bytes are uploaded, complete the import to create the knowledge base. Bundles must be `.zip` archives of at most 5 GiB.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.imports.create", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] + }, + { + "oauthBearer": ["api:write"] + } + ], + "requestBody": { + "required": true, + "description": "Workspace, bundle archive, and an optional name for the new knowledge base.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateKnowledgeImportRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "name": "Product Documentation", + "source": { + "type": "upload", + "name": "product-documentation.simkb.zip", + "contentType": "application/zip", + "size": 7340032 + } + } + } + } + } + } + }, + "responses": { + "201": { + "description": "The created import and its upload instructions.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2CreateKnowledgeImportResponse" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "402": { + "$ref": "#/components/responses/UsageLimitExceeded" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" + } + } + } + }, + "/api/v2/knowledge/imports/{importId}": { "get": { - "operationId": "listKnowledgeConnectors", - "summary": "List knowledge connectors", - "description": "List external sources connected to a knowledge base with cursor pagination. Stored API keys are never returned. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.connectors.list", + "operationId": "getKnowledgeImport", + "summary": "Get knowledge base import", + "description": "Get an import's progress and outcome. During `uploading`, the signed upload token is required; omitting it returns `404`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.imports.read", "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ @@ -686,72 +783,35 @@ ], "parameters": [ { - "name": "knowledgeBaseId", + "name": "importId", "in": "path", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Unique knowledge-base import identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Unique knowledge-base import identifier." } }, { "name": "workspaceId", "in": "query", "required": true, - "description": "Workspace that owns the knowledge base.", + "description": "Workspace that owns the import.", "schema": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Workspace that owns the knowledge base." - } - }, - { - "name": "sortBy", - "in": "query", - "required": false, - "description": "Field used to sort the result.", - "schema": { - "default": "createdAt", - "description": "Field used to sort the result.", - "type": "string", - "enum": ["connectorType", "createdAt", "updatedAt"] - } - }, - { - "name": "sortOrder", - "in": "query", - "required": false, - "description": "Sort direction.", - "schema": { - "default": "desc", - "description": "Sort direction.", - "type": "string", - "enum": ["asc", "desc"] - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "description": "Maximum connectors to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "schema": { - "default": 50, - "description": "Maximum connectors to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "type": "integer", - "minimum": 1, - "maximum": 100 + "description": "Workspace that owns the import." } }, { - "name": "cursor", - "in": "query", + "name": "upload-token", + "in": "header", "required": false, - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "description": "Signed upload control token returned when the import was created; required to read or cancel the import before its upload completes.", "schema": { - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "description": "Signed upload control token returned when the import was created; required to read or cancel the import before its upload completes.", "type": "string", "minLength": 1 } @@ -759,7 +819,7 @@ ], "responses": { "200": { - "description": "A page of knowledge connectors.", + "description": "The requested knowledge base import.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -774,36 +834,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeConnectorListResponse" - }, - "examples": { - "example1": { - "summary": "Response example 1", - "value": { - "data": [ - { - "id": "kc-9f8e7d6c", - "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", - "connectorType": "notion", - "credentialId": "cred-4b3a2c1d", - "sourceConfig": { - "pageIds": ["page-123"] - }, - "syncMode": "full", - "syncIntervalMinutes": 1440, - "status": "active", - "lastSyncAt": "2026-06-20T14:02:11.000Z", - "lastSyncError": null, - "lastSyncDocCount": 42, - "nextSyncAt": "2026-06-21T14:02:11.000Z", - "consecutiveFailures": 0, - "createdAt": "2026-06-01T09:14:00.000Z", - "updatedAt": "2026-06-20T14:02:11.000Z" - } - ], - "nextCursor": null - } - } + "$ref": "#/components/schemas/V2KnowledgeImportResponse" } } } @@ -831,11 +862,11 @@ } } }, - "post": { - "operationId": "createKnowledgeConnector", - "summary": "Create knowledge connector", - "description": "Validate and connect an external source, then queue its initial synchronization. The `apiKey` field is never returned. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.connectors.create", + "delete": { + "operationId": "cancelKnowledgeImport", + "summary": "Cancel knowledge base import", + "description": "Cancel an import. During its upload the transfer is aborted; while processing, it stops after the document in flight and the documents already imported stay in the new knowledge base. Settled imports return `409`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.imports.cancel", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -848,45 +879,43 @@ ], "parameters": [ { - "name": "knowledgeBaseId", + "name": "importId", "in": "path", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Unique knowledge-base import identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Unique knowledge-base import identifier." } - } - ], - "requestBody": { - "required": true, - "description": "Workspace, connector type, authentication reference, source configuration, and sync schedule.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateKnowledgeConnectorRequest" - }, - "examples": { - "example1": { - "summary": "Request example 1", - "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "connectorType": "notion", - "credentialId": "cred-4b3a2c1d", - "sourceConfig": { - "pageIds": ["page-123"] - }, - "syncIntervalMinutes": 1440 - } - } - } + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the import.", + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the import." + } + }, + { + "name": "upload-token", + "in": "header", + "required": false, + "description": "Signed upload control token returned when the import was created; required to read or cancel the import before its upload completes.", + "schema": { + "description": "Signed upload control token returned when the import was created; required to read or cancel the import before its upload completes.", + "type": "string", + "minLength": 1 } } - }, + ], "responses": { - "201": { - "description": "The created connector without secret material.", + "200": { + "description": "The canceled knowledge base import.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -901,33 +930,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeConnectorResponse" - }, - "examples": { - "example1": { - "summary": "Response example 1", - "value": { - "data": { - "id": "kc-9f8e7d6c", - "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", - "connectorType": "notion", - "credentialId": "cred-4b3a2c1d", - "sourceConfig": { - "pageIds": ["page-123"] - }, - "syncMode": "full", - "syncIntervalMinutes": 1440, - "status": "active", - "lastSyncAt": "2026-06-20T14:02:11.000Z", - "lastSyncError": null, - "lastSyncDocCount": 42, - "nextSyncAt": "2026-06-21T14:02:11.000Z", - "consecutiveFailures": 0, - "createdAt": "2026-06-01T09:14:00.000Z", - "updatedAt": "2026-06-20T14:02:11.000Z" - } - } - } + "$ref": "#/components/schemas/V2CancelKnowledgeImportResponse" } } } @@ -947,12 +950,6 @@ "409": { "$ref": "#/components/responses/Conflict" }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -965,61 +962,80 @@ } } }, - "/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}": { - "get": { - "operationId": "getKnowledgeConnector", - "summary": "Get knowledge connector", - "description": "Get one connector and its ten most recent synchronization attempts. Stored API keys are never returned. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.connectors.read", - "x-oauth-scope": "api:read", + "/api/v2/knowledge/imports/{importId}/parts": { + "post": { + "operationId": "createKnowledgeImportPartUrls", + "summary": "Create knowledge base import part URLs", + "description": "Create signed URLs for multipart bundle upload parts. Requires the `uploading` state; other states return `409`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.imports.parts", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:read"] + "oauthBearer": ["api:write"] } ], "parameters": [ { - "name": "connectorId", + "name": "importId", "in": "path", "required": true, - "description": "Connector selected for the operation.", + "description": "Unique knowledge-base import identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Connector selected for the operation." + "description": "Unique knowledge-base import identifier." } }, { - "name": "knowledgeBaseId", - "in": "path", + "name": "workspaceId", + "in": "query", "required": true, - "description": "Knowledge base that owns the connector.", + "description": "Workspace that owns the import.", "schema": { "type": "string", "minLength": 1, - "description": "Knowledge base that owns the connector." + "maxLength": 128, + "description": "Workspace that owns the import." } }, { - "name": "workspaceId", - "in": "query", + "name": "upload-token", + "in": "header", "required": true, - "description": "Workspace that owns the knowledge base.", + "description": "Signed upload control token returned when the upload session was created.", "schema": { "type": "string", "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." + "description": "Signed upload control token returned when the upload session was created." } } ], + "requestBody": { + "required": true, + "description": "Multipart part numbers for which signed URLs should be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateKnowledgeImportPartUrlsRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "partNumbers": [1, 2, 3] + } + } + } + } + } + }, "responses": { "200": { - "description": "The connector and recent synchronization history.", + "description": "The signed multipart upload URLs.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1034,34 +1050,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeConnectorDetailResponse" - }, - "examples": { - "example1": { - "summary": "Response example 1", - "value": { - "data": { - "id": "kc-9f8e7d6c", - "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", - "connectorType": "notion", - "credentialId": "cred-4b3a2c1d", - "sourceConfig": { - "pageIds": ["page-123"] - }, - "syncMode": "full", - "syncIntervalMinutes": 1440, - "status": "active", - "lastSyncAt": "2026-06-20T14:02:11.000Z", - "lastSyncError": null, - "lastSyncDocCount": 42, - "nextSyncAt": "2026-06-21T14:02:11.000Z", - "consecutiveFailures": 0, - "createdAt": "2026-06-01T09:14:00.000Z", - "updatedAt": "2026-06-20T14:02:11.000Z", - "syncLogs": [] - } - } - } + "$ref": "#/components/schemas/V2CreateKnowledgeImportPartUrlsResponse" } } } @@ -1078,6 +1067,15 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -1088,12 +1086,14 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "patch": { - "operationId": "updateKnowledgeConnector", - "summary": "Update knowledge connector", - "description": "Update connector source configuration, schedule, or active state. Replacing source configuration on a runnable connector queues an immediate synchronization; paused connectors retain the change without synchronizing until resumed. Source configuration cannot be replaced while synchronization is already in progress. Authentication material cannot be changed through this operation. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.connectors.update", + } + }, + "/api/v2/knowledge/imports/{importId}/complete": { + "post": { + "operationId": "completeKnowledgeImport", + "summary": "Complete knowledge base import upload", + "description": "Verify the uploaded bundle and start creating the knowledge base under the same import ID. Vectors are reused when the bundle was embedded with this deployment's model; otherwise documents are re-indexed. Completion records an audit event. Repeating it returns the running import.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.imports.complete", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -1106,51 +1106,43 @@ ], "parameters": [ { - "name": "connectorId", + "name": "importId", "in": "path", "required": true, - "description": "Connector selected for the operation.", + "description": "Unique knowledge-base import identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Connector selected for the operation." + "description": "Unique knowledge-base import identifier." } }, { - "name": "knowledgeBaseId", - "in": "path", + "name": "workspaceId", + "in": "query", "required": true, - "description": "Knowledge base that owns the connector.", + "description": "Workspace that owns the import.", "schema": { "type": "string", "minLength": 1, - "description": "Knowledge base that owns the connector." + "maxLength": 128, + "description": "Workspace that owns the import." } - } - ], - "requestBody": { - "required": true, - "description": "Workspace scope and at least one mutable connector field.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateKnowledgeConnectorRequest" - }, - "examples": { - "example1": { - "summary": "Request example 1", - "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "status": "paused" - } - } - } + }, + { + "name": "upload-token", + "in": "header", + "required": true, + "description": "Signed upload control token returned when the upload session was created.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Signed upload control token returned when the upload session was created." } } - }, + ], "responses": { "200": { - "description": "The updated connector.", + "description": "The knowledge base import after its upload completed.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1165,33 +1157,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateKnowledgeConnectorResponse" - }, - "examples": { - "example1": { - "summary": "Response example 1", - "value": { - "data": { - "id": "kc-9f8e7d6c", - "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", - "connectorType": "notion", - "credentialId": "cred-4b3a2c1d", - "sourceConfig": { - "pageIds": ["page-123"] - }, - "syncMode": "full", - "syncIntervalMinutes": 1440, - "status": "paused", - "lastSyncAt": "2026-06-20T14:02:11.000Z", - "lastSyncError": null, - "lastSyncDocCount": 42, - "nextSyncAt": "2026-06-21T14:02:11.000Z", - "consecutiveFailures": 0, - "createdAt": "2026-06-01T09:14:00.000Z", - "updatedAt": "2026-06-20T14:03:00.000Z" - } - } - } + "$ref": "#/components/schemas/V2CompleteKnowledgeImportResponse" } } } @@ -1202,6 +1168,9 @@ "401": { "$ref": "#/components/responses/Unauthorized" }, + "402": { + "$ref": "#/components/responses/UsageLimitExceeded" + }, "403": { "$ref": "#/components/responses/Forbidden" }, @@ -1211,12 +1180,6 @@ "409": { "$ref": "#/components/responses/Conflict" }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -1227,43 +1190,34 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "delete": { - "operationId": "deleteKnowledgeConnector", - "summary": "Delete knowledge connector", - "description": "Delete a connector and optionally its synchronized documents. Documents are retained by default. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.connectors.delete", - "x-oauth-scope": "api:write", + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/connectors": { + "get": { + "operationId": "listKnowledgeConnectors", + "summary": "List knowledge connectors", + "description": "List external sources connected to a knowledge base with cursor pagination. Stored API keys are never returned. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.connectors.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:write"] + "oauthBearer": ["api:read"] } ], "parameters": [ - { - "name": "connectorId", - "in": "path", - "required": true, - "description": "Connector selected for the operation.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Connector selected for the operation." - } - }, { "name": "knowledgeBaseId", "in": "path", "required": true, - "description": "Knowledge base that owns the connector.", + "description": "Unique knowledge base identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Knowledge base that owns the connector." + "description": "Unique knowledge base identifier." } }, { @@ -1279,19 +1233,57 @@ } }, { - "name": "deleteDocuments", + "name": "sortBy", "in": "query", "required": false, - "description": "Also permanently delete documents produced by this connector.", + "description": "Field used to sort the result.", "schema": { - "description": "Also permanently delete documents produced by this connector.", - "type": "boolean" + "default": "createdAt", + "description": "Field used to sort the result.", + "type": "string", + "enum": ["connectorType", "createdAt", "updatedAt"] + } + }, + { + "name": "sortOrder", + "in": "query", + "required": false, + "description": "Sort direction.", + "schema": { + "default": "desc", + "description": "Sort direction.", + "type": "string", + "enum": ["asc", "desc"] + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Maximum connectors to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "schema": { + "default": 50, + "description": "Maximum connectors to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "type": "integer", + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "schema": { + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "type": "string", + "minLength": 1 } } ], "responses": { "200": { - "description": "Connector deletion acknowledgement and document counts.", + "description": "A page of knowledge connectors.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1306,18 +1298,34 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeConnectorDeleteResponse" + "$ref": "#/components/schemas/V2KnowledgeConnectorListResponse" }, "examples": { "example1": { "summary": "Response example 1", "value": { - "data": { - "id": "kc-9f8e7d6c", - "deleted": true, - "documentsDeleted": 0, - "documentsKept": 42 - } + "data": [ + { + "id": "kc-9f8e7d6c", + "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", + "connectorType": "notion", + "credentialId": "cred-4b3a2c1d", + "sourceConfig": { + "pageIds": ["page-123"] + }, + "syncMode": "full", + "syncIntervalMinutes": 1440, + "status": "active", + "lastSyncAt": "2026-06-20T14:02:11.000Z", + "lastSyncError": null, + "lastSyncDocCount": 42, + "nextSyncAt": "2026-06-21T14:02:11.000Z", + "consecutiveFailures": 0, + "createdAt": "2026-06-01T09:14:00.000Z", + "updatedAt": "2026-06-20T14:02:11.000Z" + } + ], + "nextCursor": null } } } @@ -1346,14 +1354,12 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}/sync": { + }, "post": { - "operationId": "syncKnowledgeConnector", - "summary": "Sync knowledge connector", - "description": "Queue a connector synchronization. Rehydration forces existing documents to be fetched and indexed again. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.connectors.sync", + "operationId": "createKnowledgeConnector", + "summary": "Create knowledge connector", + "description": "Validate and connect an external source, then queue its initial synchronization. The `apiKey` field is never returned. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.create", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -1365,43 +1371,37 @@ } ], "parameters": [ - { - "name": "connectorId", - "in": "path", - "required": true, - "description": "Connector selected for the operation.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Connector selected for the operation." - } - }, { "name": "knowledgeBaseId", "in": "path", "required": true, - "description": "Knowledge base that owns the connector.", + "description": "Unique knowledge base identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Knowledge base that owns the connector." + "description": "Unique knowledge base identifier." } } ], "requestBody": { "required": true, - "description": "Workspace scope and optional full rehydration control.", + "description": "Workspace, connector type, authentication reference, source configuration, and sync schedule.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SyncKnowledgeConnectorRequest" + "$ref": "#/components/schemas/CreateKnowledgeConnectorRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "rehydrate": false + "connectorType": "notion", + "credentialId": "cred-4b3a2c1d", + "sourceConfig": { + "pageIds": ["page-123"] + }, + "syncIntervalMinutes": 1440 } } } @@ -1409,8 +1409,8 @@ } }, "responses": { - "200": { - "description": "Synchronization was queued.", + "201": { + "description": "The created connector without secret material.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1425,7 +1425,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeConnectorSyncResponse" + "$ref": "#/components/schemas/V2KnowledgeConnectorResponse" }, "examples": { "example1": { @@ -1433,7 +1433,22 @@ "value": { "data": { "id": "kc-9f8e7d6c", - "syncTriggered": true + "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", + "connectorType": "notion", + "credentialId": "cred-4b3a2c1d", + "sourceConfig": { + "pageIds": ["page-123"] + }, + "syncMode": "full", + "syncIntervalMinutes": 1440, + "status": "active", + "lastSyncAt": "2026-06-20T14:02:11.000Z", + "lastSyncError": null, + "lastSyncDocCount": 42, + "nextSyncAt": "2026-06-21T14:02:11.000Z", + "consecutiveFailures": 0, + "createdAt": "2026-06-01T09:14:00.000Z", + "updatedAt": "2026-06-20T14:02:11.000Z" } } } @@ -1474,12 +1489,12 @@ } } }, - "/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}/documents": { + "/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}": { "get": { - "operationId": "listKnowledgeConnectorDocuments", - "summary": "List knowledge connector documents", - "description": "List documents produced by one connector with opaque cursor pagination. Excluded documents are omitted unless explicitly requested. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.connectors.documents.list", + "operationId": "getKnowledgeConnector", + "summary": "Get knowledge connector", + "description": "Get one connector and its ten most recent synchronization attempts. Stored API keys are never returned. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.connectors.read", "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ @@ -1524,45 +1539,11 @@ "maxLength": 128, "description": "Workspace that owns the knowledge base." } - }, - { - "name": "includeExcluded", - "in": "query", - "required": false, - "description": "Include documents explicitly excluded by a user.", - "schema": { - "description": "Include documents explicitly excluded by a user.", - "type": "boolean" - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "description": "Maximum connector documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "schema": { - "default": 50, - "description": "Maximum connector documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "type": "integer", - "minimum": 1, - "maximum": 100 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", - "schema": { - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", - "type": "string", - "minLength": 1 - } } ], "responses": { "200": { - "description": "A page of connector documents.", + "description": "The connector and recent synchronization history.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1577,25 +1558,32 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeConnectorDocumentListResponse" + "$ref": "#/components/schemas/V2KnowledgeConnectorDetailResponse" }, "examples": { "example1": { "summary": "Response example 1", "value": { - "data": [ - { - "id": "doc-8a7b6c5d", - "filename": "Product requirements", - "externalId": "page-123", - "sourceUrl": "https://www.notion.so/page-123", - "enabled": true, - "userExcluded": false, - "createdAt": "2026-06-01T09:15:00.000Z", - "processingStatus": "completed" - } - ], - "nextCursor": null + "data": { + "id": "kc-9f8e7d6c", + "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", + "connectorType": "notion", + "credentialId": "cred-4b3a2c1d", + "sourceConfig": { + "pageIds": ["page-123"] + }, + "syncMode": "full", + "syncIntervalMinutes": 1440, + "status": "active", + "lastSyncAt": "2026-06-20T14:02:11.000Z", + "lastSyncError": null, + "lastSyncDocCount": 42, + "nextSyncAt": "2026-06-21T14:02:11.000Z", + "consecutiveFailures": 0, + "createdAt": "2026-06-01T09:14:00.000Z", + "updatedAt": "2026-06-20T14:02:11.000Z", + "syncLogs": [] + } } } } @@ -1626,10 +1614,10 @@ } }, "patch": { - "operationId": "updateKnowledgeConnectorDocuments", - "summary": "Update knowledge connector documents", - "description": "Exclude connector documents from knowledge search or restore previously excluded documents. Only documents produced by the selected connector can change. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.connectors.documents.update", + "operationId": "updateKnowledgeConnector", + "summary": "Update knowledge connector", + "description": "Update connector source configuration, schedule, or active state. Replacing source configuration on a runnable connector queues an immediate synchronization; paused connectors retain the change without synchronizing until resumed. Source configuration cannot be replaced while synchronization is already in progress. Authentication material cannot be changed through this operation. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.update", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -1666,19 +1654,18 @@ ], "requestBody": { "required": true, - "description": "Workspace, restore or exclude operation, and selected document identifiers.", + "description": "Workspace scope and at least one mutable connector field.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateKnowledgeConnectorDocumentsRequest" + "$ref": "#/components/schemas/UpdateKnowledgeConnectorRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "operation": "exclude", - "documentIds": ["doc-8a7b6c5d"] + "status": "paused" } } } @@ -1687,7 +1674,7 @@ }, "responses": { "200": { - "description": "The selected connector documents were updated.", + "description": "The updated connector.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1702,16 +1689,30 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeConnectorDocumentsUpdateResponse" + "$ref": "#/components/schemas/UpdateKnowledgeConnectorResponse" }, "examples": { "example1": { "summary": "Response example 1", "value": { "data": { - "operation": "exclude", - "updatedCount": 1, - "documentIds": ["doc-8a7b6c5d"] + "id": "kc-9f8e7d6c", + "knowledgeBaseId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", + "connectorType": "notion", + "credentialId": "cred-4b3a2c1d", + "sourceConfig": { + "pageIds": ["page-123"] + }, + "syncMode": "full", + "syncIntervalMinutes": 1440, + "status": "paused", + "lastSyncAt": "2026-06-20T14:02:11.000Z", + "lastSyncError": null, + "lastSyncDocCount": 42, + "nextSyncAt": "2026-06-21T14:02:11.000Z", + "consecutiveFailures": 0, + "createdAt": "2026-06-01T09:14:00.000Z", + "updatedAt": "2026-06-20T14:03:00.000Z" } } } @@ -1731,6 +1732,9 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, @@ -1747,130 +1751,43 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/search": { - "post": { - "operationId": "searchKnowledge", - "summary": "Search knowledge", - "description": "Search one or more knowledge bases with semantic vector retrieval, optional hybrid full-text retrieval, and structured tag filters. Every result names the `knowledgeBaseId` it came from. A request body over 2 MiB is a `413`. Reranking returns `409` when the stored results cannot pass secret-provenance enforcement.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.search", - "x-oauth-scope": "api:read", + }, + "delete": { + "operationId": "deleteKnowledgeConnector", + "summary": "Delete knowledge connector", + "description": "Delete a connector and optionally its synchronized documents. Documents are retained by default. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:read"] + "oauthBearer": ["api:write"] } ], - "requestBody": { - "required": true, - "description": "Knowledge bases, query, result limit, retrieval mode, and optional tag filters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SearchKnowledgeRequest" - }, - "examples": { - "example1": { - "summary": "Request example 1", - "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "knowledgeBaseIds": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"], - "query": "How do I reset my password?", - "topK": 10 - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Matching document chunks ordered by relevance.", - "headers": { - "X-RateLimit-Limit": { - "$ref": "#/components/headers/X-RateLimit-Limit" - }, - "X-RateLimit-Remaining": { - "$ref": "#/components/headers/X-RateLimit-Remaining" - }, - "X-RateLimit-Reset": { - "$ref": "#/components/headers/X-RateLimit-Reset" - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/V2KnowledgeSearchResponse" - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "402": { - "$ref": "#/components/responses/UsageLimitExceeded" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, - "429": { - "$ref": "#/components/responses/RateLimited" - }, - "500": { - "$ref": "#/components/responses/InternalError" - }, - "503": { - "$ref": "#/components/responses/ServiceUnavailable" - } - } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/tags": { - "get": { - "operationId": "listKnowledgeTags", - "summary": "List tags", - "description": "List the knowledge base's tag definitions with display names, write slots, and field types. Filters and document reads use display names; document writes use slots. Returns one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.tags.list", - "x-oauth-scope": "api:read", - "tags": ["Knowledge Bases"], - "security": [ + "parameters": [ { - "apiKey": [] + "name": "connectorId", + "in": "path", + "required": true, + "description": "Connector selected for the operation.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Connector selected for the operation." + } }, - { - "oauthBearer": ["api:read"] - } - ], - "parameters": [ { "name": "knowledgeBaseId", "in": "path", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Knowledge base that owns the connector.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Knowledge base that owns the connector." } }, { @@ -1881,13 +1798,24 @@ "schema": { "type": "string", "minLength": 1, + "maxLength": 128, "description": "Workspace that owns the knowledge base." } + }, + { + "name": "deleteDocuments", + "in": "query", + "required": false, + "description": "Also permanently delete documents produced by this connector.", + "schema": { + "description": "Also permanently delete documents produced by this connector.", + "type": "boolean" + } } ], "responses": { "200": { - "description": "The knowledge base tag vocabulary.", + "description": "Connector deletion acknowledgement and document counts.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1902,7 +1830,20 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeTagListResponse" + "$ref": "#/components/schemas/V2KnowledgeConnectorDeleteResponse" + }, + "examples": { + "example1": { + "summary": "Response example 1", + "value": { + "data": { + "id": "kc-9f8e7d6c", + "deleted": true, + "documentsDeleted": 0, + "documentsKept": 42 + } + } + } } } } @@ -1929,12 +1870,14 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}/sync": { "post": { - "operationId": "createKnowledgeTag", - "summary": "Create tag", - "description": "Create a tag definition. Write document values by `tagSlot` and filter by `displayName`. Omitting `tagSlot` selects a free slot; exhaustion returns `400`. An occupied slot or duplicate name returns `409`. Use Bulk save tag definitions for multiple definitions. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.tags.create", + "operationId": "syncKnowledgeConnector", + "summary": "Sync knowledge connector", + "description": "Queue a connector synchronization. Rehydration forces existing documents to be fetched and indexed again. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.sync", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -1946,33 +1889,43 @@ } ], "parameters": [ + { + "name": "connectorId", + "in": "path", + "required": true, + "description": "Connector selected for the operation.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Connector selected for the operation." + } + }, { "name": "knowledgeBaseId", "in": "path", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Knowledge base that owns the connector.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Knowledge base that owns the connector." } } ], "requestBody": { "required": true, - "description": "Workspace scope, display name, field type, and optional slot.", + "description": "Workspace scope and optional full rehydration control.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateKnowledgeTagRequest" + "$ref": "#/components/schemas/SyncKnowledgeConnectorRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "displayName": "category", - "fieldType": "text" + "rehydrate": false } } } @@ -1980,8 +1933,8 @@ } }, "responses": { - "201": { - "description": "The created tag definition.", + "200": { + "description": "Synchronization was queued.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -1996,7 +1949,18 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeTagResponse" + "$ref": "#/components/schemas/V2KnowledgeConnectorSyncResponse" + }, + "examples": { + "example1": { + "summary": "Response example 1", + "value": { + "data": { + "id": "kc-9f8e7d6c", + "syncTriggered": true + } + } + } } } } @@ -2032,55 +1996,213 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "put": { - "operationId": "bulkSaveKnowledgeTagDefinitions", - "summary": "Bulk save tag definitions", - "description": "Create or update tag definitions, preserving unspecified slots. Updates require `originalDisplayName`; other entries create tags. Slot and name conflicts appear in per-definition `errors` with HTTP `200`, leaving conflicting values unchanged. Use Update document to set tag values. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.tags.bulk_save", - "x-oauth-scope": "api:write", + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/connectors/{connectorId}/documents": { + "get": { + "operationId": "listKnowledgeConnectorDocuments", + "summary": "List knowledge connector documents", + "description": "List documents produced by one connector with opaque cursor pagination. Excluded documents are omitted unless explicitly requested. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.connectors.documents.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:write"] + "oauthBearer": ["api:read"] } ], "parameters": [ + { + "name": "connectorId", + "in": "path", + "required": true, + "description": "Connector selected for the operation.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Connector selected for the operation." + } + }, { "name": "knowledgeBaseId", "in": "path", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Knowledge base that owns the connector.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Knowledge base that owns the connector." + } + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the knowledge base." + } + }, + { + "name": "includeExcluded", + "in": "query", + "required": false, + "description": "Include documents explicitly excluded by a user.", + "schema": { + "description": "Include documents explicitly excluded by a user.", + "type": "boolean" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Maximum connector documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "schema": { + "default": 50, + "description": "Maximum connector documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "type": "integer", + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "schema": { + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "type": "string", + "minLength": 1 } } ], - "requestBody": { - "required": true, - "description": "Workspace scope and the tag definitions to create or update.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BulkSaveKnowledgeTagDefinitionsRequest" + "responses": { + "200": { + "description": "A page of connector documents.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" }, - "examples": { - "example1": { + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2KnowledgeConnectorDocumentListResponse" + }, + "examples": { + "example1": { + "summary": "Response example 1", + "value": { + "data": [ + { + "id": "doc-8a7b6c5d", + "filename": "Product requirements", + "externalId": "page-123", + "sourceUrl": "https://www.notion.so/page-123", + "enabled": true, + "userExcluded": false, + "createdAt": "2026-06-01T09:15:00.000Z", + "processingStatus": "completed" + } + ], + "nextCursor": null + } + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" + } + } + }, + "patch": { + "operationId": "updateKnowledgeConnectorDocuments", + "summary": "Update knowledge connector documents", + "description": "Exclude connector documents from knowledge search or restore previously excluded documents. Only documents produced by the selected connector can change. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.connectors.documents.update", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] + }, + { + "oauthBearer": ["api:write"] + } + ], + "parameters": [ + { + "name": "connectorId", + "in": "path", + "required": true, + "description": "Connector selected for the operation.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Connector selected for the operation." + } + }, + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Knowledge base that owns the connector.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Knowledge base that owns the connector." + } + } + ], + "requestBody": { + "required": true, + "description": "Workspace, restore or exclude operation, and selected document identifiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateKnowledgeConnectorDocumentsRequest" + }, + "examples": { + "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "definitions": [ - { - "tagSlot": "tag1", - "displayName": "category", - "fieldType": "text" - } - ] + "operation": "exclude", + "documentIds": ["doc-8a7b6c5d"] } } } @@ -2089,7 +2211,7 @@ }, "responses": { "200": { - "description": "Definitions created and updated by the save.", + "description": "The selected connector documents were updated.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -2104,7 +2226,19 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2BulkSaveKnowledgeTagDefinitionsResponse" + "$ref": "#/components/schemas/V2KnowledgeConnectorDocumentsUpdateResponse" + }, + "examples": { + "example1": { + "summary": "Response example 1", + "value": { + "data": { + "operation": "exclude", + "updatedCount": 1, + "documentIds": ["doc-8a7b6c5d"] + } + } + } } } } @@ -2137,60 +2271,49 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "delete": { - "operationId": "deleteKnowledgeTagDefinitions", - "summary": "Delete tag definitions", - "description": "Delete unused tag definitions by default. With `unused=false`, permanently delete all definitions and their values from documents and chunks. Use Delete tag to remove one definition. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.tags.cleanup", - "x-oauth-scope": "api:write", + } + }, + "/api/v2/knowledge/search": { + "post": { + "operationId": "searchKnowledge", + "summary": "Search knowledge", + "description": "Search one or more knowledge bases with semantic vector retrieval, optional hybrid full-text retrieval, and structured tag filters. Every result names the `knowledgeBaseId` it came from. A request body over 2 MiB is a `413`. Reranking returns `409` when the stored results cannot pass secret-provenance enforcement.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.search", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:write"] + "oauthBearer": ["api:read"] } ], - "parameters": [ - { - "name": "knowledgeBaseId", - "in": "path", - "required": true, - "description": "Unique knowledge base identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge base identifier." - } - }, - { - "name": "workspaceId", - "in": "query", - "required": true, - "description": "Workspace that owns the knowledge base.", - "schema": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." - } - }, - { - "name": "unused", - "in": "query", - "required": false, - "description": "Whether to remove only the tag definitions no document in the knowledge base still carries a value for. Defaults to true. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable.", - "schema": { - "description": "Whether to remove only the tag definitions no document in the knowledge base still carries a value for. Defaults to true. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable.", - "type": "boolean" + "requestBody": { + "required": true, + "description": "Knowledge bases, query, result limit, retrieval mode, and optional tag filters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchKnowledgeRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "knowledgeBaseIds": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"], + "query": "How do I reset my password?", + "topK": 10 + } + } + } } } - ], + }, "responses": { "200": { - "description": "Number of tag definitions removed.", + "description": "Matching document chunks ordered by relevance.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -2205,7 +2328,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2DeleteKnowledgeTagDefinitionsResponse" + "$ref": "#/components/schemas/V2KnowledgeSearchResponse" } } } @@ -2216,12 +2339,24 @@ "401": { "$ref": "#/components/responses/Unauthorized" }, + "402": { + "$ref": "#/components/responses/UsageLimitExceeded" + }, "403": { "$ref": "#/components/responses/Forbidden" }, "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -2234,12 +2369,12 @@ } } }, - "/api/v2/knowledge/{knowledgeBaseId}/documents": { + "/api/v2/knowledge/{knowledgeBaseId}/tags": { "get": { - "operationId": "listKnowledgeDocuments", - "summary": "List documents", - "description": "List documents with filename search, state and tag filters, sorting, and cursor pagination. Tag values use display names; use List tags to resolve the slots required for writes.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.documents.list", + "operationId": "listKnowledgeTags", + "summary": "List tags", + "description": "List the knowledge base's tag definitions with display names, write slots, and field types. Filters and document reads use display names; document writes use slots. Returns one page; `nextCursor` is always null.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.tags.list", "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ @@ -2272,104 +2407,105 @@ "minLength": 1, "description": "Workspace that owns the knowledge base." } + } + ], + "responses": { + "200": { + "description": "The knowledge base tag vocabulary.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2KnowledgeTagListResponse" + } + } + } }, - { - "name": "limit", - "in": "query", - "required": false, - "description": "Maximum documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "schema": { - "default": 50, - "description": "Maximum documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "type": "integer", - "minimum": 1, - "maximum": 100 - } + "400": { + "$ref": "#/components/responses/BadRequest" }, - { - "name": "search", - "in": "query", - "required": false, - "description": "Case-insensitive substring match against the document filename.", - "schema": { - "description": "Case-insensitive substring match against the document filename.", - "type": "string", - "minLength": 1, - "maxLength": 200 - } + "401": { + "$ref": "#/components/responses/Unauthorized" }, - { - "name": "enabledFilter", - "in": "query", - "required": false, - "description": "Filter by whether documents are enabled for search.", - "schema": { - "default": "all", - "description": "Filter by whether documents are enabled for search.", - "type": "string", - "enum": ["all", "enabled", "disabled"] - } + "403": { + "$ref": "#/components/responses/Forbidden" }, - { - "name": "sortBy", - "in": "query", - "required": false, - "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `filename`.", - "schema": { - "default": "uploadedAt", - "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `filename`.", - "type": "string", - "enum": [ - "filename", - "fileSize", - "tokenCount", - "chunkCount", - "uploadedAt", - "processingStatus", - "enabled" - ] - } + "404": { + "$ref": "#/components/responses/NotFound" }, - { - "name": "sortOrder", - "in": "query", - "required": false, - "description": "Sort direction.", - "schema": { - "default": "desc", - "description": "Sort direction.", - "type": "string", - "enum": ["asc", "desc"] - } + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" + } + } + }, + "post": { + "operationId": "createKnowledgeTag", + "summary": "Create tag", + "description": "Create a tag definition. Write document values by `tagSlot` and filter by `displayName`. Omitting `tagSlot` selects a free slot; exhaustion returns `400`. An occupied slot or duplicate name returns `409`. Use Bulk save tag definitions for multiple definitions. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.create", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ { - "name": "cursor", - "in": "query", - "required": false, - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", - "schema": { - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", - "type": "string", - "minLength": 1 - } + "apiKey": [] }, { - "name": "tagFilters", - "in": "query", - "required": false, - "description": "A JSON-encoded array of at most 10 tag filters, using the same display-name shape as knowledge search: `[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]`. Every filter must hold, including two that name the same tag. A name that is not defined in this knowledge base is rejected, never ignored.", + "oauthBearer": ["api:write"] + } + ], + "parameters": [ + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", "schema": { - "description": "A JSON-encoded array of at most 10 tag filters, using the same display-name shape as knowledge search: `[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]`. Every filter must hold, including two that name the same tag. A name that is not defined in this knowledge base is rejected, never ignored.", - "examples": [ - "[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]" - ], - "type": "string" + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." } } ], + "requestBody": { + "required": true, + "description": "Workspace scope, display name, field type, and optional slot.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateKnowledgeTagRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "displayName": "category", + "fieldType": "text" + } + } + } + } + } + }, "responses": { - "200": { - "description": "A page of knowledge documents.", + "201": { + "description": "The created tag definition.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -2384,7 +2520,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeDocumentListResponse" + "$ref": "#/components/schemas/V2KnowledgeTagResponse" } } } @@ -2401,6 +2537,15 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -2412,11 +2557,11 @@ } } }, - "patch": { - "operationId": "bulkUpdateKnowledgeDocuments", - "summary": "Bulk enable or disable documents", - "description": "Enable or disable selected documents, or use `selectAll` for the entire knowledge base. Use Delete document to remove documents individually. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.bulk", + "put": { + "operationId": "bulkSaveKnowledgeTagDefinitions", + "summary": "Bulk save tag definitions", + "description": "Create or update tag definitions, preserving unspecified slots. Updates require `originalDisplayName`; other entries create tags. Slot and name conflicts appear in per-definition `errors` with HTTP `200`, leaving conflicting values unchanged. Use Update document to set tag values. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.bulk_save", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -2442,19 +2587,24 @@ ], "requestBody": { "required": true, - "description": "Operation and the documents it applies to.", + "description": "Workspace scope and the tag definitions to create or update.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BulkUpdateKnowledgeDocumentsRequest" + "$ref": "#/components/schemas/BulkSaveKnowledgeTagDefinitionsRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "operation": "disable", - "documentIds": ["b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"] + "definitions": [ + { + "tagSlot": "tag1", + "displayName": "category", + "fieldType": "text" + } + ] } } } @@ -2463,7 +2613,7 @@ }, "responses": { "200": { - "description": "The number and identifiers of the documents that changed.", + "description": "Definitions created and updated by the save.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -2478,7 +2628,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2BulkKnowledgeDocumentsResponse" + "$ref": "#/components/schemas/V2BulkSaveKnowledgeTagDefinitionsResponse" } } } @@ -2512,11 +2662,11 @@ } } }, - "post": { - "operationId": "uploadKnowledgeDocument", - "summary": "Upload document", - "description": "Upload one document as multipart form data. Processing continues asynchronously after the document is accepted.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.upload", + "delete": { + "operationId": "deleteKnowledgeTagDefinitions", + "summary": "Delete tag definitions", + "description": "Delete unused tag definitions by default. With `unused=false`, permanently delete all definitions and their values from documents and chunks. Use Delete tag to remove one definition. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.cleanup", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -2550,22 +2700,21 @@ "maxLength": 128, "description": "Workspace that owns the knowledge base." } - } - ], - "requestBody": { - "required": true, - "description": "Multipart form containing the document file.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/UploadKnowledgeDocumentForm" - } + }, + { + "name": "unused", + "in": "query", + "required": false, + "description": "Whether to remove only the tag definitions no document in the knowledge base still carries a value for. Defaults to true. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable.", + "schema": { + "description": "Whether to remove only the tag definitions no document in the knowledge base still carries a value for. Defaults to true. Pass `unused=false` to delete every definition on the knowledge base, which also clears its slot on every document and chunk and is not recoverable.", + "type": "boolean" } } - }, + ], "responses": { - "201": { - "description": "The accepted document queued for processing.", + "200": { + "description": "Number of tag definitions removed.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -2580,7 +2729,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeDocumentSummaryResponse" + "$ref": "#/components/schemas/V2DeleteKnowledgeTagDefinitionsResponse" } } } @@ -2591,21 +2740,12 @@ "401": { "$ref": "#/components/responses/Unauthorized" }, - "402": { - "$ref": "#/components/responses/UsageLimitExceeded" - }, "403": { "$ref": "#/components/responses/Forbidden" }, "404": { "$ref": "#/components/responses/NotFound" }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -2618,20 +2758,20 @@ } } }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads": { - "post": { - "operationId": "createKnowledgeDocumentUpload", - "summary": "Create document upload", - "description": "Create a resumable upload session and receive direct PUT or multipart transfer instructions.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.upload.create", - "x-oauth-scope": "api:write", + "/api/v2/knowledge/{knowledgeBaseId}/documents": { + "get": { + "operationId": "listKnowledgeDocuments", + "summary": "List documents", + "description": "List documents with filename search, state and tag filters, sorting, and cursor pagination. Tag values use display names; use List tags to resolve the slots required for writes.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.documents.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:write"] + "oauthBearer": ["api:read"] } ], "parameters": [ @@ -2645,151 +2785,115 @@ "minLength": 1, "description": "Unique knowledge base identifier." } - } - ], - "requestBody": { - "required": true, - "description": "Document metadata used to authorize and initialize the upload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateKnowledgeDocumentUploadRequest" - }, - "examples": { - "example1": { - "summary": "Request example 1", - "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "name": "getting-started.pdf", - "contentType": "application/pdf", - "size": 248913 - } - } - } - } - } - }, - "responses": { - "201": { - "description": "The created upload session and transfer instructions.", - "headers": { - "X-RateLimit-Limit": { - "$ref": "#/components/headers/X-RateLimit-Limit" - }, - "X-RateLimit-Remaining": { - "$ref": "#/components/headers/X-RateLimit-Remaining" - }, - "X-RateLimit-Reset": { - "$ref": "#/components/headers/X-RateLimit-Reset" - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/V2CreateKnowledgeDocumentUploadResponse" - } - } - } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "402": { - "$ref": "#/components/responses/UsageLimitExceeded" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, - "429": { - "$ref": "#/components/responses/RateLimited" - }, - "500": { - "$ref": "#/components/responses/InternalError" }, - "503": { - "$ref": "#/components/responses/ServiceUnavailable" - } - } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}": { - "delete": { - "operationId": "abortKnowledgeDocumentUpload", - "summary": "Abort document upload", - "description": "Abort an incomplete upload session and discard its uploaded data. Completed uploads cannot be aborted.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.upload.cancel", - "x-oauth-scope": "api:write", - "tags": ["Knowledge Bases"], - "security": [ { - "apiKey": [] + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Workspace that owns the knowledge base." + } }, { - "oauthBearer": ["api:write"] - } - ], - "parameters": [ + "name": "limit", + "in": "query", + "required": false, + "description": "Maximum documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "schema": { + "default": 50, + "description": "Maximum documents to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "type": "integer", + "minimum": 1, + "maximum": 100 + } + }, { - "name": "knowledgeBaseId", - "in": "path", - "required": true, - "description": "Unique knowledge base identifier.", + "name": "search", + "in": "query", + "required": false, + "description": "Case-insensitive substring match against the document filename.", "schema": { + "description": "Case-insensitive substring match against the document filename.", "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "maxLength": 200 } }, { - "name": "uploadId", - "in": "path", - "required": true, - "description": "Upload session identifier returned when the upload was created.", + "name": "enabledFilter", + "in": "query", + "required": false, + "description": "Filter by whether documents are enabled for search.", "schema": { + "default": "all", + "description": "Filter by whether documents are enabled for search.", "type": "string", - "minLength": 1, - "description": "Upload session identifier returned when the upload was created." + "enum": ["all", "enabled", "disabled"] } }, { - "name": "workspaceId", + "name": "sortBy", "in": "query", - "required": true, - "description": "Workspace that owns the knowledge base.", + "required": false, + "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `filename`.", "schema": { + "default": "uploadedAt", + "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `filename`.", "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." + "enum": [ + "filename", + "fileSize", + "tokenCount", + "chunkCount", + "uploadedAt", + "processingStatus", + "enabled" + ] } }, { - "name": "upload-token", - "in": "header", - "required": true, - "description": "Signed upload control token returned when the upload session was created.", + "name": "sortOrder", + "in": "query", + "required": false, + "description": "Sort direction.", "schema": { + "default": "desc", + "description": "Sort direction.", "type": "string", - "minLength": 1, - "description": "Signed upload control token returned when the upload session was created." + "enum": ["asc", "desc"] + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "schema": { + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "type": "string", + "minLength": 1 + } + }, + { + "name": "tagFilters", + "in": "query", + "required": false, + "description": "A JSON-encoded array of at most 10 tag filters, using the same display-name shape as knowledge search: `[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]`. Every filter must hold, including two that name the same tag. A name that is not defined in this knowledge base is rejected, never ignored.", + "schema": { + "description": "A JSON-encoded array of at most 10 tag filters, using the same display-name shape as knowledge search: `[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]`. Every filter must hold, including two that name the same tag. A name that is not defined in this knowledge base is rejected, never ignored.", + "examples": [ + "[{\"tagName\":\"category\",\"operator\":\"eq\",\"value\":\"billing\"}]" + ], + "type": "string" } } ], "responses": { "200": { - "description": "The aborted upload session.", + "description": "A page of knowledge documents.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -2804,7 +2908,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeDocumentUploadResponse" + "$ref": "#/components/schemas/V2KnowledgeDocumentListResponse" } } } @@ -2821,9 +2925,6 @@ "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" - }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -2834,14 +2935,12 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}/parts": { - "post": { - "operationId": "createKnowledgeDocumentUploadPartUrls", - "summary": "Create document upload part URLs", - "description": "Create short-lived signed PUT URLs for up to 100 multipart part numbers.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.upload.parts", + }, + "patch": { + "operationId": "bulkUpdateKnowledgeDocuments", + "summary": "Bulk enable or disable documents", + "description": "Enable or disable selected documents, or use `selectAll` for the entire knowledge base. Use Delete document to remove documents individually. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.bulk", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -2863,55 +2962,23 @@ "minLength": 1, "description": "Unique knowledge base identifier." } - }, - { - "name": "uploadId", - "in": "path", - "required": true, - "description": "Upload session identifier returned when the upload was created.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Upload session identifier returned when the upload was created." - } - }, - { - "name": "workspaceId", - "in": "query", - "required": true, - "description": "Workspace that owns the knowledge base.", - "schema": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." - } - }, - { - "name": "upload-token", - "in": "header", - "required": true, - "description": "Signed upload control token returned when the upload session was created.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Signed upload control token returned when the upload session was created." - } } ], "requestBody": { "required": true, - "description": "Multipart part numbers for which signed URLs should be created.", + "description": "Operation and the documents it applies to.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateKnowledgeDocumentUploadPartUrlsRequest" + "$ref": "#/components/schemas/BulkUpdateKnowledgeDocumentsRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { - "partNumbers": [1, 2, 3] + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "operation": "disable", + "documentIds": ["b2d4f8a0-1c3e-4a5b-9d7c-2e6f0a8b4c12"] } } } @@ -2920,7 +2987,7 @@ }, "responses": { "200": { - "description": "Signed URLs for the requested upload parts.", + "description": "The number and identifiers of the documents that changed.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -2935,7 +3002,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeDocumentUploadPartUrlsResponse" + "$ref": "#/components/schemas/V2BulkKnowledgeDocumentsResponse" } } } @@ -2952,9 +3019,6 @@ "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" - }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, @@ -2971,14 +3035,12 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}/complete": { + }, "post": { - "operationId": "completeKnowledgeDocumentUpload", - "summary": "Complete document upload", - "description": "Verify a direct upload or assemble multipart parts, create the knowledge document, and queue asynchronous processing.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.upload.complete", + "operationId": "uploadKnowledgeDocument", + "summary": "Upload document", + "description": "Upload one document as multipart form data. Processing continues asynchronously after the document is accepted.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -3001,17 +3063,6 @@ "description": "Unique knowledge base identifier." } }, - { - "name": "uploadId", - "in": "path", - "required": true, - "description": "Upload session identifier returned when the upload was created.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Upload session identifier returned when the upload was created." - } - }, { "name": "workspaceId", "in": "query", @@ -3023,122 +3074,22 @@ "maxLength": 128, "description": "Workspace that owns the knowledge base." } - }, - { - "name": "upload-token", - "in": "header", - "required": true, - "description": "Signed upload control token returned when the upload session was created.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Signed upload control token returned when the upload session was created." - } } ], - "responses": { - "200": { - "description": "The completed upload and queued document.", - "headers": { - "X-RateLimit-Limit": { - "$ref": "#/components/headers/X-RateLimit-Limit" - }, - "X-RateLimit-Remaining": { - "$ref": "#/components/headers/X-RateLimit-Remaining" - }, - "X-RateLimit-Reset": { - "$ref": "#/components/headers/X-RateLimit-Reset" - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/V2KnowledgeDocumentUploadResponse" - } + "requestBody": { + "required": true, + "description": "Multipart form containing the document file.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/UploadKnowledgeDocumentForm" } } - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "429": { - "$ref": "#/components/responses/RateLimited" - }, - "500": { - "$ref": "#/components/responses/InternalError" - }, - "503": { - "$ref": "#/components/responses/ServiceUnavailable" - } - } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}": { - "get": { - "operationId": "getKnowledgeDocument", - "summary": "Get document", - "description": "Get document metadata, processing status, and source connector details.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.documents.read", - "x-oauth-scope": "api:read", - "tags": ["Knowledge Bases"], - "security": [ - { - "apiKey": [] - }, - { - "oauthBearer": ["api:read"] - } - ], - "parameters": [ - { - "name": "documentId", - "in": "path", - "required": true, - "description": "Unique knowledge document identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge document identifier." - } - }, - { - "name": "knowledgeBaseId", - "in": "path", - "required": true, - "description": "Unique knowledge base identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge base identifier." - } - }, - { - "name": "workspaceId", - "in": "query", - "required": true, - "description": "Workspace that owns the knowledge base.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Workspace that owns the knowledge base." - } } - ], + }, "responses": { - "200": { - "description": "The requested knowledge document.", + "201": { + "description": "The accepted document queued for processing.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3153,7 +3104,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeDocumentResponse" + "$ref": "#/components/schemas/V2KnowledgeDocumentSummaryResponse" } } } @@ -3164,12 +3115,21 @@ "401": { "$ref": "#/components/responses/Unauthorized" }, + "402": { + "$ref": "#/components/responses/UsageLimitExceeded" + }, "403": { "$ref": "#/components/responses/Forbidden" }, "404": { "$ref": "#/components/responses/NotFound" }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -3180,12 +3140,14 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "patch": { - "operationId": "updateKnowledgeDocument", - "summary": "Update document", - "description": "Rename a document, change search availability, update tag slots, or requeue processing. Omitted fields remain unchanged; indexing state is read-only. Use List tags to resolve names to slots and Get document for source connector details, which this response omits. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.update", + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads": { + "post": { + "operationId": "createKnowledgeDocumentUpload", + "summary": "Create document upload", + "description": "Create a resumable upload session and receive direct PUT or multipart transfer instructions.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.create", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -3197,17 +3159,6 @@ } ], "parameters": [ - { - "name": "documentId", - "in": "path", - "required": true, - "description": "Unique knowledge document identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge document identifier." - } - }, { "name": "knowledgeBaseId", "in": "path", @@ -3222,19 +3173,20 @@ ], "requestBody": { "required": true, - "description": "Filename, search state, tag slot values, or a processing retry.", + "description": "Document metadata used to authorize and initialize the upload.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateKnowledgeDocumentRequest" + "$ref": "#/components/schemas/CreateKnowledgeDocumentUploadRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "enabled": false, - "tag1": "billing" + "name": "getting-started.pdf", + "contentType": "application/pdf", + "size": 248913 } } } @@ -3242,8 +3194,8 @@ } }, "responses": { - "200": { - "description": "The updated document, or the requeue acknowledgement.", + "201": { + "description": "The created upload session and transfer instructions.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3258,7 +3210,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2UpdateKnowledgeDocumentResponse" + "$ref": "#/components/schemas/V2CreateKnowledgeDocumentUploadResponse" } } } @@ -3269,6 +3221,9 @@ "401": { "$ref": "#/components/responses/Unauthorized" }, + "402": { + "$ref": "#/components/responses/UsageLimitExceeded" + }, "403": { "$ref": "#/components/responses/Forbidden" }, @@ -3291,12 +3246,14 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}": { "delete": { - "operationId": "deleteKnowledgeDocument", - "summary": "Delete document", - "description": "Remove a document from listings and search. Uploaded documents and their chunks are deleted. Connector documents are excluded while retaining their stored data; later synchronization does not re-add them.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.delete", + "operationId": "abortKnowledgeDocumentUpload", + "summary": "Abort document upload", + "description": "Abort an incomplete upload session and discard its uploaded data. Completed uploads cannot be aborted.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.cancel", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -3309,25 +3266,25 @@ ], "parameters": [ { - "name": "documentId", + "name": "knowledgeBaseId", "in": "path", "required": true, - "description": "Unique knowledge document identifier.", + "description": "Unique knowledge base identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge document identifier." + "description": "Unique knowledge base identifier." } }, { - "name": "knowledgeBaseId", + "name": "uploadId", "in": "path", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Upload session identifier returned when the upload was created.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Upload session identifier returned when the upload was created." } }, { @@ -3338,13 +3295,25 @@ "schema": { "type": "string", "minLength": 1, + "maxLength": 128, "description": "Workspace that owns the knowledge base." } + }, + { + "name": "upload-token", + "in": "header", + "required": true, + "description": "Signed upload control token returned when the upload session was created.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Signed upload control token returned when the upload session was created." + } } ], "responses": { "200": { - "description": "Knowledge document deletion acknowledgement.", + "description": "The aborted upload session.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3359,7 +3328,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeDeleteResponse" + "$ref": "#/components/schemas/V2KnowledgeDocumentUploadResponse" } } } @@ -3376,6 +3345,9 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -3388,85 +3360,91 @@ } } }, - "/api/v2/knowledge/folders": { - "get": { - "operationId": "listKnowledgeFolders", - "summary": "List folders", - "description": "List folders in the knowledge-base folder tree with filtering and sorting. Returns one page; `nextCursor` is always null. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.folders.list", - "x-oauth-scope": "api:read", + "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}/parts": { + "post": { + "operationId": "createKnowledgeDocumentUploadPartUrls", + "summary": "Create document upload part URLs", + "description": "Create short-lived signed PUT URLs for up to 100 multipart part numbers.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.parts", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:read"] + "oauthBearer": ["api:write"] } ], "parameters": [ { - "name": "workspaceId", - "in": "query", + "name": "knowledgeBaseId", + "in": "path", "required": true, - "description": "Workspace whose folders should be listed.", + "description": "Unique knowledge base identifier.", "schema": { "type": "string", "minLength": 1, - "maxLength": 128, - "description": "Workspace whose folders should be listed." - } - }, - { - "name": "parentPath", - "in": "query", - "required": false, - "description": "Restrict results to direct children of this parent path. Unknown folder paths contribute no matches.", - "schema": { - "description": "Restrict results to direct children of this parent path. Unknown folder paths contribute no matches.", - "$ref": "#/components/schemas/FolderPathInput" + "description": "Unique knowledge base identifier." } }, { - "name": "search", - "in": "query", - "required": false, - "description": "Case-insensitive substring match against the folder name.", + "name": "uploadId", + "in": "path", + "required": true, + "description": "Upload session identifier returned when the upload was created.", "schema": { - "description": "Case-insensitive substring match against the folder name.", "type": "string", "minLength": 1, - "maxLength": 200 + "description": "Upload session identifier returned when the upload was created." } }, { - "name": "sortBy", + "name": "workspaceId", "in": "query", - "required": false, - "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `name`.", + "required": true, + "description": "Workspace that owns the knowledge base.", "schema": { - "default": "name", - "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `name`.", "type": "string", - "enum": ["name", "createdAt", "updatedAt"] + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the knowledge base." } }, { - "name": "sortOrder", - "in": "query", - "required": false, - "description": "Sort direction.", + "name": "upload-token", + "in": "header", + "required": true, + "description": "Signed upload control token returned when the upload session was created.", "schema": { - "default": "asc", - "description": "Sort direction.", "type": "string", - "enum": ["asc", "desc"] + "minLength": 1, + "description": "Signed upload control token returned when the upload session was created." } } ], + "requestBody": { + "required": true, + "description": "Multipart part numbers for which signed URLs should be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateKnowledgeDocumentUploadPartUrlsRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "partNumbers": [1, 2, 3] + } + } + } + } + } + }, "responses": { "200": { - "description": "A page of knowledge-base folders.", + "description": "Signed URLs for the requested upload parts.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3481,7 +3459,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeFolderListResponse" + "$ref": "#/components/schemas/V2KnowledgeDocumentUploadPartUrlsResponse" } } } @@ -3498,9 +3476,15 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -3511,12 +3495,14 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/documents/uploads/{uploadId}/complete": { "post": { - "operationId": "createKnowledgeFolder", - "summary": "Create folder", - "description": "Create a folder in the knowledge-base folder tree. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.folders.create", + "operationId": "completeKnowledgeDocumentUpload", + "summary": "Complete document upload", + "description": "Verify a direct upload or assemble multipart parts, create the knowledge document, and queue asynchronous processing.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.upload.complete", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -3527,29 +3513,56 @@ "oauthBearer": ["api:write"] } ], - "requestBody": { - "required": true, - "description": "Workspace and canonical path for a new knowledge-base folder.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateKnowledgeFolderRequest" - }, - "examples": { - "example1": { - "summary": "Request example 1", - "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "path": "/Product" - } - } - } + "parameters": [ + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." + } + }, + { + "name": "uploadId", + "in": "path", + "required": true, + "description": "Upload session identifier returned when the upload was created.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Upload session identifier returned when the upload was created." + } + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the knowledge base." + } + }, + { + "name": "upload-token", + "in": "header", + "required": true, + "description": "Signed upload control token returned when the upload session was created.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Signed upload control token returned when the upload session was created." } } - }, + ], "responses": { - "201": { - "description": "The created knowledge-base folder.", + "200": { + "description": "The completed upload and queued document.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3564,7 +3577,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeFolderResponse" + "$ref": "#/components/schemas/V2KnowledgeDocumentUploadResponse" } } } @@ -3584,12 +3597,6 @@ "409": { "$ref": "#/components/responses/Conflict" }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -3600,46 +3607,62 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "patch": { - "operationId": "relocateKnowledgeFolder", - "summary": "Rename or move folder", - "description": "Rename or move a folder and atomically rewrite descendant paths. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.folders.relocate", - "x-oauth-scope": "api:write", + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}": { + "get": { + "operationId": "getKnowledgeDocument", + "summary": "Get document", + "description": "Get document metadata, processing status, and source connector details.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.documents.read", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:write"] + "oauthBearer": ["api:read"] } ], - "requestBody": { - "required": true, - "description": "Current and destination canonical paths for a knowledge-base folder.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RelocateKnowledgeFolderRequest" - }, - "examples": { - "example1": { - "summary": "Request example 1", - "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "path": "/Product", - "destinationPath": "/Archive/Product" - } - } - } + "parameters": [ + { + "name": "documentId", + "in": "path", + "required": true, + "description": "Unique knowledge document identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge document identifier." + } + }, + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." + } + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Workspace that owns the knowledge base." } } - }, + ], "responses": { "200": { - "description": "The relocated knowledge-base folder.", + "description": "The requested knowledge document.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3654,7 +3677,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeFolderResponse" + "$ref": "#/components/schemas/V2KnowledgeDocumentResponse" } } } @@ -3671,15 +3694,6 @@ "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -3691,14 +3705,14 @@ } } }, - "delete": { - "operationId": "deleteKnowledgeFolder", - "summary": "Delete folder", - "description": "Archive an empty folder, or set `recursive=true` to archive its subfolders and knowledge bases. Use Restore knowledge base to recover knowledge bases.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.folders.delete", - "x-oauth-scope": "api:write", - "tags": ["Knowledge Bases"], - "security": [ + "patch": { + "operationId": "updateKnowledgeDocument", + "summary": "Update document", + "description": "Rename a document, change search availability, update tag slots, or requeue processing. Omitted fields remain unchanged; indexing state is read-only. Use List tags to resolve names to slots and Get document for source connector details, which this response omits. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.update", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ { "apiKey": [] }, @@ -3708,122 +3722,16 @@ ], "parameters": [ { - "name": "workspaceId", - "in": "query", + "name": "documentId", + "in": "path", "required": true, - "description": "Workspace containing the folder.", + "description": "Unique knowledge document identifier.", "schema": { "type": "string", "minLength": 1, - "maxLength": 128, - "description": "Workspace containing the folder." - } - }, - { - "name": "path", - "in": "query", - "required": true, - "description": "Path of the folder to delete.", - "schema": { - "description": "Path of the folder to delete.", - "$ref": "#/components/schemas/NonRootFolderPathInput" - } - }, - { - "name": "recursive", - "in": "query", - "required": false, - "description": "Delete the folder's contents and nested folders too. Required for a non-empty folder. Only the listed case-sensitive spellings are accepted.", - "schema": { - "description": "Delete the folder's contents and nested folders too. Required for a non-empty folder. Only the listed case-sensitive spellings are accepted.", - "enum": [ - "true", - "1", - "yes", - "on", - "y", - "enabled", - "false", - "0", - "no", - "off", - "n", - "disabled" - ], - "default": "false", - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Folder deletion acknowledgement and deleted item counts.", - "headers": { - "X-RateLimit-Limit": { - "$ref": "#/components/headers/X-RateLimit-Limit" - }, - "X-RateLimit-Remaining": { - "$ref": "#/components/headers/X-RateLimit-Remaining" - }, - "X-RateLimit-Reset": { - "$ref": "#/components/headers/X-RateLimit-Reset" - } - }, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/V2DeleteKnowledgeFolderResponse" - } - } + "description": "Unique knowledge document identifier." } }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "401": { - "$ref": "#/components/responses/Unauthorized" - }, - "403": { - "$ref": "#/components/responses/Forbidden" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "429": { - "$ref": "#/components/responses/RateLimited" - }, - "500": { - "$ref": "#/components/responses/InternalError" - }, - "503": { - "$ref": "#/components/responses/ServiceUnavailable" - } - } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/restore": { - "post": { - "operationId": "restoreKnowledgeBase", - "summary": "Restore knowledge base", - "description": "Restore a knowledge base and the documents and connectors archived with it. Active knowledge bases return unchanged without a new audit event. An archived workspace returns `409`; an archived containing folder moves the restored knowledge base to the workspace root. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.restore", - "x-oauth-scope": "api:write", - "tags": ["Knowledge Bases"], - "security": [ - { - "apiKey": [] - }, - { - "oauthBearer": ["api:write"] - } - ], - "parameters": [ { "name": "knowledgeBaseId", "in": "path", @@ -3838,17 +3746,19 @@ ], "requestBody": { "required": true, - "description": "Workspace scope for the knowledge base.", + "description": "Filename, search state, tag slot values, or a processing retry.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RestoreKnowledgeBaseRequest" + "$ref": "#/components/schemas/UpdateKnowledgeDocumentRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64" + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "enabled": false, + "tag1": "billing" } } } @@ -3857,7 +3767,7 @@ }, "responses": { "200": { - "description": "The restored knowledge base.", + "description": "The updated document, or the requeue acknowledgement.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3872,7 +3782,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeBaseResponse" + "$ref": "#/components/schemas/V2UpdateKnowledgeDocumentResponse" } } } @@ -3889,9 +3799,6 @@ "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" - }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, @@ -3908,14 +3815,12 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/from-workspace-files": { - "post": { - "operationId": "addWorkspaceFilesToKnowledgeBase", - "summary": "Index workspace files", - "description": "Queue stored workspace files for indexing without re-uploading bytes. Unreadable, unsupported, or over-100 MiB files appear in `failed`; valid files are queued. Partial success returns `200`. Use Get document to poll processing after receiving document IDs. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.documents.add_workspace_files", + }, + "delete": { + "operationId": "deleteKnowledgeDocument", + "summary": "Delete document", + "description": "Remove a document from listings and search. Uploaded documents and their chunks are deleted. Connector documents are excluded while retaining their stored data; later synchronization does not re-add them.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.delete", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -3927,6 +3832,17 @@ } ], "parameters": [ + { + "name": "documentId", + "in": "path", + "required": true, + "description": "Unique knowledge document identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge document identifier." + } + }, { "name": "knowledgeBaseId", "in": "path", @@ -3937,31 +3853,22 @@ "minLength": 1, "description": "Unique knowledge base identifier." } - } - ], - "requestBody": { - "required": true, - "description": "Workspace scope and the workspace file references to index.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AddWorkspaceFilesToKnowledgeBaseRequest" - }, - "examples": { - "example1": { - "summary": "Request example 1", - "value": { - "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "fileReferences": ["handbook.pdf"] - } - } - } + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Workspace that owns the knowledge base." } } - }, + ], "responses": { "200": { - "description": "Files queued for indexing, with any that could not be.", + "description": "Knowledge document deletion acknowledgement.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -3976,7 +3883,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2AddWorkspaceFilesToKnowledgeBaseResponse" + "$ref": "#/components/schemas/V2KnowledgeDeleteResponse" } } } @@ -3987,21 +3894,12 @@ "401": { "$ref": "#/components/responses/Unauthorized" }, - "402": { - "$ref": "#/components/responses/UsageLimitExceeded" - }, "403": { "$ref": "#/components/responses/Forbidden" }, "404": { "$ref": "#/components/responses/NotFound" }, - "413": { - "$ref": "#/components/responses/PayloadTooLarge" - }, - "415": { - "$ref": "#/components/responses/UnsupportedMediaType" - }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -4014,12 +3912,12 @@ } } }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}/chunks": { + "/api/v2/knowledge/folders": { "get": { - "operationId": "listKnowledgeChunks", - "summary": "List chunks", - "description": "List document chunks with content search, enabled filtering, sorting, and cursor pagination. Tags use slots; use List tags to resolve display names. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.chunks.list", + "operationId": "listKnowledgeFolders", + "summary": "List folders", + "description": "List folders in the knowledge-base folder tree with filtering and sorting. Returns one page; `nextCursor` is always null. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.folders.list", "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ @@ -4032,73 +3930,49 @@ ], "parameters": [ { - "name": "documentId", - "in": "path", - "required": true, - "description": "Unique knowledge document identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge document identifier." - } - }, - { - "name": "knowledgeBaseId", - "in": "path", + "name": "workspaceId", + "in": "query", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Workspace whose folders should be listed.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "maxLength": 128, + "description": "Workspace whose folders should be listed." } }, { - "name": "workspaceId", + "name": "parentPath", "in": "query", - "required": true, - "description": "Workspace that owns the knowledge base.", + "required": false, + "description": "Restrict results to direct children of this parent path. Unknown folder paths contribute no matches.", "schema": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." + "description": "Restrict results to direct children of this parent path. Unknown folder paths contribute no matches.", + "$ref": "#/components/schemas/FolderPathInput" } }, { "name": "search", "in": "query", "required": false, - "description": "Case-insensitive substring match against chunk content.", + "description": "Case-insensitive substring match against the folder name.", "schema": { - "description": "Case-insensitive substring match against chunk content.", + "description": "Case-insensitive substring match against the folder name.", "type": "string", "minLength": 1, "maxLength": 200 } }, { - "name": "enabled", + "name": "sortBy", "in": "query", "required": false, - "description": "Restrict to enabled or disabled chunks. `all` returns both.", + "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `name`.", "schema": { - "default": "all", - "description": "Restrict to enabled or disabled chunks. `all` returns both.", - "type": "string", - "enum": ["true", "false", "all"] - } - }, - { - "name": "sortBy", - "in": "query", - "required": false, - "description": "Field used to sort the result.", - "schema": { - "default": "chunkIndex", - "description": "Field used to sort the result.", + "default": "name", + "description": "Field used to sort the result. Do not rely on case-insensitive ordering when sorting by `name`.", "type": "string", - "enum": ["chunkIndex", "tokenCount", "enabled"] + "enum": ["name", "createdAt", "updatedAt"] } }, { @@ -4112,35 +3986,11 @@ "type": "string", "enum": ["asc", "desc"] } - }, - { - "name": "limit", - "in": "query", - "required": false, - "description": "Maximum chunks to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "schema": { - "default": 50, - "description": "Maximum chunks to return per page. Must be a whole number from 1 to 100. Defaults to 50.", - "type": "integer", - "minimum": 1, - "maximum": 100 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", - "schema": { - "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", - "type": "string", - "minLength": 1 - } } ], "responses": { "200": { - "description": "A page of document chunks.", + "description": "A page of knowledge-base folders.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4155,7 +4005,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeChunkListResponse" + "$ref": "#/components/schemas/V2KnowledgeFolderListResponse" } } } @@ -4172,8 +4022,8 @@ "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" + "413": { + "$ref": "#/components/responses/PayloadTooLarge" }, "429": { "$ref": "#/components/responses/RateLimited" @@ -4187,10 +4037,10 @@ } }, "post": { - "operationId": "createKnowledgeChunk", - "summary": "Create chunk", - "description": "Append a chunk and embed it before returning. It inherits the document's tags and next `chunkIndex`. Search includes it when the chunk and document are enabled and the document has completed processing. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.chunks.create", + "operationId": "createKnowledgeFolder", + "summary": "Create folder", + "description": "Create a folder in the knowledge-base folder tree. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.folders.create", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -4201,44 +4051,20 @@ "oauthBearer": ["api:write"] } ], - "parameters": [ - { - "name": "documentId", - "in": "path", - "required": true, - "description": "Unique knowledge document identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge document identifier." - } - }, - { - "name": "knowledgeBaseId", - "in": "path", - "required": true, - "description": "Unique knowledge base identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge base identifier." - } - } - ], "requestBody": { "required": true, - "description": "Workspace scope and the text to embed.", + "description": "Workspace and canonical path for a new knowledge-base folder.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CreateKnowledgeChunkRequest" + "$ref": "#/components/schemas/CreateKnowledgeFolderRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "content": "To reset your password, open Settings and choose Security." + "path": "/Product" } } } @@ -4247,7 +4073,7 @@ }, "responses": { "201": { - "description": "The created chunk.", + "description": "The created knowledge-base folder.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4262,7 +4088,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeChunkResponse" + "$ref": "#/components/schemas/V2KnowledgeFolderResponse" } } } @@ -4279,6 +4105,9 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, @@ -4297,10 +4126,10 @@ } }, "patch": { - "operationId": "bulkUpdateKnowledgeChunks", - "summary": "Bulk update chunks", - "description": "Enable, disable, or delete multiple chunks in one best-effort request. Unknown chunk IDs appear in `errors` without failing the request; `processed` counts matched chunks, not changes. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.chunks.bulk", + "operationId": "relocateKnowledgeFolder", + "summary": "Rename or move folder", + "description": "Rename or move a folder and atomically rewrite descendant paths. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.folders.relocate", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -4311,45 +4140,21 @@ "oauthBearer": ["api:write"] } ], - "parameters": [ - { - "name": "documentId", - "in": "path", - "required": true, - "description": "Unique knowledge document identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge document identifier." - } - }, - { - "name": "knowledgeBaseId", - "in": "path", - "required": true, - "description": "Unique knowledge base identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge base identifier." - } - } - ], "requestBody": { "required": true, - "description": "Workspace scope, the operation to apply, and the chunks to apply it to.", + "description": "Current and destination canonical paths for a knowledge-base folder.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BulkUpdateKnowledgeChunksRequest" + "$ref": "#/components/schemas/RelocateKnowledgeFolderRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "operation": "disable", - "chunkIds": ["4c1f9e77-2b3a-4f8d-9e10-6a2c8d4b1e05"] + "path": "/Product", + "destinationPath": "/Archive/Product" } } } @@ -4358,7 +4163,7 @@ }, "responses": { "200": { - "description": "Outcome of the bulk chunk operation.", + "description": "The relocated knowledge-base folder.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4373,7 +4178,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2BulkKnowledgeChunksResponse" + "$ref": "#/components/schemas/V2KnowledgeFolderResponse" } } } @@ -4390,6 +4195,9 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, @@ -4406,74 +4214,74 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}/chunks/{chunkId}": { - "get": { - "operationId": "getKnowledgeChunk", - "summary": "Get chunk", - "description": "Get one chunk of a document, including the exact text that was embedded. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.chunks.read", - "x-oauth-scope": "api:read", + }, + "delete": { + "operationId": "deleteKnowledgeFolder", + "summary": "Delete folder", + "description": "Archive an empty folder, or set `recursive=true` to archive its subfolders and knowledge bases. Use Restore knowledge base to recover knowledge bases.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.folders.delete", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:read"] + "oauthBearer": ["api:write"] } ], "parameters": [ { - "name": "documentId", - "in": "path", - "required": true, - "description": "Unique knowledge document identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge document identifier." - } - }, - { - "name": "chunkId", - "in": "path", + "name": "workspaceId", + "in": "query", "required": true, - "description": "Unique chunk identifier.", + "description": "Workspace containing the folder.", "schema": { "type": "string", "minLength": 1, - "description": "Unique chunk identifier." + "maxLength": 128, + "description": "Workspace containing the folder." } }, { - "name": "knowledgeBaseId", - "in": "path", + "name": "path", + "in": "query", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Path of the folder to delete.", "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Path of the folder to delete.", + "$ref": "#/components/schemas/NonRootFolderPathInput" } }, { - "name": "workspaceId", + "name": "recursive", "in": "query", - "required": true, - "description": "Workspace that owns the knowledge base.", + "required": false, + "description": "Delete the folder's contents and nested folders too. Required for a non-empty folder. Only the listed case-sensitive spellings are accepted.", "schema": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." + "description": "Delete the folder's contents and nested folders too. Required for a non-empty folder. Only the listed case-sensitive spellings are accepted.", + "enum": [ + "true", + "1", + "yes", + "on", + "y", + "enabled", + "false", + "0", + "no", + "off", + "n", + "disabled" + ], + "default": "false", + "type": "string" } } ], "responses": { "200": { - "description": "The requested chunk.", + "description": "Folder deletion acknowledgement and deleted item counts.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4488,7 +4296,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeChunkResponse" + "$ref": "#/components/schemas/V2DeleteKnowledgeFolderResponse" } } } @@ -4508,6 +4316,9 @@ "409": { "$ref": "#/components/responses/Conflict" }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -4518,12 +4329,14 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "patch": { - "operationId": "updateKnowledgeChunk", - "summary": "Update chunk", - "description": "Correct chunk text or disable it from search. Changing `content` re-embeds immediately and recalculates document token and character counts; disabling retains the index. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.chunks.update", + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/restore": { + "post": { + "operationId": "restoreKnowledgeBase", + "summary": "Restore knowledge base", + "description": "Restore a knowledge base and the documents and connectors archived with it. Active knowledge bases return unchanged without a new audit event. An archived workspace returns `409`; an archived containing folder moves the restored knowledge base to the workspace root. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.restore", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -4536,27 +4349,108 @@ ], "parameters": [ { - "name": "documentId", - "in": "path", - "required": true, - "description": "Unique knowledge document identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique knowledge document identifier." - } - }, - { - "name": "chunkId", + "name": "knowledgeBaseId", "in": "path", "required": true, - "description": "Unique chunk identifier.", + "description": "Unique knowledge base identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Unique chunk identifier." + "description": "Unique knowledge base identifier." } + } + ], + "requestBody": { + "required": true, + "description": "Workspace scope for the knowledge base.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RestoreKnowledgeBaseRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "The restored knowledge base.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2KnowledgeBaseResponse" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" + } + } + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/documents/from-workspace-files": { + "post": { + "operationId": "addWorkspaceFilesToKnowledgeBase", + "summary": "Index workspace files", + "description": "Queue stored workspace files for indexing without re-uploading bytes. Unreadable, unsupported, or over-100 MiB files appear in `failed`; valid files are queued. Partial success returns `200`. Use Get document to poll processing after receiving document IDs. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.documents.add_workspace_files", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] }, + { + "oauthBearer": ["api:write"] + } + ], + "parameters": [ { "name": "knowledgeBaseId", "in": "path", @@ -4571,18 +4465,18 @@ ], "requestBody": { "required": true, - "description": "Workspace scope and the fields to update. At least one is required.", + "description": "Workspace scope and the workspace file references to index.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateKnowledgeChunkRequest" + "$ref": "#/components/schemas/AddWorkspaceFilesToKnowledgeBaseRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "enabled": false + "fileReferences": ["handbook.pdf"] } } } @@ -4591,7 +4485,7 @@ }, "responses": { "200": { - "description": "The updated chunk.", + "description": "Files queued for indexing, with any that could not be.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4606,7 +4500,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeChunkResponse" + "$ref": "#/components/schemas/V2AddWorkspaceFilesToKnowledgeBaseResponse" } } } @@ -4617,15 +4511,15 @@ "401": { "$ref": "#/components/responses/Unauthorized" }, + "402": { + "$ref": "#/components/responses/UsageLimitExceeded" + }, "403": { "$ref": "#/components/responses/Forbidden" }, "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" - }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, @@ -4642,20 +4536,22 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "delete": { - "operationId": "deleteKnowledgeChunk", - "summary": "Delete chunk", - "description": "Permanently remove one chunk and subtract it from document counts. Remaining `chunkIndex` values stay stable and may become non-contiguous. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.chunks.delete", - "x-oauth-scope": "api:write", + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}/chunks": { + "get": { + "operationId": "listKnowledgeChunks", + "summary": "List chunks", + "description": "List document chunks with content search, enabled filtering, sorting, and cursor pagination. Tags use slots; use List tags to resolve display names. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.chunks.list", + "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:write"] + "oauthBearer": ["api:read"] } ], "parameters": [ @@ -4670,17 +4566,6 @@ "description": "Unique knowledge document identifier." } }, - { - "name": "chunkId", - "in": "path", - "required": true, - "description": "Unique chunk identifier.", - "schema": { - "type": "string", - "minLength": 1, - "description": "Unique chunk identifier." - } - }, { "name": "knowledgeBaseId", "in": "path", @@ -4703,11 +4588,83 @@ "maxLength": 128, "description": "Workspace that owns the knowledge base." } + }, + { + "name": "search", + "in": "query", + "required": false, + "description": "Case-insensitive substring match against chunk content.", + "schema": { + "description": "Case-insensitive substring match against chunk content.", + "type": "string", + "minLength": 1, + "maxLength": 200 + } + }, + { + "name": "enabled", + "in": "query", + "required": false, + "description": "Restrict to enabled or disabled chunks. `all` returns both.", + "schema": { + "default": "all", + "description": "Restrict to enabled or disabled chunks. `all` returns both.", + "type": "string", + "enum": ["true", "false", "all"] + } + }, + { + "name": "sortBy", + "in": "query", + "required": false, + "description": "Field used to sort the result.", + "schema": { + "default": "chunkIndex", + "description": "Field used to sort the result.", + "type": "string", + "enum": ["chunkIndex", "tokenCount", "enabled"] + } + }, + { + "name": "sortOrder", + "in": "query", + "required": false, + "description": "Sort direction.", + "schema": { + "default": "asc", + "description": "Sort direction.", + "type": "string", + "enum": ["asc", "desc"] + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Maximum chunks to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "schema": { + "default": 50, + "description": "Maximum chunks to return per page. Must be a whole number from 1 to 100. Defaults to 50.", + "type": "integer", + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "schema": { + "description": "Opaque cursor from the previous page. Send it back with the same sort and filters; only `limit` may change. Change anything else and pagination must restart without a cursor.", + "type": "string", + "minLength": 1 + } } ], "responses": { "200": { - "description": "Chunk deletion acknowledgement.", + "description": "A page of document chunks.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4722,7 +4679,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeDeleteResponse" + "$ref": "#/components/schemas/V2KnowledgeChunkListResponse" } } } @@ -4752,14 +4709,12 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}": { - "patch": { - "operationId": "updateKnowledgeTag", - "summary": "Update tag", - "description": "Rename a tag or change its slot-compatible `fieldType`. Renaming changes read and filter names without moving the slot or its values. Slots are fixed for a tag's lifetime; an incompatible type returns `400` and requires creating a new tag. A duplicate display name returns `409`. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.tags.update", + }, + "post": { + "operationId": "createKnowledgeChunk", + "summary": "Create chunk", + "description": "Append a chunk and embed it before returning. It inherits the document's tags and next `chunkIndex`. Search includes it when the chunk and document are enabled and the document has completed processing. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.create", "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ @@ -4772,14 +4727,14 @@ ], "parameters": [ { - "name": "tagId", + "name": "documentId", "in": "path", "required": true, - "description": "Unique tag definition identifier.", + "description": "Unique knowledge document identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Unique tag definition identifier." + "description": "Unique knowledge document identifier." } }, { @@ -4796,18 +4751,18 @@ ], "requestBody": { "required": true, - "description": "Workspace scope and the fields to update. At least one is required.", + "description": "Workspace scope and the text to embed.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UpdateKnowledgeTagRequest" + "$ref": "#/components/schemas/CreateKnowledgeChunkRequest" }, "examples": { "example1": { "summary": "Request example 1", "value": { "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", - "displayName": "topic" + "content": "To reset your password, open Settings and choose Security." } } } @@ -4815,8 +4770,8 @@ } }, "responses": { - "200": { - "description": "The updated tag definition.", + "201": { + "description": "The created chunk.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4831,7 +4786,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeTagResponse" + "$ref": "#/components/schemas/V2KnowledgeChunkResponse" } } } @@ -4848,9 +4803,6 @@ "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" - }, "413": { "$ref": "#/components/responses/PayloadTooLarge" }, @@ -4868,14 +4820,14 @@ } } }, - "delete": { - "operationId": "deleteKnowledgeTag", - "summary": "Delete tag", - "description": "Permanently delete a tag definition and its values from every document and chunk in the knowledge base. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", - "x-sim-operation": "knowledge.tags.delete", - "x-oauth-scope": "api:write", - "tags": ["Knowledge Bases"], - "security": [ + "patch": { + "operationId": "bulkUpdateKnowledgeChunks", + "summary": "Bulk update chunks", + "description": "Enable, disable, or delete multiple chunks in one best-effort request. Unknown chunk IDs appear in `errors` without failing the request; `processed` counts matched chunks, not changes. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.bulk", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ { "apiKey": [] }, @@ -4885,14 +4837,14 @@ ], "parameters": [ { - "name": "tagId", + "name": "documentId", "in": "path", "required": true, - "description": "Unique tag definition identifier.", + "description": "Unique knowledge document identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Unique tag definition identifier." + "description": "Unique knowledge document identifier." } }, { @@ -4905,23 +4857,32 @@ "minLength": 1, "description": "Unique knowledge base identifier." } - }, - { - "name": "workspaceId", - "in": "query", - "required": true, - "description": "Workspace that owns the knowledge base.", - "schema": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." - } } ], + "requestBody": { + "required": true, + "description": "Workspace scope, the operation to apply, and the chunks to apply it to.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkUpdateKnowledgeChunksRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "operation": "disable", + "chunkIds": ["4c1f9e77-2b3a-4f8d-9e10-6a2c8d4b1e05"] + } + } + } + } + } + }, "responses": { "200": { - "description": "Tag deletion acknowledgement.", + "description": "Outcome of the bulk chunk operation.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -4936,7 +4897,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2DeleteKnowledgeTagResponse" + "$ref": "#/components/schemas/V2BulkKnowledgeChunksResponse" } } } @@ -4953,8 +4914,11 @@ "404": { "$ref": "#/components/responses/NotFound" }, - "409": { - "$ref": "#/components/responses/Conflict" + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" }, "429": { "$ref": "#/components/responses/RateLimited" @@ -4968,12 +4932,12 @@ } } }, - "/api/v2/knowledge/{knowledgeBaseId}/tags/next-slot": { + "/api/v2/knowledge/{knowledgeBaseId}/documents/{documentId}/chunks/{chunkId}": { "get": { - "operationId": "getNextKnowledgeTagSlot", - "summary": "Get next tag slot", - "description": "Get the next available slot and remaining capacity for a field type. This does not reserve a slot. Create tag selects a free slot when `tagSlot` is omitted. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.tags.read_next_slot", + "operationId": "getKnowledgeChunk", + "summary": "Get chunk", + "description": "Get one chunk of a document, including the exact text that was embedded. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.chunks.read", "x-oauth-scope": "api:read", "tags": ["Knowledge Bases"], "security": [ @@ -4985,6 +4949,28 @@ } ], "parameters": [ + { + "name": "documentId", + "in": "path", + "required": true, + "description": "Unique knowledge document identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge document identifier." + } + }, + { + "name": "chunkId", + "in": "path", + "required": true, + "description": "Unique chunk identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique chunk identifier." + } + }, { "name": "knowledgeBaseId", "in": "path", @@ -5007,23 +4993,11 @@ "maxLength": 128, "description": "Workspace that owns the knowledge base." } - }, - { - "name": "fieldType", - "in": "query", - "required": true, - "description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.", - "schema": { - "type": "string", - "enum": ["text", "number", "date", "boolean"], - "description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.", - "examples": ["text"] - } } ], "responses": { "200": { - "description": "Slot availability for the requested field type.", + "description": "The requested chunk.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -5038,7 +5012,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2NextKnowledgeTagSlotResponse" + "$ref": "#/components/schemas/V2KnowledgeChunkResponse" } } } @@ -5055,6 +5029,9 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -5065,52 +5042,80 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - }, - "/api/v2/knowledge/{knowledgeBaseId}/tags/usage": { - "get": { - "operationId": "listKnowledgeTagUsage", - "summary": "List tag usage", - "description": "Count the documents and chunks with a value for each defined tag. Returns one page; `nextCursor` is always null. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", - "x-sim-operation": "knowledge.tags.read_usage", - "x-oauth-scope": "api:read", + }, + "patch": { + "operationId": "updateKnowledgeChunk", + "summary": "Update chunk", + "description": "Correct chunk text or disable it from search. Changing `content` re-embeds immediately and recalculates document token and character counts; disabling retains the index. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.update", + "x-oauth-scope": "api:write", "tags": ["Knowledge Bases"], "security": [ { "apiKey": [] }, { - "oauthBearer": ["api:read"] + "oauthBearer": ["api:write"] } ], "parameters": [ { - "name": "knowledgeBaseId", + "name": "documentId", "in": "path", "required": true, - "description": "Unique knowledge base identifier.", + "description": "Unique knowledge document identifier.", "schema": { "type": "string", "minLength": 1, - "description": "Unique knowledge base identifier." + "description": "Unique knowledge document identifier." } }, { - "name": "workspaceId", - "in": "query", + "name": "chunkId", + "in": "path", "required": true, - "description": "Workspace that owns the knowledge base.", + "description": "Unique chunk identifier.", "schema": { "type": "string", "minLength": 1, - "maxLength": 128, - "description": "Workspace that owns the knowledge base." + "description": "Unique chunk identifier." + } + }, + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." } } ], + "requestBody": { + "required": true, + "description": "Workspace scope and the fields to update. At least one is required.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateKnowledgeChunkRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "enabled": false + } + } + } + } + } + }, "responses": { "200": { - "description": "Usage counts for every defined tag.", + "description": "The updated chunk.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -5125,7 +5130,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/V2KnowledgeTagUsageListResponse" + "$ref": "#/components/schemas/V2KnowledgeChunkResponse" } } } @@ -5142,6 +5147,15 @@ "404": { "$ref": "#/components/responses/NotFound" }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, "429": { "$ref": "#/components/responses/RateLimited" }, @@ -5152,417 +5166,1276 @@ "$ref": "#/components/responses/ServiceUnavailable" } } - } - } - }, - "components": { - "securitySchemes": { - "apiKey": { - "type": "apiKey", - "in": "header", - "name": "X-API-Key", - "description": "Send a personal or workspace API key in `X-API-Key`. See [key types and access](https://docs.sim.ai/api-reference/authentication#key-types); operations that reject workspace keys say so in their description." }, - "oauthBearer": { - "type": "oauth2", - "description": "Send a Sim OAuth access token in `Authorization: Bearer`. See [OAuth authentication and scopes](https://docs.sim.ai/api-reference/authentication#oauth-access-tokens).", - "flows": { - "authorizationCode": { - "authorizationUrl": "https://www.sim.ai/api/auth/oauth2/authorize", - "tokenUrl": "https://www.sim.ai/api/auth/oauth2/token", - "refreshUrl": "https://www.sim.ai/api/auth/oauth2/token", - "scopes": { - "api:read": "Read your workspaces, workflows, files, tables, and logs", - "api:write": "Read, create, change, run, and delete resources in your workspaces", - "offline_access": "Stay signed in without asking again" - } + "delete": { + "operationId": "deleteKnowledgeChunk", + "summary": "Delete chunk", + "description": "Permanently remove one chunk and subtract it from document counts. Remaining `chunkIndex` values stay stable and may become non-contiguous. Connector-synced chunks are read-only and return `403` with `error.details.code: \"CONNECTOR_MANAGED_RESOURCE_READ_ONLY\"`; change the source and re-sync, or exclude the document. Documents that have not finished processing return `409` with their current status. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.chunks.delete", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] + }, + { + "oauthBearer": ["api:write"] } - } - } - }, - "headers": { - "Content-Type": { - "description": "MIME type of the file, defaulting to application/octet-stream when the stored type is unavailable.", - "schema": { - "type": "string", - "title": "Content type", - "description": "MIME type of the file, defaulting to application/octet-stream when the stored type is unavailable." - } - }, - "Content-Disposition": { - "description": "Attachment disposition containing sanitized and RFC 5987 encoded filenames.", - "schema": { - "type": "string", - "title": "Content disposition", - "description": "Attachment disposition containing sanitized and RFC 5987 encoded filenames." - } - }, - "Content-Length": { - "description": "File size in bytes.", - "schema": { - "type": "string", - "pattern": "^(0|[1-9]\\d*)$", - "title": "Content length", - "description": "File size in bytes." - } - }, - "X-RateLimit-Limit": { - "description": "Maximum requests allowed in the current window.", - "schema": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991, - "title": "Rate limit", - "description": "Maximum requests allowed in the current window." - } - }, - "X-RateLimit-Remaining": { - "description": "Requests remaining in the current window.", - "schema": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991, - "title": "Rate limit remaining", - "description": "Requests remaining in the current window." - } - }, - "X-RateLimit-Reset": { - "description": "ISO 8601 timestamp when the current rate-limit window resets.", - "schema": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", - "title": "Rate limit reset", - "description": "ISO 8601 timestamp when the current rate-limit window resets." - } - }, - "Retry-After": { - "description": "Seconds to wait before retrying, sent on `429` and `503`. Add jitter rather than retrying at exactly this offset.", - "schema": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991, - "title": "Retry after", - "description": "Seconds to wait before retrying, sent on `429` and `503`. Add jitter rather than retrying at exactly this offset." - } - }, - "X-Run-Id": { - "description": "Identifier assigned to the workflow run.", - "schema": { - "type": "string", - "minLength": 1, - "title": "Run identifier", - "description": "Identifier assigned to the workflow run." - } - } - }, - "responses": { - "BadRequest": { - "description": "The request is invalid. This includes a query parameter sent with no value (`?limit=`, `?search=`), which is rejected rather than read as zero, empty, or the parameter default — omit the parameter instead.", - "content": { - "application/json": { + ], + "parameters": [ + { + "name": "documentId", + "in": "path", + "required": true, + "description": "Unique knowledge document identifier.", "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "BAD_REQUEST", - "message": "Invalid request" - } + "type": "string", + "minLength": 1, + "description": "Unique knowledge document identifier." } - } - } - }, - "Unauthorized": { - "description": "The API credential is missing or invalid.", - "content": { - "application/json": { + }, + { + "name": "chunkId", + "in": "path", + "required": true, + "description": "Unique chunk identifier.", "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "UNAUTHORIZED", - "message": "Authentication required" - } + "type": "string", + "minLength": 1, + "description": "Unique chunk identifier." } - } - } - }, - "UsageLimitExceeded": { - "description": "The workspace has exceeded its usage or billing limits.", - "content": { - "application/json": { + }, + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "USAGE_LIMIT_EXCEEDED", - "message": "Usage limit exceeded. Please upgrade your plan to continue." - } + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." } - } - } - }, - "Forbidden": { - "description": "The caller lacks the rights this operation requires. When the cause is one a caller can act on, `error.details.code` names it. A resource in a workspace the caller cannot reach at all answers `404` instead, so absence and denial are indistinguishable.", - "content": { - "application/json": { + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", "schema": { - "$ref": "#/components/schemas/V2Error" + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the knowledge base." + } + } + ], + "responses": { + "200": { + "description": "Chunk deletion acknowledgement.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } }, - "example": { - "error": { - "code": "FORBIDDEN", - "message": "Insufficient workspace permissions", - "details": { - "code": "INSUFFICIENT_WORKSPACE_ROLE" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2KnowledgeDeleteResponse" } } } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" } } - }, - "NotFound": { - "description": "The requested resource was not found.", - "content": { - "application/json": { + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/tags/{tagId}": { + "patch": { + "operationId": "updateKnowledgeTag", + "summary": "Update tag", + "description": "Rename a tag or change its slot-compatible `fieldType`. Renaming changes read and filter names without moving the slot or its values. Slots are fixed for a tag's lifetime; an incompatible type returns `400` and requires creating a new tag. A duplicate display name returns `409`. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.update", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] + }, + { + "oauthBearer": ["api:write"] + } + ], + "parameters": [ + { + "name": "tagId", + "in": "path", + "required": true, + "description": "Unique tag definition identifier.", "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "NOT_FOUND", - "message": "Not found" - } + "type": "string", + "minLength": 1, + "description": "Unique tag definition identifier." } - } - } - }, - "Conflict": { - "description": "The request conflicts with current resource state.", - "content": { - "application/json": { + }, + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "CONFLICT", - "message": "The request conflicts with current knowledge resource state" - } + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." } } - } - }, - "PayloadTooLarge": { - "description": "The request, or a resource collection it must materialize, exceeds the allowed size: an oversized request body, a generated artifact past the download ceiling, or a workspace folder tree too large to load in full.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "PAYLOAD_TOO_LARGE", - "message": "Request body is too large" + ], + "requestBody": { + "required": true, + "description": "Workspace scope and the fields to update. At least one is required.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateKnowledgeTagRequest" + }, + "examples": { + "example1": { + "summary": "Request example 1", + "value": { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "displayName": "topic" + } + } } } } - } - }, - "UnsupportedMediaType": { - "description": "The request uses an unsupported media type.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/V2Error" + }, + "responses": { + "200": { + "description": "The updated tag definition.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } }, - "example": { - "error": { - "code": "UNSUPPORTED_MEDIA_TYPE", - "message": "Request body must be sent as application/json" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2KnowledgeTagResponse" + } } } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "413": { + "$ref": "#/components/responses/PayloadTooLarge" + }, + "415": { + "$ref": "#/components/responses/UnsupportedMediaType" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" } } }, - "RateLimited": { - "description": "The caller exceeded the request rate limit.", - "headers": { - "Retry-After": { - "$ref": "#/components/headers/Retry-After" + "delete": { + "operationId": "deleteKnowledgeTag", + "summary": "Delete tag", + "description": "Permanently delete a tag definition and its values from every document and chunk in the knowledge base. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:write`.", + "x-sim-operation": "knowledge.tags.delete", + "x-oauth-scope": "api:write", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] + }, + { + "oauthBearer": ["api:write"] } - }, - "content": { - "application/json": { + ], + "parameters": [ + { + "name": "tagId", + "in": "path", + "required": true, + "description": "Unique tag definition identifier.", "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "RATE_LIMITED", - "message": "API rate limit exceeded", - "details": { - "retryAfter": "2026-01-01T00:00:30.000Z" - } - } + "type": "string", + "minLength": 1, + "description": "Unique tag definition identifier." } - } - } - }, - "InternalError": { - "description": "An unexpected server error occurred.", - "content": { - "application/json": { + }, + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", "schema": { - "$ref": "#/components/schemas/V2Error" - }, - "example": { - "error": { - "code": "INTERNAL_ERROR", - "message": "Internal server error" - } + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." } - } - } - }, - "ServiceUnavailable": { - "description": "A required service is temporarily unavailable. When present, `Retry-After` gives the minimum seconds to wait; add jitter before retrying. Check operation-specific guidance before repeating a change after an uncertain response.", - "headers": { - "Retry-After": { - "$ref": "#/components/headers/Retry-After" - } - }, - "content": { - "application/json": { + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", "schema": { - "$ref": "#/components/schemas/V2Error" + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the knowledge base." + } + } + ], + "responses": { + "200": { + "description": "Tag deletion acknowledgement.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } }, - "example": { - "error": { - "code": "SERVICE_UNAVAILABLE", - "message": "Service temporarily unavailable" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2DeleteKnowledgeTagResponse" + } } } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" } } } }, - "schemas": { - "V2ActionableForbiddenDetails": { - "type": "object", - "properties": { - "code": { - "$ref": "#/components/schemas/V2ForbiddenDetailCode" + "/api/v2/knowledge/{knowledgeBaseId}/tags/next-slot": { + "get": { + "operationId": "getNextKnowledgeTagSlot", + "summary": "Get next tag slot", + "description": "Get the next available slot and remaining capacity for a field type. This does not reserve a slot. Create tag selects a free slot when `tagSlot` is omitted. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.tags.read_next_slot", + "x-oauth-scope": "api:read", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] + }, + { + "oauthBearer": ["api:read"] + } + ], + "parameters": [ + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." + } + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the knowledge base." + } + }, + { + "name": "fieldType", + "in": "query", + "required": true, + "description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.", + "schema": { + "type": "string", + "enum": ["text", "number", "date", "boolean"], + "description": "Value type stored in the slot; it decides which slots are usable and which filter operators apply. Slot capacity per type: text 7, number 5, date 2, boolean 3.", + "examples": ["text"] + } + } + ], + "responses": { + "200": { + "description": "Slot availability for the requested field type.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2NextKnowledgeTagSlotResponse" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" + } + } + } + }, + "/api/v2/knowledge/{knowledgeBaseId}/tags/usage": { + "get": { + "operationId": "listKnowledgeTagUsage", + "summary": "List tag usage", + "description": "Count the documents and chunks with a value for each defined tag. Returns one page; `nextCursor` is always null. Workspace API keys return `403`; use a personal API key or scoped OAuth token.\n\nOAuth scope: `api:read`.", + "x-sim-operation": "knowledge.tags.read_usage", + "x-oauth-scope": "api:read", + "tags": ["Knowledge Bases"], + "security": [ + { + "apiKey": [] + }, + { + "oauthBearer": ["api:read"] + } + ], + "parameters": [ + { + "name": "knowledgeBaseId", + "in": "path", + "required": true, + "description": "Unique knowledge base identifier.", + "schema": { + "type": "string", + "minLength": 1, + "description": "Unique knowledge base identifier." + } + }, + { + "name": "workspaceId", + "in": "query", + "required": true, + "description": "Workspace that owns the knowledge base.", + "schema": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace that owns the knowledge base." + } + } + ], + "responses": { + "200": { + "description": "Usage counts for every defined tag.", + "headers": { + "X-RateLimit-Limit": { + "$ref": "#/components/headers/X-RateLimit-Limit" + }, + "X-RateLimit-Remaining": { + "$ref": "#/components/headers/X-RateLimit-Remaining" + }, + "X-RateLimit-Reset": { + "$ref": "#/components/headers/X-RateLimit-Reset" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2KnowledgeTagUsageListResponse" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "429": { + "$ref": "#/components/responses/RateLimited" + }, + "500": { + "$ref": "#/components/responses/InternalError" + }, + "503": { + "$ref": "#/components/responses/ServiceUnavailable" + } + } + } + } + }, + "components": { + "securitySchemes": { + "apiKey": { + "type": "apiKey", + "in": "header", + "name": "X-API-Key", + "description": "Send a personal or workspace API key in `X-API-Key`. See [key types and access](https://docs.sim.ai/api-reference/authentication#key-types); operations that reject workspace keys say so in their description." + }, + "oauthBearer": { + "type": "oauth2", + "description": "Send a Sim OAuth access token in `Authorization: Bearer`. See [OAuth authentication and scopes](https://docs.sim.ai/api-reference/authentication#oauth-access-tokens).", + "flows": { + "authorizationCode": { + "authorizationUrl": "https://www.sim.ai/api/auth/oauth2/authorize", + "tokenUrl": "https://www.sim.ai/api/auth/oauth2/token", + "refreshUrl": "https://www.sim.ai/api/auth/oauth2/token", + "scopes": { + "api:read": "Read your workspaces, workflows, files, tables, and logs", + "api:write": "Read, create, change, run, and delete resources in your workspaces", + "offline_access": "Stay signed in without asking again" + } + } + } + } + }, + "headers": { + "Content-Type": { + "description": "MIME type of the file, defaulting to application/octet-stream when the stored type is unavailable.", + "schema": { + "type": "string", + "title": "Content type", + "description": "MIME type of the file, defaulting to application/octet-stream when the stored type is unavailable." + } + }, + "Content-Disposition": { + "description": "Attachment disposition containing sanitized and RFC 5987 encoded filenames.", + "schema": { + "type": "string", + "title": "Content disposition", + "description": "Attachment disposition containing sanitized and RFC 5987 encoded filenames." + } + }, + "Content-Length": { + "description": "File size in bytes.", + "schema": { + "type": "string", + "pattern": "^(0|[1-9]\\d*)$", + "title": "Content length", + "description": "File size in bytes." + } + }, + "X-RateLimit-Limit": { + "description": "Maximum requests allowed in the current window.", + "schema": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "title": "Rate limit", + "description": "Maximum requests allowed in the current window." + } + }, + "X-RateLimit-Remaining": { + "description": "Requests remaining in the current window.", + "schema": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "title": "Rate limit remaining", + "description": "Requests remaining in the current window." + } + }, + "X-RateLimit-Reset": { + "description": "ISO 8601 timestamp when the current rate-limit window resets.", + "schema": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "title": "Rate limit reset", + "description": "ISO 8601 timestamp when the current rate-limit window resets." + } + }, + "Retry-After": { + "description": "Seconds to wait before retrying, sent on `429` and `503`. Add jitter rather than retrying at exactly this offset.", + "schema": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "title": "Retry after", + "description": "Seconds to wait before retrying, sent on `429` and `503`. Add jitter rather than retrying at exactly this offset." + } + }, + "X-Run-Id": { + "description": "Identifier assigned to the workflow run.", + "schema": { + "type": "string", + "minLength": 1, + "title": "Run identifier", + "description": "Identifier assigned to the workflow run." + } + } + }, + "responses": { + "BadRequest": { + "description": "The request is invalid. This includes a query parameter sent with no value (`?limit=`, `?search=`), which is rejected rather than read as zero, empty, or the parameter default — omit the parameter instead.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "BAD_REQUEST", + "message": "Invalid request" + } + } + } + } + }, + "Unauthorized": { + "description": "The API credential is missing or invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "UNAUTHORIZED", + "message": "Authentication required" + } + } + } + } + }, + "UsageLimitExceeded": { + "description": "The workspace has exceeded its usage or billing limits.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "USAGE_LIMIT_EXCEEDED", + "message": "Usage limit exceeded. Please upgrade your plan to continue." + } + } + } + } + }, + "Forbidden": { + "description": "The caller lacks the rights this operation requires. When the cause is one a caller can act on, `error.details.code` names it. A resource in a workspace the caller cannot reach at all answers `404` instead, so absence and denial are indistinguishable.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "FORBIDDEN", + "message": "Insufficient workspace permissions", + "details": { + "code": "INSUFFICIENT_WORKSPACE_ROLE" + } + } + } + } + } + }, + "NotFound": { + "description": "The requested resource was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "NOT_FOUND", + "message": "Not found" + } + } + } + } + }, + "Conflict": { + "description": "The request conflicts with current resource state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "CONFLICT", + "message": "The request conflicts with current knowledge resource state" + } + } + } + } + }, + "PayloadTooLarge": { + "description": "The request, or a resource collection it must materialize, exceeds the allowed size: an oversized request body, a generated artifact past the download ceiling, or a workspace folder tree too large to load in full.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "PAYLOAD_TOO_LARGE", + "message": "Request body is too large" + } + } + } + } + }, + "UnsupportedMediaType": { + "description": "The request uses an unsupported media type.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "UNSUPPORTED_MEDIA_TYPE", + "message": "Request body must be sent as application/json" + } + } + } + } + }, + "RateLimited": { + "description": "The caller exceeded the request rate limit.", + "headers": { + "Retry-After": { + "$ref": "#/components/headers/Retry-After" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "RATE_LIMITED", + "message": "API rate limit exceeded", + "details": { + "retryAfter": "2026-01-01T00:00:30.000Z" + } + } + } + } + } + }, + "InternalError": { + "description": "An unexpected server error occurred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "INTERNAL_ERROR", + "message": "Internal server error" + } + } + } + } + }, + "ServiceUnavailable": { + "description": "A required service is temporarily unavailable. When present, `Retry-After` gives the minimum seconds to wait; add jitter before retrying. Check operation-specific guidance before repeating a change after an uncertain response.", + "headers": { + "Retry-After": { + "$ref": "#/components/headers/Retry-After" + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V2Error" + }, + "example": { + "error": { + "code": "SERVICE_UNAVAILABLE", + "message": "Service temporarily unavailable" + } + } + } + } + } + }, + "schemas": { + "V2ActionableForbiddenDetails": { + "type": "object", + "properties": { + "code": { + "$ref": "#/components/schemas/V2ForbiddenDetailCode" + } + }, + "required": ["code"], + "additionalProperties": { + "description": "Additional context for this refusal." + }, + "title": "Actionable forbidden details", + "description": "Machine-readable cause and optional context for an actionable `403` response." + }, + "V2ForbiddenDetailCode": { + "type": "string", + "enum": [ + "INSUFFICIENT_WORKSPACE_ROLE", + "PERSONAL_API_KEYS_DISABLED", + "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", + "PRINCIPAL_KIND_NOT_PERMITTED", + "ORGANIZATION_MEMBERSHIP_REQUIRED", + "ORGANIZATION_ADMIN_REQUIRED", + "ENTERPRISE_PLAN_REQUIRED", + "SSO_DISABLED", + "SSO_DOMAIN_NOT_VERIFIED", + "SSO_PROVIDER_LIMIT_REACHED", + "ORGANIZATION_PLAN_REQUIRED", + "AUDIT_LOGS_DISABLED", + "ACCESS_REQUESTS_DISABLED", + "ACCESS_REQUEST_ORGANIZATION_REQUIRED", + "SKILL_EDITOR_ACCESS_REQUIRED", + "SECRET_ADMIN_ACCESS_REQUIRED", + "WORKSPACE_RESOURCE_LIMIT_REACHED", + "PUBLIC_SHARING_NOT_ALLOWED", + "CREDENTIAL_ADMIN_ACCESS_REQUIRED", + "MCP_SERVER_URL_NOT_ALLOWED", + "WORKSPACE_PLAN_CAPABILITY_REQUIRED", + "CHAT_AUTH_MODE_NOT_PERMITTED", + "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", + "PERMISSION_GROUP_CAPABILITY_BLOCKED", + "INTEGRATION_NOT_ALLOWED", + "INSUFFICIENT_SCOPE", + "SCIM_MANAGED_MEMBERSHIP" + ], + "title": "Forbidden detail code", + "description": "Stable cause code for an actionable `403` response." + }, + "V2Error": { + "type": "object", + "properties": { + "error": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Stable machine-readable error code." + }, + "message": { + "type": "string", + "description": "Human-readable explanation of the error." + }, + "details": { + "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", + "anyOf": [ + { + "$ref": "#/components/schemas/V2ActionableForbiddenDetails" + }, + { + "description": "Other structured context defined by the specific error." + } + ] + } + }, + "required": ["code", "message"], + "additionalProperties": false, + "description": "Canonical error details." + } + }, + "required": ["error"], + "additionalProperties": false, + "title": "v2 error response", + "description": "Canonical error envelope returned by the public v2 API.", + "examples": [ + { + "error": { + "code": "BAD_REQUEST", + "message": "The request is invalid." + } + } + ] + }, + "FolderPathInput": { + "title": "Folder path input", + "description": "Folder path. A missing leading slash is normalized before validation. Segments are percent-encoded, so a folder shown as \"New folder\" is `/New%20folder`: everything outside `A-Z a-z 0-9 - _ . ~` is escaped as uppercase hex, and only that exact encoding is accepted. A trailing slash, an empty segment, and a literal `.` or `..` segment are rejected. At most 64 segments and 4096 encoded bytes.", + "maxLength": 4096, + "type": "string" + }, + "V2KnowledgeBase": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique knowledge base identifier.", + "examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"] + }, + "name": { + "type": "string", + "description": "Human-readable knowledge base name.", + "examples": ["Product Documentation"] + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Knowledge base description, or null when none is set.", + "examples": ["All product documentation and guides"] + }, + "tokenCount": { + "type": "number", + "description": "Total tokens across indexed documents.", + "examples": [48213] + }, + "embeddingModel": { + "type": "string", + "description": "Embedding model used to index documents.", + "examples": ["text-embedding-3-small"] + }, + "embeddingDimension": { + "type": "number", + "description": "Dimensionality of the embedding vectors.", + "examples": [1536] + }, + "chunkingConfig": { + "$ref": "#/components/schemas/V2KnowledgeChunkingConfig" + }, + "docCount": { + "description": "Number of documents in the knowledge base.", + "examples": [12], + "type": "number" + }, + "connectorTypes": { + "description": "External connector types that have synced documents into the knowledge base.", + "examples": [["notion", "google_drive"]], + "type": "array", + "items": { + "type": "string" + } + }, + "createdAt": { + "type": "string", + "description": "ISO 8601 timestamp when the knowledge base was created.", + "format": "date-time", + "examples": ["2025-01-10T09:00:00Z"] + }, + "updatedAt": { + "type": "string", + "description": "ISO 8601 timestamp when the knowledge base was last modified.", + "format": "date-time", + "examples": ["2025-06-18T16:45:00Z"] + }, + "webUrl": { + "type": "string", + "format": "uri", + "description": "Canonical absolute URL for opening this resource in the Sim web application." + }, + "ownerEmail": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$", + "description": "Current email address of the knowledge base owner.", + "examples": ["owner@example.com"] + }, + "folderPath": { + "type": "string", + "title": "Folder path", + "description": "Canonical containing-folder path; `/` is the workspace root. Resolved against active folders only, so an archived knowledge base whose containing folder was archived with it reports `/`.", + "maxLength": 4096, + "examples": ["/Product"] + }, + "deletedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" + }, + { + "type": "null" + } + ], + "description": "ISO 8601 archive timestamp, or null while active. Use List knowledge bases with `scope=archived` to find archived knowledge bases.", + "format": "date-time", + "examples": ["2026-01-16T09:00:00Z"] + } + }, + "required": [ + "id", + "name", + "description", + "tokenCount", + "embeddingModel", + "embeddingDimension", + "chunkingConfig", + "createdAt", + "updatedAt", + "webUrl", + "ownerEmail", + "folderPath", + "deletedAt" + ], + "additionalProperties": false, + "title": "Knowledge base", + "description": "A collection of documents indexed for vector and tag search." + }, + "V2KnowledgeChunkingConfig": { + "type": "object", + "properties": { + "maxSize": { + "type": "number", + "description": "Maximum chunk size in tokens.", + "examples": [1024] + }, + "minSize": { + "type": "number", + "description": "Minimum chunk size in characters.", + "examples": [100] + }, + "overlap": { + "type": "number", + "description": "Requested overlap in tokens between adjacent chunks.", + "examples": [200] + }, + "strategy": { + "description": "Chunking strategy applied during document processing.", + "type": "string", + "enum": ["auto", "text", "regex", "recursive", "sentence", "token"] + }, + "strategyOptions": { + "description": "Strategy-specific tuning options.", + "type": "object", + "properties": { + "pattern": { + "description": "Regular expression used by the regex chunking strategy.", + "type": "string", + "maxLength": 500 + }, + "separators": { + "description": "Ordered separators used to split content into chunks.", + "type": "array", + "items": { + "type": "string" + } + }, + "recipe": { + "description": "Content-aware recipe used by the automatic chunking strategy.", + "type": "string", + "enum": ["plain", "markdown", "code"] + }, + "strictBoundaries": { + "description": "Whether regex matches must form strict chunk boundaries.", + "type": "boolean" + } + }, + "additionalProperties": false + } + }, + "required": ["maxSize", "minSize", "overlap"], + "additionalProperties": { + "description": "Additional forward-compatible chunking configuration property." + }, + "title": "Knowledge chunking configuration", + "description": "How documents in a knowledge base are split into chunks before embedding." + }, + "V2KnowledgeBaseListResponse": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V2KnowledgeBase" + }, + "description": "Items in the current page." + }, + "nextCursor": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Opaque cursor for the next page. Send it back as `cursor`; `null` means there are no more pages. Do not construct a cursor yourself." + } + }, + "required": ["data", "nextCursor"], + "additionalProperties": false, + "title": "Knowledge base list response", + "description": "A cursor-paginated page of knowledge bases." + }, + "V2KnowledgeBaseResponse": { + "type": "object", + "properties": { + "data": { + "description": "Response data.", + "$ref": "#/components/schemas/V2KnowledgeBase" } }, - "required": ["code"], - "additionalProperties": { - "description": "Additional context for this refusal." - }, - "title": "Actionable forbidden details", - "description": "Machine-readable cause and optional context for an actionable `403` response." - }, - "V2ForbiddenDetailCode": { - "type": "string", - "enum": [ - "INSUFFICIENT_WORKSPACE_ROLE", - "PERSONAL_API_KEYS_DISABLED", - "WORKSPACE_KEY_OPERATION_NOT_PERMITTED", - "PRINCIPAL_KIND_NOT_PERMITTED", - "ORGANIZATION_MEMBERSHIP_REQUIRED", - "ORGANIZATION_ADMIN_REQUIRED", - "ENTERPRISE_PLAN_REQUIRED", - "SSO_DISABLED", - "SSO_DOMAIN_NOT_VERIFIED", - "SSO_PROVIDER_LIMIT_REACHED", - "ORGANIZATION_PLAN_REQUIRED", - "AUDIT_LOGS_DISABLED", - "ACCESS_REQUESTS_DISABLED", - "ACCESS_REQUEST_ORGANIZATION_REQUIRED", - "SKILL_EDITOR_ACCESS_REQUIRED", - "SECRET_ADMIN_ACCESS_REQUIRED", - "WORKSPACE_RESOURCE_LIMIT_REACHED", - "PUBLIC_SHARING_NOT_ALLOWED", - "CREDENTIAL_ADMIN_ACCESS_REQUIRED", - "MCP_SERVER_URL_NOT_ALLOWED", - "WORKSPACE_PLAN_CAPABILITY_REQUIRED", - "CHAT_AUTH_MODE_NOT_PERMITTED", - "CONNECTOR_MANAGED_RESOURCE_READ_ONLY", - "PERMISSION_GROUP_CAPABILITY_BLOCKED", - "INTEGRATION_NOT_ALLOWED", - "INSUFFICIENT_SCOPE", - "SCIM_MANAGED_MEMBERSHIP" - ], - "title": "Forbidden detail code", - "description": "Stable cause code for an actionable `403` response." + "required": ["data"], + "additionalProperties": false, + "title": "Knowledge base response", + "description": "A single knowledge base." }, - "V2Error": { + "V2KnowledgeChunkingConfigInput": { "type": "object", "properties": { - "error": { + "maxSize": { + "default": 1024, + "description": "Maximum chunk size in tokens.", + "examples": [1024], + "type": "number", + "minimum": 100, + "maximum": 4000 + }, + "minSize": { + "default": 100, + "description": "Minimum chunk size in characters.", + "examples": [100], + "type": "number", + "minimum": 1, + "maximum": 2000 + }, + "overlap": { + "default": 200, + "description": "Requested overlap in tokens between adjacent chunks.", + "examples": [200], + "type": "number", + "minimum": 0, + "maximum": 500 + }, + "strategy": { + "description": "Chunking strategy applied during document processing. `regex` additionally requires `strategyOptions.pattern`.", + "type": "string", + "enum": ["auto", "text", "regex", "recursive", "sentence", "token"] + }, + "strategyOptions": { + "description": "Strategy-specific tuning options. `strictBoundaries` is accepted only with `strategy: \"regex\"`.", "type": "object", "properties": { - "code": { + "pattern": { + "description": "Regular expression used by the regex chunking strategy.", "type": "string", - "description": "Stable machine-readable error code." + "maxLength": 500 }, - "message": { + "separators": { + "description": "Ordered separators used to split content into chunks.", + "maxItems": 32, + "type": "array", + "items": { + "type": "string", + "maxLength": 100 + } + }, + "recipe": { + "description": "Content-aware recipe used by the automatic chunking strategy.", "type": "string", - "description": "Human-readable explanation of the error." + "enum": ["plain", "markdown", "code"] }, - "details": { - "description": "Structured error context whose keys depend on the error. Actionable `403` responses use the `V2ActionableForbiddenDetails` shape; validation failures may return issue arrays instead.", - "anyOf": [ - { - "$ref": "#/components/schemas/V2ActionableForbiddenDetails" - }, - { - "description": "Other structured context defined by the specific error." - } - ] + "strictBoundaries": { + "description": "Whether regex matches must form strict chunk boundaries.", + "type": "boolean" } }, - "required": ["code", "message"], - "additionalProperties": false, - "description": "Canonical error details." + "additionalProperties": false } }, - "required": ["error"], "additionalProperties": false, - "title": "v2 error response", - "description": "Canonical error envelope returned by the public v2 API.", - "examples": [ - { - "error": { - "code": "BAD_REQUEST", - "message": "The request is invalid." - } - } - ] - }, - "FolderPathInput": { - "title": "Folder path input", - "description": "Folder path. A missing leading slash is normalized before validation. Segments are percent-encoded, so a folder shown as \"New folder\" is `/New%20folder`: everything outside `A-Z a-z 0-9 - _ . ~` is escaped as uppercase hex, and only that exact encoding is accepted. A trailing slash, an empty segment, and a literal `.` or `..` segment are rejected. At most 64 segments and 4096 encoded bytes.", - "maxLength": 4096, - "type": "string" + "title": "Knowledge chunking configuration input", + "description": "Chunking configuration applied when processing documents. On update this object is replaced wholesale rather than merged, so a caller preserving one key must read, modify, and write the whole object back." }, - "V2KnowledgeBase": { + "CreateKnowledgeBaseRequest": { "type": "object", "properties": { - "id": { + "workspaceId": { "type": "string", - "description": "Unique knowledge base identifier.", - "examples": ["7c9e6679-7425-40de-944b-e07fc1f90ae7"] + "minLength": 1, + "maxLength": 128, + "description": "Workspace in which to create the knowledge base." }, "name": { "type": "string", + "minLength": 1, + "maxLength": 255, "description": "Human-readable knowledge base name.", "examples": ["Product Documentation"] }, "description": { + "description": "Optional knowledge base description.", + "examples": ["All product documentation and guides"], + "type": "string", + "maxLength": 10000 + }, + "chunkingConfig": { + "default": { + "maxSize": 1024, + "minSize": 100, + "overlap": 200 + }, + "description": "Chunking configuration; defaults are applied when omitted.", + "$ref": "#/components/schemas/V2KnowledgeChunkingConfigInput" + }, + "folderPath": { + "description": "Containing folder path; omission creates the knowledge base at the root.", + "$ref": "#/components/schemas/FolderPathInput" + } + }, + "required": ["workspaceId", "name"], + "additionalProperties": false, + "title": "Create knowledge base request", + "description": "Workspace, name, description, chunking configuration, and folder placement." + }, + "V2KnowledgeImportFailure": { + "type": "object", + "properties": { + "filename": { + "type": "string", + "description": "Filename of the document that was not imported." + }, + "message": { + "type": "string", + "description": "Why the document was not imported." + } + }, + "required": ["filename", "message"], + "additionalProperties": false, + "title": "Knowledge import failure", + "description": "One bundle document the import could not bring over." + }, + "V2KnowledgeImport": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique knowledge-base import identifier." + }, + "workspaceId": { + "type": "string", + "description": "Workspace that owns the import." + }, + "status": { + "type": "string", + "enum": ["uploading", "processing", "completed", "failed", "canceled", "expired"], + "description": "Current import lifecycle state." + }, + "knowledgeBaseId": { "anyOf": [ { "type": "string" @@ -5571,72 +6444,61 @@ "type": "null" } ], - "description": "Knowledge base description, or null when none is set.", - "examples": ["All product documentation and guides"] - }, - "tokenCount": { - "type": "number", - "description": "Total tokens across indexed documents.", - "examples": [48213] + "description": "Knowledge base the import created, or null until it exists." }, - "embeddingModel": { - "type": "string", - "description": "Embedding model used to index documents.", - "examples": ["text-embedding-3-small"] + "documentsTotal": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Documents the bundle carries; zero until its manifest has been read." }, - "embeddingDimension": { - "type": "number", - "description": "Dimensionality of the embedding vectors.", - "examples": [1536] + "documentsImported": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Documents created so far. A document whose vectors could not be reused is indexed afterwards, as an upload is, so it may still be processing in the knowledge base." }, - "chunkingConfig": { - "$ref": "#/components/schemas/V2KnowledgeChunkingConfig" + "documentsFailed": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991, + "description": "Documents that could not be imported. Non-zero still allows `completed`." }, - "docCount": { - "description": "Number of documents in the knowledge base.", - "examples": [12], - "type": "number" + "vectorsReused": { + "type": "boolean", + "description": "Whether the bundle's vectors matched this deployment's embedding model and were stored without re-embedding." }, - "connectorTypes": { - "description": "External connector types that have synced documents into the knowledge base.", - "examples": [["notion", "google_drive"]], + "failures": { "type": "array", "items": { - "type": "string" - } - }, - "createdAt": { - "type": "string", - "description": "ISO 8601 timestamp when the knowledge base was created.", - "format": "date-time", - "examples": ["2025-01-10T09:00:00Z"] - }, - "updatedAt": { - "type": "string", - "description": "ISO 8601 timestamp when the knowledge base was last modified.", - "format": "date-time", - "examples": ["2025-06-18T16:45:00Z"] + "$ref": "#/components/schemas/V2KnowledgeImportFailure" + }, + "description": "Bounded sample of the documents that could not be imported." }, - "webUrl": { - "type": "string", - "format": "uri", - "description": "Canonical absolute URL for opening this resource in the Sim web application." + "error": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Terminal failure reason, or null." }, - "ownerEmail": { + "createdAt": { "type": "string", - "format": "email", - "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$", - "description": "Current email address of the knowledge base owner.", - "examples": ["owner@example.com"] + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 creation timestamp." }, - "folderPath": { + "updatedAt": { "type": "string", - "title": "Folder path", - "description": "Canonical containing-folder path; `/` is the workspace root. Resolved against active folders only, so an archived knowledge base whose containing folder was archived with it reports `/`.", - "maxLength": 4096, - "examples": ["/Product"] + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 last-update timestamp." }, - "deletedAt": { + "completedAt": { "anyOf": [ { "type": "string", @@ -5647,236 +6509,329 @@ "type": "null" } ], - "description": "ISO 8601 archive timestamp, or null while active. Use List knowledge bases with `scope=archived` to find archived knowledge bases.", - "format": "date-time", - "examples": ["2026-01-16T09:00:00Z"] + "description": "ISO 8601 completion timestamp, or null." } }, "required": [ "id", - "name", - "description", - "tokenCount", - "embeddingModel", - "embeddingDimension", - "chunkingConfig", + "workspaceId", + "status", + "knowledgeBaseId", + "documentsTotal", + "documentsImported", + "documentsFailed", + "vectorsReused", + "failures", + "error", "createdAt", "updatedAt", - "webUrl", - "ownerEmail", - "folderPath", - "deletedAt" + "completedAt" ], "additionalProperties": false, - "title": "Knowledge base", - "description": "A collection of documents indexed for vector and tag search." + "title": "Knowledge base import", + "description": "Durable lifecycle resource for importing a knowledge base bundle." }, - "V2KnowledgeChunkingConfig": { + "V2PutUploadTransfer": { "type": "object", "properties": { - "maxSize": { - "type": "number", - "description": "Maximum chunk size in tokens.", - "examples": [1024] + "method": { + "type": "string", + "const": "put", + "description": "Upload strategy discriminator." }, - "minSize": { - "type": "number", - "description": "Minimum chunk size in characters.", - "examples": [100] + "url": { + "type": "string", + "format": "uri", + "description": "Signed URL to which the file bytes are uploaded. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML." }, - "overlap": { - "type": "number", - "description": "Requested overlap in tokens between adjacent chunks.", - "examples": [200] + "headers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + }, + "description": "Headers that must be included with the upload request." }, - "strategy": { - "description": "Chunking strategy applied during document processing.", + "expiresAt": { "type": "string", - "enum": ["auto", "text", "regex", "recursive", "sentence", "token"] + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 expiration time for this signed URL. This is the URL's own expiry and is normally earlier than the upload session's expiresAt: the session stays open for later part, status, completion, and abort requests, but the bytes must be uploaded before this time. Once it passes, the storage provider rejects the upload and a new upload session must be created." + } + }, + "required": ["method", "url", "headers", "expiresAt"], + "additionalProperties": false, + "title": "Direct upload transfer", + "description": "Instructions for uploading bytes to one signed URL." + }, + "V2MultipartUploadTransfer": { + "type": "object", + "properties": { + "method": { + "type": "string", + "const": "multipart", + "description": "Upload strategy discriminator." }, - "strategyOptions": { - "description": "Strategy-specific tuning options.", - "type": "object", - "properties": { - "pattern": { - "description": "Regular expression used by the regex chunking strategy.", - "type": "string", - "maxLength": 500 - }, - "separators": { - "description": "Ordered separators used to split content into chunks.", - "type": "array", - "items": { - "type": "string" - } - }, - "recipe": { - "description": "Content-aware recipe used by the automatic chunking strategy.", - "type": "string", - "enum": ["plain", "markdown", "code"] + "partSize": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "description": "Required size of each non-final part in bytes." + }, + "partCount": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 640, + "description": "Total number of upload parts." + } + }, + "required": ["method", "partSize", "partCount"], + "additionalProperties": false, + "title": "Multipart upload transfer", + "description": "Instructions for splitting bytes into a multipart upload." + }, + "V2CreateKnowledgeImportData": { + "type": "object", + "properties": { + "session": { + "description": "Created import, waiting for its upload.", + "$ref": "#/components/schemas/V2KnowledgeImport" + }, + "uploadToken": { + "type": "string", + "minLength": 1, + "description": "Signed token for upload control requests." + }, + "transfer": { + "oneOf": [ + { + "$ref": "#/components/schemas/V2PutUploadTransfer" }, - "strictBoundaries": { - "description": "Whether regex matches must form strict chunk boundaries.", - "type": "boolean" + { + "$ref": "#/components/schemas/V2MultipartUploadTransfer" } - }, - "additionalProperties": false + ], + "description": "Signed bundle upload instructions." } }, - "required": ["maxSize", "minSize", "overlap"], - "additionalProperties": { - "description": "Additional forward-compatible chunking configuration property." + "required": ["session", "uploadToken", "transfer"], + "additionalProperties": false, + "title": "Create knowledge base import data", + "description": "Created import and the instructions for uploading its bundle." + }, + "V2CreateKnowledgeImportResponse": { + "type": "object", + "properties": { + "data": { + "description": "Response data.", + "$ref": "#/components/schemas/V2CreateKnowledgeImportData" + } }, - "title": "Knowledge chunking configuration", - "description": "How documents in a knowledge base are split into chunks before embedding." + "required": ["data"], + "additionalProperties": false, + "title": "Create knowledge base import response", + "description": "The import and the instructions for uploading its bundle." }, - "V2KnowledgeBaseListResponse": { + "V2KnowledgeImportSource": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "upload", + "description": "Upload-backed import discriminator." + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 255, + "description": "Bundle filename, as produced by a knowledge base export." + }, + "contentType": { + "type": "string", + "minLength": 1, + "maxLength": 255, + "description": "Bundle MIME type, normally application/zip." + }, + "size": { + "type": "integer", + "minimum": 1, + "maximum": 5368709120, + "description": "Exact bundle size in bytes; the maximum is 5 GiB." + } + }, + "required": ["type", "name", "contentType", "size"], + "additionalProperties": false, + "title": "Knowledge base import source", + "description": "Bundle archive uploaded through signed transfer instructions." + }, + "CreateKnowledgeImportRequest": { + "type": "object", + "properties": { + "workspaceId": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "description": "Workspace in which to create the knowledge base." + }, + "name": { + "description": "Name for the new knowledge base; defaults to the bundle's own name.", + "examples": ["Product Documentation"], + "type": "string", + "minLength": 1, + "maxLength": 255 + }, + "source": { + "$ref": "#/components/schemas/V2KnowledgeImportSource" + } + }, + "required": ["workspaceId", "source"], + "additionalProperties": false, + "title": "Create knowledge base import request", + "description": "Workspace, bundle archive, and an optional name for the new knowledge base.", + "examples": [ + { + "workspaceId": "a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64", + "name": "Product Documentation", + "source": { + "type": "upload", + "name": "product-documentation.simkb.zip", + "contentType": "application/zip", + "size": 7340032 + } + } + ] + }, + "V2KnowledgeImportResponse": { + "type": "object", + "properties": { + "data": { + "description": "Response data.", + "$ref": "#/components/schemas/V2KnowledgeImport" + } + }, + "required": ["data"], + "additionalProperties": false, + "title": "Knowledge base import response", + "description": "A knowledge base import lifecycle resource." + }, + "V2CancelKnowledgeImportResponse": { "type": "object", "properties": { "data": { + "description": "Response data.", + "$ref": "#/components/schemas/V2KnowledgeImport" + } + }, + "required": ["data"], + "additionalProperties": false, + "title": "Cancel knowledge base import response", + "description": "The canceled knowledge base import." + }, + "V2UploadPartUrl": { + "type": "object", + "properties": { + "partNumber": { + "type": "integer", + "minimum": 1, + "maximum": 9007199254740991, + "description": "Multipart part number." + }, + "url": { + "type": "string", + "format": "uri", + "description": "Signed URL for this upload part. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML. Do not retain part `ETag` values; after every part succeeds, call the completion endpoint without a request body." + }, + "headers": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + }, + "description": "Headers that must be included with the part upload." + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", + "description": "ISO 8601 expiration time for the signed URL." + } + }, + "required": ["partNumber", "url", "headers", "expiresAt"], + "additionalProperties": false, + "title": "Upload part URL", + "description": "A signed URL and required headers for one multipart upload part." + }, + "V2PartUrlsData": { + "type": "object", + "properties": { + "parts": { + "maxItems": 100, "type": "array", "items": { - "$ref": "#/components/schemas/V2KnowledgeBase" + "$ref": "#/components/schemas/V2UploadPartUrl" }, - "description": "Items in the current page." - }, - "nextCursor": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Opaque cursor for the next page. Send it back as `cursor`; `null` means there are no more pages. Do not construct a cursor yourself." + "description": "Signed URLs for requested parts." } }, - "required": ["data", "nextCursor"], + "required": ["parts"], "additionalProperties": false, - "title": "Knowledge base list response", - "description": "A cursor-paginated page of knowledge bases." + "title": "Upload part URLs", + "description": "Signed transfer URLs for the requested multipart upload parts." }, - "V2KnowledgeBaseResponse": { + "V2CreateKnowledgeImportPartUrlsResponse": { "type": "object", "properties": { "data": { "description": "Response data.", - "$ref": "#/components/schemas/V2KnowledgeBase" + "$ref": "#/components/schemas/V2PartUrlsData" } }, "required": ["data"], "additionalProperties": false, - "title": "Knowledge base response", - "description": "A single knowledge base." + "title": "Create knowledge base import part URLs response", + "description": "Signed URLs and required headers for each requested upload part." }, - "V2KnowledgeChunkingConfigInput": { + "CreateKnowledgeImportPartUrlsRequest": { "type": "object", "properties": { - "maxSize": { - "default": 1024, - "description": "Maximum chunk size in tokens.", - "examples": [1024], - "type": "number", - "minimum": 100, - "maximum": 4000 - }, - "minSize": { - "default": 100, - "description": "Minimum chunk size in characters.", - "examples": [100], - "type": "number", - "minimum": 1, - "maximum": 2000 - }, - "overlap": { - "default": 200, - "description": "Requested overlap in tokens between adjacent chunks.", - "examples": [200], - "type": "number", - "minimum": 0, - "maximum": 500 - }, - "strategy": { - "description": "Chunking strategy applied during document processing. `regex` additionally requires `strategyOptions.pattern`.", - "type": "string", - "enum": ["auto", "text", "regex", "recursive", "sentence", "token"] - }, - "strategyOptions": { - "description": "Strategy-specific tuning options. `strictBoundaries` is accepted only with `strategy: \"regex\"`.", - "type": "object", - "properties": { - "pattern": { - "description": "Regular expression used by the regex chunking strategy.", - "type": "string", - "maxLength": 500 - }, - "separators": { - "description": "Ordered separators used to split content into chunks.", - "maxItems": 32, - "type": "array", - "items": { - "type": "string", - "maxLength": 100 - } - }, - "recipe": { - "description": "Content-aware recipe used by the automatic chunking strategy.", - "type": "string", - "enum": ["plain", "markdown", "code"] - }, - "strictBoundaries": { - "description": "Whether regex matches must form strict chunk boundaries.", - "type": "boolean" - } + "partNumbers": { + "minItems": 1, + "maxItems": 100, + "type": "array", + "items": { + "type": "integer", + "minimum": 1, + "maximum": 9007199254740991 }, - "additionalProperties": false + "description": "Multipart part numbers for which signed URLs should be created." } }, + "required": ["partNumbers"], "additionalProperties": false, - "title": "Knowledge chunking configuration input", - "description": "Chunking configuration applied when processing documents. On update this object is replaced wholesale rather than merged, so a caller preserving one key must read, modify, and write the whole object back." + "title": "Create knowledge base import part URLs request", + "description": "Multipart part numbers for which signed URLs should be created.", + "examples": [ + { + "partNumbers": [1, 2, 3] + } + ] }, - "CreateKnowledgeBaseRequest": { + "V2CompleteKnowledgeImportResponse": { "type": "object", "properties": { - "workspaceId": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "Workspace in which to create the knowledge base." - }, - "name": { - "type": "string", - "minLength": 1, - "maxLength": 255, - "description": "Human-readable knowledge base name.", - "examples": ["Product Documentation"] - }, - "description": { - "description": "Optional knowledge base description.", - "examples": ["All product documentation and guides"], - "type": "string", - "maxLength": 10000 - }, - "chunkingConfig": { - "default": { - "maxSize": 1024, - "minSize": 100, - "overlap": 200 - }, - "description": "Chunking configuration; defaults are applied when omitted.", - "$ref": "#/components/schemas/V2KnowledgeChunkingConfigInput" - }, - "folderPath": { - "description": "Containing folder path; omission creates the knowledge base at the root.", - "$ref": "#/components/schemas/FolderPathInput" + "data": { + "description": "Response data.", + "$ref": "#/components/schemas/V2KnowledgeImport" } }, - "required": ["workspaceId", "name"], + "required": ["data"], "additionalProperties": false, - "title": "Create knowledge base request", - "description": "Workspace, name, description, chunking configuration, and folder placement." + "title": "Complete knowledge base import response", + "description": "The import lifecycle resource once processing has started." }, "UpdateKnowledgeBaseRequest": { "type": "object", @@ -7746,67 +8701,6 @@ "description": "Provider transfer strategy for a knowledge document upload.", "title": "Knowledge upload transfer" }, - "V2PutUploadTransfer": { - "type": "object", - "properties": { - "method": { - "type": "string", - "const": "put", - "description": "Upload strategy discriminator." - }, - "url": { - "type": "string", - "format": "uri", - "description": "Signed URL to which the file bytes are uploaded. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML." - }, - "headers": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - }, - "description": "Headers that must be included with the upload request." - }, - "expiresAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", - "description": "ISO 8601 expiration time for this signed URL. This is the URL's own expiry and is normally earlier than the upload session's expiresAt: the session stays open for later part, status, completion, and abort requests, but the bytes must be uploaded before this time. Once it passes, the storage provider rejects the upload and a new upload session must be created." - } - }, - "required": ["method", "url", "headers", "expiresAt"], - "additionalProperties": false, - "title": "Direct upload transfer", - "description": "Instructions for uploading bytes to one signed URL." - }, - "V2MultipartUploadTransfer": { - "type": "object", - "properties": { - "method": { - "type": "string", - "const": "multipart", - "description": "Upload strategy discriminator." - }, - "partSize": { - "type": "integer", - "exclusiveMinimum": 0, - "maximum": 9007199254740991, - "description": "Required size of each non-final part in bytes." - }, - "partCount": { - "type": "integer", - "exclusiveMinimum": 0, - "maximum": 640, - "description": "Total number of upload parts." - } - }, - "required": ["method", "partSize", "partCount"], - "additionalProperties": false, - "title": "Multipart upload transfer", - "description": "Instructions for splitting bytes into a multipart upload." - }, "V2CreateKnowledgeDocumentUploadData": { "type": "object", "properties": { @@ -7950,59 +8844,6 @@ "title": "Knowledge document upload response", "description": "Current state of a knowledge document upload session." }, - "V2UploadPartUrl": { - "type": "object", - "properties": { - "partNumber": { - "type": "integer", - "minimum": 1, - "maximum": 9007199254740991, - "description": "Multipart part number." - }, - "url": { - "type": "string", - "format": "uri", - "description": "Signed URL for this upload part. Upload bytes with `PUT` and exactly the supplied headers; never construct or modify the signed URL. Treat any `2xx` as success. Sim-hosted URLs return an empty `204` and v2 JSON errors. Object-storage URLs may return `200` or `201` and provider-specific errors, often XML. Do not retain part `ETag` values; after every part succeeds, call the completion endpoint without a request body." - }, - "headers": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - }, - "description": "Headers that must be included with the part upload." - }, - "expiresAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$", - "description": "ISO 8601 expiration time for the signed URL." - } - }, - "required": ["partNumber", "url", "headers", "expiresAt"], - "additionalProperties": false, - "title": "Upload part URL", - "description": "A signed URL and required headers for one multipart upload part." - }, - "V2PartUrlsData": { - "type": "object", - "properties": { - "parts": { - "maxItems": 100, - "type": "array", - "items": { - "$ref": "#/components/schemas/V2UploadPartUrl" - }, - "description": "Signed URLs for requested parts." - } - }, - "required": ["parts"], - "additionalProperties": false, - "title": "Upload part URLs", - "description": "Signed transfer URLs for the requested multipart upload parts." - }, "V2KnowledgeDocumentUploadPartUrlsResponse": { "type": "object", "properties": { diff --git a/apps/docs/openapi-v2-logs.json b/apps/docs/openapi-v2-logs.json index 8348148d972..52c8878d3e4 100644 --- a/apps/docs/openapi-v2-logs.json +++ b/apps/docs/openapi-v2-logs.json @@ -213,9 +213,9 @@ "name": "limit", "in": "query", "required": false, - "description": "Maximum log entries per page. Values outside 1–1000 are truncated and clamped into that range rather than rejected. Defaults to 100.", + "description": "Maximum log entries per page. When execution data is returned (`includeTraceSpans` or `includeFinalOutput`), a page holds at most 20 entries, and fewer when their stored traces are large; follow `nextCursor` for the rest. A page whose execution data is withheld by permissions is not capped. Values outside 1–1000 are truncated and clamped into that range rather than rejected. Defaults to 100.", "schema": { - "description": "Maximum log entries per page. Values outside 1–1000 are truncated and clamped into that range rather than rejected. Defaults to 100.", + "description": "Maximum log entries per page. When execution data is returned (`includeTraceSpans` or `includeFinalOutput`), a page holds at most 20 entries, and fewer when their stored traces are large; follow `nextCursor` for the rest. A page whose execution data is withheld by permissions is not capped. Values outside 1–1000 are truncated and clamped into that range rather than rejected. Defaults to 100.", "type": "integer", "default": 100 } @@ -1448,6 +1448,11 @@ "type": "number", "description": "Offset from the root span in milliseconds." }, + "contentWithheld": { + "type": "boolean", + "const": true, + "description": "Present when the log projection withheld some or all of this span's content (input, output, thinking, error message, tool-call or provider-segment content) because it could not be proven safe to display. Status, timing, and usage remain. A withheld content field is omitted whole, never a key inside it: a content field absent from a span carrying this marker may exist on the run but was not returned, while a key missing inside a content field that is present is genuinely absent." + }, "toolCalls": { "type": "array", "items": { diff --git a/apps/docs/package.json b/apps/docs/package.json index 1191be6c832..37683bf97e6 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -35,7 +35,7 @@ "fumadocs-mdx": "14.3.2", "fumadocs-openapi": "10.8.1", "fumadocs-ui": "16.8.5", - "next": "16.4.0", + "next": "16.4.1", "next-themes": "^0.4.6", "react": "19.2.4", "react-dom": "19.2.4", diff --git a/apps/sim/app/api/files/uploads/finalizers.ts b/apps/sim/app/api/files/uploads/finalizers.ts index 4ce5a6cb3cb..4f9eec1be35 100644 --- a/apps/sim/app/api/files/uploads/finalizers.ts +++ b/apps/sim/app/api/files/uploads/finalizers.ts @@ -124,6 +124,7 @@ export async function finalizeUploadPurpose({ case 'execution_attachment': return finalizeExecutionAttachment(session) case 'table_import': + case 'knowledge_import': case 'knowledge_document': throw new UploadSessionError( 'validation', @@ -154,6 +155,7 @@ export async function loadCompletedUploadPurpose( case 'mothership_attachment': case 'execution_attachment': case 'table_import': + case 'knowledge_import': case 'knowledge_document': throw new UploadSessionError( 'internal', diff --git a/apps/sim/app/api/logs/export/route.test.ts b/apps/sim/app/api/logs/export/route.test.ts index 52cfac5171d..a1a035d429a 100644 --- a/apps/sim/app/api/logs/export/route.test.ts +++ b/apps/sim/app/api/logs/export/route.test.ts @@ -8,7 +8,7 @@ import { import { permissionsMock, permissionsMockFns } from '@sim/testing/mocks/permissions.mock' import { createMockRequest } from '@sim/testing/mocks/request.mock' import { traceStoreMock, traceStoreMockFns } from '@sim/testing/mocks/trace-store.mock' -import { beforeEach, describe, expect, it, vi } from 'vitest' +import { afterEach, beforeEach, describe, expect, it, type MockInstance, vi } from 'vitest' const { mockExpandFolderIdsWithDescendants, mockMapWithConcurrency } = vi.hoisted(() => ({ mockExpandFolderIdsWithDescendants: vi.fn(), @@ -30,6 +30,7 @@ vi.mock('@/lib/core/utils/concurrency', () => ({ mapWithConcurrency: mockMapWithConcurrency, })) +import { toCsvRow } from '@/lib/core/utils/csv' import { capabilityRefusal } from '@/lib/permission-groups/capabilities' import { GET } from '@/app/api/logs/export/route' @@ -73,7 +74,20 @@ function flattenConditions(condition: unknown): Array> { } describe('GET /api/logs/export', () => { + /** + * Every read advances past the export's CPU slice, so each piece of a row ends its slice. One + * clock for the whole file, never moving backwards, keeps the process-wide slice deadline it + * sets meaningful for every later test. + */ + let fakeClockMs = 0 + let clock: MockInstance<() => number> | undefined + beforeEach(() => { + fakeClockMs = Math.max(fakeClockMs, performance.now()) + clock = vi.spyOn(performance, 'now').mockImplementation(() => { + fakeClockMs += 20 + return fakeClockMs + }) resetDbChainMock() mockGetSession.mockResolvedValue({ user: { id: 'user-1' } }) mockCheckWorkspaceAccess.mockResolvedValue({ hasAccess: true }) @@ -93,6 +107,10 @@ describe('GET /api/logs/export', () => { ) }) + afterEach(() => { + clock?.mockRestore() + }) + it('returns only the CSV header when workspace access is denied', async () => { mockCheckWorkspaceAccess.mockResolvedValueOnce({ hasAccess: false }) @@ -216,6 +234,64 @@ describe('GET /api/logs/export', () => { await expect(Promise.all([pendingRead, cancellation])).resolves.toBeDefined() }) + it('streams one large trace row in pieces with event-loop turns between them', async () => { + const content = 'say "hi", then wait\n'.repeat(100_000) + const traceSpans = [ + { id: 'root', name: 'Workflow Execution', children: [{ output: { content } }] }, + ] + queueTableRows(workflowExecutionLogs, [ + logRow(0, { executionData: { message: 'm', traceSpans } }), + ]) + + const response = await GET(makeRequest(), undefined) + if (!response.body) throw new Error('expected a streamed export body') + const reader = response.body.getReader() + const decoder = new TextDecoder() + const header = decoder.decode((await reader.read()).value) + + let turns = 0 + let streaming = true + const tick = () => { + if (!streaming) return + turns += 1 + setImmediate(tick) + } + setImmediate(tick) + const turnsAtEachRowChunk: number[] = [] + let row = '' + try { + while (true) { + const { done, value } = await reader.read() + if (done) break + row += decoder.decode(value, { stream: true }) + turnsAtEachRowChunk.push(turns) + } + } finally { + streaming = false + } + const turnsBetweenRowChunks = turnsAtEachRowChunk + .slice(1) + .map((turnsAtChunk, index) => turnsAtChunk - turnsAtEachRowChunk[index]) + + expect(header).toMatch(/^startedAt,.*\n$/) + expect(turnsAtEachRowChunk.length).toBeGreaterThan(1) + expect(turnsBetweenRowChunks.some((delta) => delta > 0)).toBe(true) + expect(row).toBe( + `${toCsvRow([ + logRow(0).startedAt.toISOString(), + 'info', + 'Workflow', + 'manual', + '500', + '0.01', + 'workflow-1', + 'execution-0', + 'm', + JSON.stringify(traceSpans), + ])}\n` + ) + }) + it('blanks the cost column and span spend when the group withholds cost', async () => { mockGetUserPermissionConfig.mockResolvedValue({ hideCostInfo: true }) queueTableRows(workflowExecutionLogs, [ diff --git a/apps/sim/app/api/logs/export/route.ts b/apps/sim/app/api/logs/export/route.ts index ad4cca9381c..73468428ae4 100644 --- a/apps/sim/app/api/logs/export/route.ts +++ b/apps/sim/app/api/logs/export/route.ts @@ -6,7 +6,8 @@ import { and, desc, eq, lt, or, type SQL, sql } from 'drizzle-orm' import { type NextRequest, NextResponse } from 'next/server' import { getSession } from '@/lib/auth' import { MATERIALIZE_CONCURRENCY, mapWithConcurrency } from '@/lib/core/utils/concurrency' -import { formatCsvValue, toCsvRow } from '@/lib/core/utils/csv' +import { formatCsvValue, toCsvLinePieces, toCsvRow } from '@/lib/core/utils/csv' +import { yieldWhenSliceExpires } from '@/lib/core/utils/event-loop' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { materializeExecutionDataForDisplay } from '@/lib/logs/execution/trace-store' import { withheldSpendData } from '@/lib/logs/fetch-log-detail' @@ -223,7 +224,7 @@ export const GET = withRouteHandler(async (request: NextRequest) => { error: getErrorMessage(rowError), }) } - const line = toCsvRow([ + const pieces = toCsvLinePieces([ formatCsvValue(row.startedAt), formatCsvValue(row.level), formatCsvValue(row.workflowName), @@ -235,7 +236,14 @@ export const GET = withRouteHandler(async (request: NextRequest) => { formatCsvValue(message), formatCsvValue(tracesJson), ]) - yield encoder.encode(`${line}\n`) + /** + * One trace can serialize to tens of megabytes, and escaping it in one run would hold + * the event loop for every other request on this server; small rows share a slice. + */ + for (const piece of pieces) { + yield encoder.encode(piece) + await yieldWhenSliceExpires() + } } } diff --git a/apps/sim/app/api/table/[tableId]/delete-async/route.ts b/apps/sim/app/api/table/[tableId]/delete-async/route.ts index 96587b83d34..4ac28aa8772 100644 --- a/apps/sim/app/api/table/[tableId]/delete-async/route.ts +++ b/apps/sim/app/api/table/[tableId]/delete-async/route.ts @@ -4,8 +4,7 @@ import { type NextRequest, NextResponse } from 'next/server' import { deleteTableRowsAsyncContract } from '@/lib/api/contracts/tables' import { parseRequest } from '@/lib/api/server' import { checkSessionOrInternalAuth } from '@/lib/auth/hybrid' -import { isTriggerDevEnabled } from '@/lib/core/config/env-flags' -import { runDetached } from '@/lib/core/utils/background' +import { dispatchBackgroundTask } from '@/lib/core/async-jobs/background-task' import { generateRequestId } from '@/lib/core/utils/request' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import type { Filter } from '@/lib/table' @@ -16,6 +15,7 @@ import { assertRowDelete } from '@/lib/table/mutation-locks' import { toLegacyFilter } from '@/lib/table/query-builder/converters' import type { TableDeleteJobPayload } from '@/lib/table/types' import { accessError, checkAccess, tableFilterError } from '@/app/api/table/utils' +import type { tableDeleteTask } from '@/background/table-delete' const logger = createLogger('TableDeleteAsync') @@ -104,41 +104,26 @@ export const POST = withRouteHandler(async (request: NextRequest, { params }: Ro ) } - if (isTriggerDevEnabled) { - // Trigger.dev runs the delete outside the web container (survives deploys) and retries — - // safe: the keyset + cutoff walk just deletes whatever remains. - try { - const [{ tableDeleteTask }, { tasks }, { resolveTriggerRegion }] = await Promise.all([ - import('@/background/table-delete'), - import('@trigger.dev/sdk'), - import('@/lib/core/async-jobs/region'), - ]) - await tasks.trigger( - 'table-delete', - { jobId, tableId, workspaceId, filter, excludeRowIds, cutoff: cutoff.toISOString() }, - { tags: [`tableId:${tableId}`, `jobId:${jobId}`], region: await resolveTriggerRegion() } - ) - } catch (error) { - // A failed dispatch must not leave a ghost `running` job holding the - // table's one-write-job slot until the stale-job janitor fires. - await releaseJobClaim(tableId, jobId).catch(() => {}) - throw error - } - } else { - runDetached('table-delete', () => - runTableDelete({ - jobId, - tableId, - workspaceId, - filter, - excludeRowIds, - cutoff, - }).catch(async (error) => { - // No retry machinery on the detached path — fail the job immediately. - await markTableDeleteFailed(tableId, jobId, error) - throw error - }) + // Trigger.dev may retry the delete — safe: the keyset + cutoff walk just deletes whatever remains. + try { + await dispatchBackgroundTask( + 'table-delete', + { jobId, tableId, workspaceId, filter, excludeRowIds, cutoff: cutoff.toISOString() }, + { + runInProcess: (payload) => + runTableDelete({ ...payload, cutoff }).catch(async (error) => { + // No retry machinery on the detached path — fail the job immediately. + await markTableDeleteFailed(tableId, jobId, error) + throw error + }), + trigger: { tags: [`tableId:${tableId}`, `jobId:${jobId}`] }, + } ) + } catch (error) { + // A failed dispatch must not leave a ghost `running` job holding the + // table's one-write-job slot until the stale-job janitor fires. + await releaseJobClaim(tableId, jobId).catch(() => {}) + throw error } logger.info(`[${requestId}] Async row delete started`, { diff --git a/apps/sim/app/api/telemetry/route.ts b/apps/sim/app/api/telemetry/route.ts index 19199de99b6..3a974f128a4 100644 --- a/apps/sim/app/api/telemetry/route.ts +++ b/apps/sim/app/api/telemetry/route.ts @@ -1,12 +1,14 @@ import { createLogger } from '@sim/logger' import { getErrorMessage } from '@sim/utils/errors' +import { generateRandomHex } from '@sim/utils/random' import { type NextRequest, NextResponse } from 'next/server' import { telemetryContract } from '@/lib/api/contracts/telemetry' import { parseRequest } from '@/lib/api/server' -import { env } from '@/lib/core/config/env' import { isProd } from '@/lib/core/config/env-flags' import { enforceIpRateLimit } from '@/lib/core/rate-limiter' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' +import { isTelemetryDisabled, normalizeOtlpTracesUrl } from '@/lib/monitoring/otlp' +import telemetryConfig from '@/telemetry.config' const logger = createLogger('TelemetryAPI') @@ -52,15 +54,20 @@ function createSafeAttributes( } /** - * Forwards telemetry data to OpenTelemetry collector + * Forwards a browser telemetry event as one span, and not at all when the operator turned telemetry + * off. Browser events are unauthenticated input, so they never travel with the operator's + * collector credentials: they go to `TELEMETRY_ENDPOINT` or the configured anonymous collector. */ async function forwardToCollector(data: Record): Promise { if (!data || typeof data !== 'object') { logger.error('Invalid telemetry data format') return false } + if (isTelemetryDisabled()) return false - const endpoint = env.TELEMETRY_ENDPOINT || 'https://telemetry.simstudio.ai/v1/traces' + // TELEMETRY_ENDPOINT has always been the relay's full destination URL, so it is posted to as-is. + const endpoint = + process.env.TELEMETRY_ENDPOINT || normalizeOtlpTracesUrl(telemetryConfig.endpoint) const timeout = DEFAULT_TIMEOUT try { @@ -89,10 +96,12 @@ async function forwardToCollector(data: Record): Promise ({ + importId: params.importId, + workspaceId: query.workspaceId, + uploadToken: headers['upload-token'], + }), + useCase: completeKnowledgeImport, + present: presentV2KnowledgeImport, +}) diff --git a/apps/sim/app/api/v2/knowledge/imports/[importId]/parts/route.ts b/apps/sim/app/api/v2/knowledge/imports/[importId]/parts/route.ts new file mode 100644 index 00000000000..1379f650804 --- /dev/null +++ b/apps/sim/app/api/v2/knowledge/imports/[importId]/parts/route.ts @@ -0,0 +1,24 @@ +import { v2CreateKnowledgeImportPartUrlsContract } from '@/lib/api/contracts/v2/knowledge' +import { defineV2JsonRoute, v2ApiKeyAuth, v2RateLimits } from '@/lib/api/server/routes' +import { v2KnowledgeErrorPolicies } from '@/lib/knowledge/api/route-policies' +import { createKnowledgeImportParts } from '@/lib/knowledge/application/imports' +import { knowledgeOperations } from '@/lib/knowledge/application/operations' + +export const dynamic = 'force-dynamic' +export const revalidate = 0 + +export const POST = defineV2JsonRoute({ + contract: v2CreateKnowledgeImportPartUrlsContract, + operation: knowledgeOperations.importParts, + auth: v2ApiKeyAuth, + rateLimit: v2RateLimits.publicApi, + errorPolicy: v2KnowledgeErrorPolicies.concealImportAuthorization, + mapInput: ({ params, query, headers, body }) => ({ + importId: params.importId, + workspaceId: query.workspaceId, + uploadToken: headers['upload-token'], + partNumbers: body.partNumbers, + }), + useCase: createKnowledgeImportParts, + present: (result) => ({ data: result }), +}) diff --git a/apps/sim/app/api/v2/knowledge/imports/[importId]/route.ts b/apps/sim/app/api/v2/knowledge/imports/[importId]/route.ts new file mode 100644 index 00000000000..c9d30560e8c --- /dev/null +++ b/apps/sim/app/api/v2/knowledge/imports/[importId]/route.ts @@ -0,0 +1,42 @@ +import { + v2CancelKnowledgeImportContract, + v2GetKnowledgeImportContract, +} from '@/lib/api/contracts/v2/knowledge' +import { defineV2JsonRoute, v2ApiKeyAuth, v2RateLimits } from '@/lib/api/server/routes' +import { v2KnowledgeErrorPolicies } from '@/lib/knowledge/api/route-policies' +import { cancelKnowledgeImport, readKnowledgeImport } from '@/lib/knowledge/application/imports' +import { knowledgeOperations } from '@/lib/knowledge/application/operations' +import { presentV2KnowledgeImport } from '@/app/api/v2/knowledge/imports/presenters' + +export const dynamic = 'force-dynamic' +export const revalidate = 0 + +export const GET = defineV2JsonRoute({ + contract: v2GetKnowledgeImportContract, + operation: knowledgeOperations.importRead, + auth: v2ApiKeyAuth, + rateLimit: v2RateLimits.publicApi, + errorPolicy: v2KnowledgeErrorPolicies.concealImportAuthorization, + mapInput: ({ params, query, headers }) => ({ + importId: params.importId, + workspaceId: query.workspaceId, + uploadToken: headers['upload-token'], + }), + useCase: readKnowledgeImport, + present: presentV2KnowledgeImport, +}) + +export const DELETE = defineV2JsonRoute({ + contract: v2CancelKnowledgeImportContract, + operation: knowledgeOperations.importCancel, + auth: v2ApiKeyAuth, + rateLimit: v2RateLimits.publicApi, + errorPolicy: v2KnowledgeErrorPolicies.concealImportAuthorization, + mapInput: ({ params, query, headers }) => ({ + importId: params.importId, + workspaceId: query.workspaceId, + uploadToken: headers['upload-token'], + }), + useCase: cancelKnowledgeImport, + present: presentV2KnowledgeImport, +}) diff --git a/apps/sim/app/api/v2/knowledge/imports/presenters.ts b/apps/sim/app/api/v2/knowledge/imports/presenters.ts new file mode 100644 index 00000000000..5a05e4bd492 --- /dev/null +++ b/apps/sim/app/api/v2/knowledge/imports/presenters.ts @@ -0,0 +1,37 @@ +import type { + V2CreateKnowledgeImportData, + V2KnowledgeImport, +} from '@/lib/api/contracts/v2/knowledge' +import type { + CreateKnowledgeImportResult, + KnowledgeImportResource, +} from '@/lib/knowledge/application/imports' + +function toV2KnowledgeImport(resource: KnowledgeImportResource): V2KnowledgeImport { + return { + ...resource, + createdAt: resource.createdAt.toISOString(), + updatedAt: resource.updatedAt.toISOString(), + completedAt: resource.completedAt?.toISOString() ?? null, + } +} + +export function presentV2KnowledgeImport({ + import: resource, +}: { + import: KnowledgeImportResource +}) { + return { data: toV2KnowledgeImport(resource) } +} + +export function presentV2CreateKnowledgeImport(result: CreateKnowledgeImportResult): { + data: V2CreateKnowledgeImportData +} { + return { + data: { + session: toV2KnowledgeImport(result.import), + uploadToken: result.upload.uploadToken, + transfer: result.upload.transfer, + }, + } +} diff --git a/apps/sim/app/api/v2/knowledge/imports/route.ts b/apps/sim/app/api/v2/knowledge/imports/route.ts new file mode 100644 index 00000000000..dbf99def928 --- /dev/null +++ b/apps/sim/app/api/v2/knowledge/imports/route.ts @@ -0,0 +1,20 @@ +import { v2CreateKnowledgeImportContract } from '@/lib/api/contracts/v2/knowledge' +import { defineV2JsonRoute, v2ApiKeyAuth, v2RateLimits } from '@/lib/api/server/routes' +import { v2KnowledgeErrorPolicies } from '@/lib/knowledge/api/route-policies' +import { createKnowledgeImport } from '@/lib/knowledge/application/imports' +import { knowledgeOperations } from '@/lib/knowledge/application/operations' +import { presentV2CreateKnowledgeImport } from '@/app/api/v2/knowledge/imports/presenters' + +export const dynamic = 'force-dynamic' +export const revalidate = 0 + +export const POST = defineV2JsonRoute({ + contract: v2CreateKnowledgeImportContract, + operation: knowledgeOperations.importCreate, + auth: v2ApiKeyAuth, + rateLimit: v2RateLimits.publicApi, + errorPolicy: v2KnowledgeErrorPolicies.usage, + mapInput: ({ body }) => ({ body }), + useCase: createKnowledgeImport, + present: presentV2CreateKnowledgeImport, +}) diff --git a/apps/sim/background/cleanup-stale-executions.test.ts b/apps/sim/background/cleanup-stale-executions.test.ts index 6f552046988..d06ed9b9d23 100644 --- a/apps/sim/background/cleanup-stale-executions.test.ts +++ b/apps/sim/background/cleanup-stale-executions.test.ts @@ -301,9 +301,9 @@ describe('stale execution cleanup deadline grace', () => { it('claims every cleanup page without overlapping concurrent workers', async () => { await runCleanupStaleExecutions() - // Nine batched arms: the connector sync-log retention pass is the newest. - expect(dbChainMockFns.transaction).toHaveBeenCalledTimes(9) - expect(dbChainMockFns.for).toHaveBeenCalledTimes(9) + // Eleven batched arms: the knowledge import stale and retention passes are the newest. + expect(dbChainMockFns.transaction).toHaveBeenCalledTimes(11) + expect(dbChainMockFns.for).toHaveBeenCalledTimes(11) for (const [strength, options] of dbChainMockFns.for.mock.calls) { expect(strength).toBe('update') expect(options).toEqual({ skipLocked: true }) @@ -372,7 +372,7 @@ describe('stale execution cleanup deadline grace', () => { expect(mockDeleteFile).toHaveBeenCalledTimes(1000) const limits = dbChainMockFns.limit.mock.calls.map(([limit]) => limit) - expect(limits.filter((limit) => limit === 100)).toHaveLength(20) + expect(limits.filter((limit) => limit === 100)).toHaveLength(22) expect(limits.filter((limit) => limit === 1000)).toHaveLength(30) expect(limits.filter((limit) => limit === 2000)).toHaveLength(12) diff --git a/apps/sim/background/cleanup-stale-executions.ts b/apps/sim/background/cleanup-stale-executions.ts index 198ca2eab97..1d2eb7ffb0f 100644 --- a/apps/sim/background/cleanup-stale-executions.ts +++ b/apps/sim/background/cleanup-stale-executions.ts @@ -1,6 +1,8 @@ import { db } from '@sim/db' import { asyncJobs, + document, + knowledgeBaseImport, knowledgeConnectorSyncLog, tableJobs, workflowDeploymentOperation, @@ -25,6 +27,7 @@ import { RESERVATION_TTL_BUFFER_MS, } from '@/lib/core/execution-limits' import type { DbTransaction } from '@/lib/db/types' +import { KNOWLEDGE_IMPORT_STORAGE_CONTEXT } from '@/lib/knowledge/transfer/import-jobs' import { elapsedDurationMsSql } from '@/lib/logs/execution/duration' import { STALE_SWEEPABLE_EXECUTION_STATUSES, @@ -55,6 +58,16 @@ const EXECUTION_DEADLINE_ERROR = getTimeoutErrorMessage() const TABLE_JOB_STALE_THRESHOLD_MINUTES = 95 /** Terminal table-jobs older than this are pruned; only the latest job per table is ever read. */ const TABLE_JOB_RETENTION_HOURS = 24 +/** + * A knowledge import heartbeats after every document, and its task runs at most + * 90 minutes, so a `running` import silent for longer than this lost its worker. + */ +const KNOWLEDGE_IMPORT_STALE_THRESHOLD_MINUTES = 95 +/** Settled knowledge imports stay readable this long, so a caller can still fetch the outcome. */ +const KNOWLEDGE_IMPORT_RETENTION_DAYS = 7 +/** Each stale import deletes its uploaded bundle, so these pages stay small. */ +const KNOWLEDGE_IMPORT_BATCH_SIZE = 100 +const KNOWLEDGE_IMPORT_MAX_ROWS_PER_RUN = 1000 /** * A table run dispatch whose holder has not made progress for this long is * treated as dead. Same rule as the table-job threshold above, measured from the @@ -148,6 +161,18 @@ async function runBatchedMutation({ return { affected, reachedLimit: affected >= maxRowsPerRun } } +/** Deletes import bundles one at a time; a bundle already gone is not an error. */ +async function deleteKnowledgeImportBundles(imports: { sourceKey: string }[]): Promise { + for (const { sourceKey } of imports) { + await deleteFile({ key: sourceKey, context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT }).catch((err) => { + logger.warn('Failed to delete a knowledge import bundle', { + sourceKey, + error: toError(err).message, + }) + }) + } +} + /** Settles everything a dead worker left unfinished and prunes expired bookkeeping rows. */ export async function runCleanupStaleExecutions() { logger.info('Starting stale execution cleanup job') @@ -451,6 +476,107 @@ export async function runCleanupStaleExecutions() { }) } + /** + * Fail knowledge imports whose worker died, and delete the bundle that worker + * would have deleted in its `finally`. Documents it already imported stay in + * the base, as they would after a cancel; one it was indexing in-process has + * no queue behind it, so it is failed for the user to retry. Settled imports + * are pruned later, deleting any bundle a canceled or crashed worker left. + */ + let staleKnowledgeImportsMarkedFailed = 0 + try { + const staleKnowledgeImportThreshold = new Date( + now.getTime() - KNOWLEDGE_IMPORT_STALE_THRESHOLD_MINUTES * 60 * 1000 + ) + const staleKnowledgeImportPredicate = and( + eq(knowledgeBaseImport.status, 'running'), + lt(knowledgeBaseImport.updatedAt, staleKnowledgeImportThreshold) + ) + const staleKnowledgeImportResult = await runBatchedMutation({ + batchSize: KNOWLEDGE_IMPORT_BATCH_SIZE, + maxRowsPerRun: KNOWLEDGE_IMPORT_MAX_ROWS_PER_RUN, + claim: (tx, limit) => + tx + .select({ id: knowledgeBaseImport.id }) + .from(knowledgeBaseImport) + .where(staleKnowledgeImportPredicate) + .limit(limit) + .for('update', { skipLocked: true }), + mutation: (tx, candidateIds) => + tx + .update(knowledgeBaseImport) + .set({ + status: 'failed', + error: `Import stopped: no progress for more than ${KNOWLEDGE_IMPORT_STALE_THRESHOLD_MINUTES} minutes (worker timeout or crash)`, + completedAt: now, + updatedAt: now, + }) + .where(and(staleKnowledgeImportPredicate, inArray(knowledgeBaseImport.id, candidateIds))) + .returning({ + sourceKey: knowledgeBaseImport.sourceKey, + knowledgeBaseId: knowledgeBaseImport.knowledgeBaseId, + }), + onBatch: async (imports) => { + const knowledgeBaseIds = imports.flatMap(({ knowledgeBaseId }) => + knowledgeBaseId ? [knowledgeBaseId] : [] + ) + if (knowledgeBaseIds.length > 0) { + await db + .update(document) + .set({ + processingStatus: 'failed', + processingError: 'The import stopped before this document finished indexing', + processingCompletedAt: now, + }) + .where( + and( + inArray(document.knowledgeBaseId, knowledgeBaseIds), + eq(document.processingStatus, 'processing'), + isNull(document.processingQueueToken), + lt(document.processingStartedAt, staleKnowledgeImportThreshold) + ) + ) + } + await deleteKnowledgeImportBundles(imports) + }, + }) + staleKnowledgeImportsMarkedFailed = staleKnowledgeImportResult.affected + if (staleKnowledgeImportsMarkedFailed > 0) { + logger.info(`Marked ${staleKnowledgeImportsMarkedFailed} stale knowledge imports as failed`) + } + + const knowledgeImportRetention = new Date( + now.getTime() - KNOWLEDGE_IMPORT_RETENTION_DAYS * 24 * 60 * 60 * 1000 + ) + const settledKnowledgeImportPredicate = and( + inArray(knowledgeBaseImport.status, ['completed', 'failed', 'canceled']), + lt(knowledgeBaseImport.updatedAt, knowledgeImportRetention) + ) + await runBatchedMutation({ + batchSize: KNOWLEDGE_IMPORT_BATCH_SIZE, + maxRowsPerRun: KNOWLEDGE_IMPORT_MAX_ROWS_PER_RUN, + claim: (tx, limit) => + tx + .select({ id: knowledgeBaseImport.id }) + .from(knowledgeBaseImport) + .where(settledKnowledgeImportPredicate) + .limit(limit) + .for('update', { skipLocked: true }), + mutation: (tx, candidateIds) => + tx + .delete(knowledgeBaseImport) + .where( + and(settledKnowledgeImportPredicate, inArray(knowledgeBaseImport.id, candidateIds)) + ) + .returning({ sourceKey: knowledgeBaseImport.sourceKey }), + onBatch: deleteKnowledgeImportBundles, + }) + } catch (error) { + logger.error('Failed to clean up stale knowledge imports:', { + error: toError(error).message, + }) + } + // Clean up stale pending jobs (never started, e.g., due to server crash before startJob()) let stalePendingJobsMarkedFailed = 0 @@ -773,6 +899,10 @@ export async function runCleanupStaleExecutions() { tableJobs: { staleMarkedFailed: staleTableJobsMarkedFailed, }, + knowledgeImports: { + staleMarkedFailed: staleKnowledgeImportsMarkedFailed, + thresholdMinutes: KNOWLEDGE_IMPORT_STALE_THRESHOLD_MINUTES, + }, connectorSyncLogs: { pruned: connectorSyncLogsPruned, retentionDays: CONNECTOR_SYNC_LOG_RETENTION_DAYS, diff --git a/apps/sim/background/knowledge-import.ts b/apps/sim/background/knowledge-import.ts new file mode 100644 index 00000000000..7688b4d0b3f --- /dev/null +++ b/apps/sim/background/knowledge-import.ts @@ -0,0 +1,28 @@ +import { task } from '@trigger.dev/sdk' +import { + type KnowledgeImportPayload, + runKnowledgeImport, +} from '@/lib/knowledge/transfer/import-runner' + +/** + * Trigger.dev wrapper around `runKnowledgeImport`. The import's lifecycle lives + * in the `knowledge_base_import` state machine, so the task is a thin shell. + * + * `maxAttempts: 1` — a blind re-run would create a second knowledge base beside + * the first attempt's. A crashed import is marked failed by the runner's own + * catch, or by the stale-job janitor if the process died; the user re-imports. + * `medium-1x` because a document's original file, up to 100 MB, is held in + * memory while it is stored. + */ +export const knowledgeImportTask = task({ + id: 'knowledge-import', + machine: 'medium-1x', + retry: { maxAttempts: 1 }, + queue: { + name: 'knowledge-import', + concurrencyLimit: 10, + }, + run: async (payload: KnowledgeImportPayload) => { + await runKnowledgeImport(payload) + }, +}) diff --git a/apps/sim/blocks/blocks/ec2.ts b/apps/sim/blocks/blocks/ec2.ts new file mode 100644 index 00000000000..ddc5bc05d4d --- /dev/null +++ b/apps/sim/blocks/blocks/ec2.ts @@ -0,0 +1,1023 @@ +import { EC2Icon } from '@/components/icons' +import type { BlockConfig, BlockMeta } from '@/blocks/types' +import { AuthMode, IntegrationType } from '@/blocks/types' + +const INSTANCE_ACTIONS = [ + 'start_instances', + 'stop_instances', + 'reboot_instances', + 'terminate_instances', +] + +const PAGINATED_DESCRIBES = [ + 'describe_instances', + 'describe_instance_status', + 'describe_nat_gateways', + 'describe_route_tables', + 'describe_vpcs', + 'describe_subnets', + 'describe_security_groups', + 'describe_internet_gateways', + 'describe_network_interfaces', + 'describe_volumes', + 'describe_snapshots', + 'describe_network_acls', + 'describe_vpc_endpoints', + 'describe_vpc_peering_connections', + 'describe_images', +] + +const INGRESS_RULE_OPERATIONS = [ + 'authorize_security_group_ingress', + 'revoke_security_group_ingress', +] + +const FILTERABLE_DESCRIBES = [ + ...PAGINATED_DESCRIBES, + 'describe_addresses', + 'describe_regions', + 'describe_availability_zones', + 'describe_key_pairs', +] + +/** + * Converts the tag table (rows of `{ cells: { key, value } }`) into a `{ key: value }` + * record. Any other shape (a resolved reference, raw JSON, or a `[{ Key, Value }]` array) is + * passed through for the operation to parse. + */ +function toTagParam(value: unknown): unknown { + if (typeof value === 'string') return value.trim() === '' ? undefined : value + if (!Array.isArray(value) || !value.every((row) => row?.cells)) return value ?? undefined + const entries: [string, string][] = [] + for (const row of value) { + const key = row.cells.key + if (typeof key === 'string' && key.trim() !== '') { + entries.push([key.trim(), String(row.cells.value ?? '')]) + } + } + return entries.length > 0 ? Object.fromEntries(entries) : undefined +} + +export const EC2Block: BlockConfig = { + type: 'ec2', + name: 'Amazon EC2', + description: 'Manage EC2 instances, Elastic IPs, VPC networking, and EBS', + longDescription: + 'Integrate Amazon EC2 into workflows. Describe and control instances, manage Elastic IP addresses, inspect VPCs, subnets, route tables, NAT and internet gateways, security groups, and network interfaces, add and revoke security group ingress rules, inspect network ACLs, VPC endpoints, and peering connections, work with EBS volumes and snapshots, list AMIs and key pairs, and tag resources. Requires an AWS access key with the matching ec2:* IAM permissions.', + docsLink: 'https://docs.sim.ai/integrations/ec2', + category: 'tools', + integrationType: IntegrationType.DevOps, + authMode: AuthMode.ApiKey, + bgColor: 'linear-gradient(45deg, #C8511B 0%, #FF9900 100%)', + iconColor: '#FF9900', + icon: EC2Icon, + canvasPresentation: { + defaultTitle: 'Amazon EC2', + sentences: { + byOperation: { + describe_instances: ['List instances', { text: 'with IDs', field: 'instanceIds' }], + describe_instance_status: [ + 'Check status of instances', + { text: 'with IDs', field: 'instanceIds' }, + ], + start_instances: [{ text: 'Start', field: 'instanceIds', core: true }], + stop_instances: [{ text: 'Stop', field: 'instanceIds', core: true }], + reboot_instances: [{ text: 'Reboot', field: 'instanceIds', core: true }], + terminate_instances: [{ text: 'Terminate', field: 'instanceIds', core: true }], + describe_addresses: [ + 'List Elastic IPs', + { text: 'matching', field: ['publicIps', 'allocationIds'] }, + ], + allocate_address: ['Allocate new Elastic IP'], + associate_address: [ + { text: 'Attach Elastic IP', field: 'allocationId', core: true }, + { text: 'to', field: ['instanceId', 'networkInterfaceId'] }, + ], + disassociate_address: [ + { text: 'Detach Elastic IP association', field: 'associationId', core: true }, + ], + release_address: [{ text: 'Release Elastic IP', field: 'allocationId', core: true }], + describe_nat_gateways: ['List NAT gateways', { text: 'with IDs', field: 'natGatewayIds' }], + describe_route_tables: ['List route tables', { text: 'with IDs', field: 'routeTableIds' }], + describe_vpcs: ['List VPCs', { text: 'with IDs', field: 'vpcIds' }], + describe_subnets: ['List subnets', { text: 'with IDs', field: 'subnetIds' }], + describe_security_groups: ['List security groups', { text: 'with IDs', field: 'groupIds' }], + authorize_security_group_ingress: [ + { text: 'Allow inbound', field: 'ipProtocol', core: true }, + { text: 'from', field: ['cidrIp', 'cidrIpv6', 'sourceGroupId'], core: true }, + { text: 'on', field: 'groupId', core: true }, + ], + revoke_security_group_ingress: [ + { text: 'Revoke inbound rules on', field: 'groupId', core: true }, + { + text: 'matching', + field: ['securityGroupRuleIds', 'cidrIp', 'cidrIpv6', 'sourceGroupId'], + core: true, + }, + ], + describe_network_acls: ['List network ACLs', { text: 'with IDs', field: 'networkAclIds' }], + describe_vpc_endpoints: [ + 'List VPC endpoints', + { text: 'with IDs', field: 'vpcEndpointIds' }, + ], + describe_vpc_peering_connections: [ + 'List VPC peering connections', + { text: 'with IDs', field: 'vpcPeeringConnectionIds' }, + ], + describe_internet_gateways: [ + 'List internet gateways', + { text: 'with IDs', field: 'internetGatewayIds' }, + ], + describe_network_interfaces: [ + 'List network interfaces', + { text: 'with IDs', field: 'networkInterfaceIds' }, + ], + describe_volumes: ['List EBS volumes', { text: 'with IDs', field: 'volumeIds' }], + describe_snapshots: ['List EBS snapshots', { text: 'with IDs', field: 'snapshotIds' }], + delete_volume: [{ text: 'Delete volume', field: 'volumeId', core: true }], + create_snapshot: [{ text: 'Snapshot volume', field: 'volumeId', core: true }], + delete_snapshot: [{ text: 'Delete snapshot', field: 'snapshotId', core: true }], + describe_images: ['List AMIs', { text: 'with IDs', field: 'imageIds' }], + describe_key_pairs: [ + 'List key pairs', + { text: 'named', field: ['keyNames', 'keyPairIds'] }, + ], + create_tags: [{ text: 'Tag', field: 'resourceIds', core: true }], + delete_tags: [ + { text: 'Remove tags', field: 'tagKeys', core: true }, + { text: 'from', field: 'resourceIds', core: true }, + ], + describe_regions: ['List AWS Regions', { text: 'named', field: 'regionNames' }], + describe_availability_zones: [ + 'List Availability Zones', + { text: 'named', field: 'zoneNames' }, + ], + }, + }, + }, + subBlocks: [ + { + id: 'operation', + title: 'Operation', + type: 'dropdown', + options: [ + { label: 'Describe Instances', id: 'describe_instances' }, + { label: 'Describe Instance Status', id: 'describe_instance_status' }, + { label: 'Start Instances', id: 'start_instances' }, + { label: 'Stop Instances', id: 'stop_instances' }, + { label: 'Reboot Instances', id: 'reboot_instances' }, + { label: 'Terminate Instances', id: 'terminate_instances' }, + { label: 'Describe Elastic IPs', id: 'describe_addresses' }, + { label: 'Allocate Elastic IP', id: 'allocate_address' }, + { label: 'Associate Elastic IP', id: 'associate_address' }, + { label: 'Disassociate Elastic IP', id: 'disassociate_address' }, + { label: 'Release Elastic IP', id: 'release_address' }, + { label: 'Describe NAT Gateways', id: 'describe_nat_gateways' }, + { label: 'Describe Route Tables', id: 'describe_route_tables' }, + { label: 'Describe VPCs', id: 'describe_vpcs' }, + { label: 'Describe Subnets', id: 'describe_subnets' }, + { label: 'Describe Security Groups', id: 'describe_security_groups' }, + { label: 'Authorize Security Group Ingress', id: 'authorize_security_group_ingress' }, + { label: 'Revoke Security Group Ingress', id: 'revoke_security_group_ingress' }, + { label: 'Describe Network ACLs', id: 'describe_network_acls' }, + { label: 'Describe Internet Gateways', id: 'describe_internet_gateways' }, + { label: 'Describe Network Interfaces', id: 'describe_network_interfaces' }, + { label: 'Describe VPC Endpoints', id: 'describe_vpc_endpoints' }, + { label: 'Describe VPC Peering Connections', id: 'describe_vpc_peering_connections' }, + { label: 'Describe EBS Volumes', id: 'describe_volumes' }, + { label: 'Delete EBS Volume', id: 'delete_volume' }, + { label: 'Describe EBS Snapshots', id: 'describe_snapshots' }, + { label: 'Create EBS Snapshot', id: 'create_snapshot' }, + { label: 'Delete EBS Snapshot', id: 'delete_snapshot' }, + { label: 'Describe AMIs', id: 'describe_images' }, + { label: 'Describe Key Pairs', id: 'describe_key_pairs' }, + { label: 'Create Tags', id: 'create_tags' }, + { label: 'Delete Tags', id: 'delete_tags' }, + { label: 'Describe Regions', id: 'describe_regions' }, + { label: 'Describe Availability Zones', id: 'describe_availability_zones' }, + ], + value: () => 'describe_instances', + }, + { + id: 'awsRegion', + title: 'AWS Region', + type: 'short-input', + placeholder: 'us-east-1', + required: true, + }, + { + id: 'awsAccessKeyId', + title: 'AWS Access Key ID', + type: 'short-input', + placeholder: 'Enter your AWS access key ID', + password: true, + required: true, + }, + { + id: 'awsSecretAccessKey', + title: 'AWS Secret Access Key', + type: 'short-input', + placeholder: 'Enter your AWS secret access key', + password: true, + required: true, + }, + { + id: 'instanceIds', + title: 'Instance IDs', + type: 'short-input', + placeholder: 'i-0abc123def456, i-0789abc012def', + condition: { + field: 'operation', + value: ['describe_instances', 'describe_instance_status', ...INSTANCE_ACTIONS], + }, + required: { field: 'operation', value: INSTANCE_ACTIONS }, + }, + { + id: 'includeAllInstances', + title: 'Include Stopped Instances', + type: 'switch', + condition: { field: 'operation', value: 'describe_instance_status' }, + }, + { + id: 'hibernate', + title: 'Hibernate', + type: 'switch', + condition: { field: 'operation', value: 'stop_instances' }, + mode: 'advanced', + }, + { + id: 'force', + title: 'Force Stop', + type: 'switch', + condition: { field: 'operation', value: 'stop_instances' }, + mode: 'advanced', + }, + { + id: 'publicIps', + title: 'Public IPs', + type: 'short-input', + placeholder: '203.0.113.10, 203.0.113.11', + condition: { field: 'operation', value: 'describe_addresses' }, + }, + { + id: 'allocationIds', + title: 'Allocation IDs', + type: 'short-input', + placeholder: 'eipalloc-0abc123def456', + condition: { field: 'operation', value: 'describe_addresses' }, + }, + { + id: 'allocationId', + title: 'Allocation ID', + type: 'short-input', + placeholder: 'eipalloc-0abc123def456', + condition: { field: 'operation', value: ['associate_address', 'release_address'] }, + required: { field: 'operation', value: ['associate_address', 'release_address'] }, + }, + { + id: 'instanceId', + title: 'Instance ID', + type: 'short-input', + placeholder: 'i-0abc123def456 (or set a network interface)', + condition: { field: 'operation', value: 'associate_address' }, + }, + { + id: 'networkInterfaceId', + title: 'Network Interface ID', + type: 'short-input', + placeholder: 'eni-0abc123def456 (or set an instance)', + condition: { field: 'operation', value: 'associate_address' }, + }, + { + id: 'privateIpAddress', + title: 'Private IP Address', + type: 'short-input', + placeholder: 'Defaults to the primary private IP', + condition: { field: 'operation', value: 'associate_address' }, + mode: 'advanced', + }, + { + id: 'allowReassociation', + title: 'Allow Reassociation', + type: 'switch', + condition: { field: 'operation', value: 'associate_address' }, + mode: 'advanced', + }, + { + id: 'associationId', + title: 'Association ID', + type: 'short-input', + placeholder: 'eipassoc-0abc123def456', + condition: { field: 'operation', value: 'disassociate_address' }, + required: { field: 'operation', value: 'disassociate_address' }, + }, + { + id: 'networkBorderGroup', + title: 'Network Border Group', + type: 'short-input', + placeholder: 'Defaults to the region', + condition: { field: 'operation', value: ['allocate_address', 'release_address'] }, + mode: 'advanced', + }, + { + id: 'publicIpv4Pool', + title: 'Public IPv4 Pool', + type: 'short-input', + placeholder: 'Defaults to the Amazon pool', + condition: { field: 'operation', value: 'allocate_address' }, + mode: 'advanced', + }, + { + id: 'natGatewayIds', + title: 'NAT Gateway IDs', + type: 'short-input', + placeholder: 'nat-0abc123def456', + condition: { field: 'operation', value: 'describe_nat_gateways' }, + }, + { + id: 'routeTableIds', + title: 'Route Table IDs', + type: 'short-input', + placeholder: 'rtb-0abc123def456', + condition: { field: 'operation', value: 'describe_route_tables' }, + }, + { + id: 'vpcIds', + title: 'VPC IDs', + type: 'short-input', + placeholder: 'vpc-0abc123def456', + condition: { field: 'operation', value: 'describe_vpcs' }, + }, + { + id: 'subnetIds', + title: 'Subnet IDs', + type: 'short-input', + placeholder: 'subnet-0abc123def456', + condition: { field: 'operation', value: 'describe_subnets' }, + }, + { + id: 'groupIds', + title: 'Security Group IDs', + type: 'short-input', + placeholder: 'sg-0abc123def456', + condition: { field: 'operation', value: 'describe_security_groups' }, + }, + { + id: 'groupId', + title: 'Security Group ID', + type: 'short-input', + placeholder: 'sg-0abc123def456', + condition: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + required: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + }, + { + id: 'securityGroupRuleIds', + title: 'Security Group Rule IDs', + type: 'short-input', + placeholder: 'sgr-0abc123def456 (or match by protocol, ports, and source)', + condition: { field: 'operation', value: 'revoke_security_group_ingress' }, + }, + { + id: 'ipProtocol', + title: 'Protocol', + type: 'short-input', + placeholder: 'tcp, udp, icmp, icmpv6, or -1 for all traffic', + condition: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + required: { field: 'operation', value: 'authorize_security_group_ingress' }, + }, + { + id: 'fromPort', + title: 'From Port', + type: 'short-input', + placeholder: '443 (ICMP type for icmp, omit for all traffic)', + condition: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + }, + { + id: 'toPort', + title: 'To Port', + type: 'short-input', + placeholder: '443 (ICMP code for icmp, omit for all traffic)', + condition: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + }, + { + id: 'cidrIp', + title: 'Source IPv4 CIDR', + type: 'short-input', + placeholder: '203.0.113.0/24', + condition: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + }, + { + id: 'cidrIpv6', + title: 'Source IPv6 CIDR', + type: 'short-input', + placeholder: '2001:db8::/32', + condition: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + mode: 'advanced', + }, + { + id: 'sourceGroupId', + title: 'Source Security Group ID', + type: 'short-input', + placeholder: 'sg-0def456abc123', + condition: { field: 'operation', value: INGRESS_RULE_OPERATIONS }, + mode: 'advanced', + }, + { + id: 'networkAclIds', + title: 'Network ACL IDs', + type: 'short-input', + placeholder: 'acl-0abc123def456', + condition: { field: 'operation', value: 'describe_network_acls' }, + }, + { + id: 'vpcEndpointIds', + title: 'VPC Endpoint IDs', + type: 'short-input', + placeholder: 'vpce-0abc123def456', + condition: { field: 'operation', value: 'describe_vpc_endpoints' }, + }, + { + id: 'vpcPeeringConnectionIds', + title: 'VPC Peering Connection IDs', + type: 'short-input', + placeholder: 'pcx-0abc123def456', + condition: { field: 'operation', value: 'describe_vpc_peering_connections' }, + }, + { + id: 'internetGatewayIds', + title: 'Internet Gateway IDs', + type: 'short-input', + placeholder: 'igw-0abc123def456', + condition: { field: 'operation', value: 'describe_internet_gateways' }, + }, + { + id: 'networkInterfaceIds', + title: 'Network Interface IDs', + type: 'short-input', + placeholder: 'eni-0abc123def456', + condition: { field: 'operation', value: 'describe_network_interfaces' }, + }, + { + id: 'volumeIds', + title: 'Volume IDs', + type: 'short-input', + placeholder: 'vol-0abc123def456', + condition: { field: 'operation', value: 'describe_volumes' }, + }, + { + id: 'snapshotIds', + title: 'Snapshot IDs', + type: 'short-input', + placeholder: 'snap-0abc123def456', + condition: { field: 'operation', value: 'describe_snapshots' }, + }, + { + id: 'ownerIds', + title: 'Snapshot Owners', + type: 'short-input', + placeholder: 'Defaults to self (account IDs, self, or amazon)', + condition: { field: 'operation', value: 'describe_snapshots' }, + mode: 'advanced', + }, + { + id: 'volumeId', + title: 'Volume ID', + type: 'short-input', + placeholder: 'vol-0abc123def456', + condition: { field: 'operation', value: ['create_snapshot', 'delete_volume'] }, + required: { field: 'operation', value: ['create_snapshot', 'delete_volume'] }, + }, + { + id: 'description', + title: 'Description', + type: 'short-input', + placeholder: 'Nightly backup of the app data volume', + condition: { + field: 'operation', + value: ['create_snapshot', 'authorize_security_group_ingress'], + }, + }, + { + id: 'snapshotId', + title: 'Snapshot ID', + type: 'short-input', + placeholder: 'snap-0abc123def456', + condition: { field: 'operation', value: 'delete_snapshot' }, + required: { field: 'operation', value: 'delete_snapshot' }, + }, + { + id: 'imageIds', + title: 'AMI IDs', + type: 'short-input', + placeholder: 'ami-0abc123def456', + condition: { field: 'operation', value: 'describe_images' }, + }, + { + id: 'owners', + title: 'AMI Owners', + type: 'short-input', + placeholder: 'Defaults to self (account IDs, self, amazon, or aws-marketplace)', + condition: { field: 'operation', value: 'describe_images' }, + mode: 'advanced', + }, + { + id: 'keyNames', + title: 'Key Pair Names', + type: 'short-input', + placeholder: 'deploy-key, bastion-key', + condition: { field: 'operation', value: 'describe_key_pairs' }, + }, + { + id: 'keyPairIds', + title: 'Key Pair IDs', + type: 'short-input', + placeholder: 'key-0abc123def456', + condition: { field: 'operation', value: 'describe_key_pairs' }, + mode: 'advanced', + }, + { + id: 'resourceIds', + title: 'Resource IDs', + type: 'short-input', + placeholder: 'i-0abc123def456, vol-0abc123def456', + condition: { field: 'operation', value: ['create_tags', 'delete_tags'] }, + required: { field: 'operation', value: ['create_tags', 'delete_tags'] }, + }, + { + id: 'tags', + title: 'Tags', + type: 'table', + columns: ['key', 'value'], + condition: { + field: 'operation', + value: ['create_tags', 'allocate_address', 'create_snapshot'], + }, + required: { field: 'operation', value: 'create_tags' }, + }, + { + id: 'tagKeys', + title: 'Tag Keys', + type: 'short-input', + placeholder: 'Environment, Owner', + condition: { field: 'operation', value: 'delete_tags' }, + required: { field: 'operation', value: 'delete_tags' }, + }, + { + id: 'regionNames', + title: 'Region Names', + type: 'short-input', + placeholder: 'us-east-1, eu-west-1', + condition: { field: 'operation', value: 'describe_regions' }, + }, + { + id: 'allRegions', + title: 'Include Disabled Regions', + type: 'switch', + condition: { field: 'operation', value: 'describe_regions' }, + mode: 'advanced', + }, + { + id: 'zoneNames', + title: 'Zone Names', + type: 'short-input', + placeholder: 'us-east-1a, us-east-1b', + condition: { field: 'operation', value: 'describe_availability_zones' }, + }, + { + id: 'allAvailabilityZones', + title: 'Include All Zones', + type: 'switch', + condition: { field: 'operation', value: 'describe_availability_zones' }, + mode: 'advanced', + }, + { + id: 'filters', + title: 'Filters', + type: 'code', + language: 'json', + placeholder: '[{"Name": "vpc-id", "Values": ["vpc-0abc123def456"]}]', + condition: { field: 'operation', value: FILTERABLE_DESCRIBES }, + mode: 'advanced', + wandConfig: { + enabled: true, + prompt: `Generate an Amazon EC2 API filter list as a JSON array based on the user's description. +Each entry is {"Name": "", "Values": ["", ...]}. Values in one entry are ORed; entries are ANDed. +Common filter names: +- Instances: instance-state-name (pending|running|stopping|stopped|terminated), instance-type, vpc-id, subnet-id, tag:, tag-key +- Elastic IPs: domain, instance-id, association-id, network-interface-id, tag: +- NAT gateways: state (pending|failed|available|deleting|deleted), subnet-id, vpc-id, tag: +- Route tables: vpc-id, association.subnet-id, association.main, route.nat-gateway-id, route.gateway-id, route.state (active|blackhole) +- Security groups: vpc-id, group-name, ip-permission.cidr, ip-permission.from-port +- Volumes: status (available|in-use), volume-type, attachment.instance-id, encrypted +- Snapshots: volume-id, status, start-time +Return ONLY the JSON array, no explanation.`, + placeholder: 'Describe the resources to match...', + generationType: 'json-array', + }, + }, + { + id: 'maxResults', + title: 'Max Results', + type: 'short-input', + placeholder: '5 to 1000 (route tables 5 to 100), defaults to 100', + condition: { field: 'operation', value: PAGINATED_DESCRIBES }, + mode: 'advanced', + }, + { + id: 'nextToken', + title: 'Next Token', + type: 'short-input', + placeholder: 'Token from a previous response', + condition: { field: 'operation', value: PAGINATED_DESCRIBES }, + mode: 'advanced', + }, + ], + tools: { + access: [ + 'ec2_describe_instances', + 'ec2_describe_instance_status', + 'ec2_start_instances', + 'ec2_stop_instances', + 'ec2_reboot_instances', + 'ec2_terminate_instances', + 'ec2_describe_addresses', + 'ec2_allocate_address', + 'ec2_associate_address', + 'ec2_disassociate_address', + 'ec2_release_address', + 'ec2_describe_nat_gateways', + 'ec2_describe_route_tables', + 'ec2_describe_vpcs', + 'ec2_describe_subnets', + 'ec2_describe_security_groups', + 'ec2_describe_internet_gateways', + 'ec2_describe_network_interfaces', + 'ec2_describe_volumes', + 'ec2_describe_snapshots', + 'ec2_create_snapshot', + 'ec2_create_tags', + 'ec2_delete_tags', + 'ec2_describe_regions', + 'ec2_describe_availability_zones', + 'ec2_authorize_security_group_ingress', + 'ec2_revoke_security_group_ingress', + 'ec2_describe_network_acls', + 'ec2_describe_vpc_endpoints', + 'ec2_describe_vpc_peering_connections', + 'ec2_delete_volume', + 'ec2_delete_snapshot', + 'ec2_describe_images', + 'ec2_describe_key_pairs', + ], + config: { + tool: (params) => `ec2_${params.operation}`, + params: (params) => { + const { operation, maxResults, fromPort, toPort, tags, ...rest } = params + const result: Record = { ...rest } + for (const [key, value] of Object.entries({ maxResults, fromPort, toPort })) { + if (value !== undefined && value !== null && value !== '') result[key] = Number(value) + } + const tagParam = toTagParam(tags) + if (tagParam !== undefined) result.tags = tagParam + return result + }, + }, + }, + inputs: { + operation: { type: 'string', description: 'EC2 operation to perform' }, + awsRegion: { type: 'string', description: 'AWS region' }, + awsAccessKeyId: { type: 'string', description: 'AWS access key ID' }, + awsSecretAccessKey: { type: 'string', description: 'AWS secret access key' }, + instanceIds: { type: 'string', description: 'Comma-separated instance IDs' }, + includeAllInstances: { + type: 'boolean', + description: 'Include instances that are not running', + }, + hibernate: { type: 'boolean', description: 'Hibernate instead of stopping' }, + force: { type: 'boolean', description: 'Force the instances to stop' }, + publicIps: { type: 'string', description: 'Comma-separated Elastic IP addresses' }, + allocationIds: { type: 'string', description: 'Comma-separated Elastic IP allocation IDs' }, + allocationId: { type: 'string', description: 'Elastic IP allocation ID' }, + instanceId: { type: 'string', description: 'Instance ID to associate the Elastic IP with' }, + networkInterfaceId: { + type: 'string', + description: 'Network interface ID to associate the Elastic IP with', + }, + privateIpAddress: { type: 'string', description: 'Private IP address to associate with' }, + allowReassociation: { + type: 'boolean', + description: 'Allow moving an Elastic IP that is already associated', + }, + associationId: { type: 'string', description: 'Elastic IP association ID' }, + networkBorderGroup: { type: 'string', description: 'Network border group' }, + publicIpv4Pool: { type: 'string', description: 'Public IPv4 address pool' }, + natGatewayIds: { type: 'string', description: 'Comma-separated NAT gateway IDs' }, + routeTableIds: { type: 'string', description: 'Comma-separated route table IDs' }, + vpcIds: { type: 'string', description: 'Comma-separated VPC IDs' }, + subnetIds: { type: 'string', description: 'Comma-separated subnet IDs' }, + groupIds: { type: 'string', description: 'Comma-separated security group IDs' }, + internetGatewayIds: { type: 'string', description: 'Comma-separated internet gateway IDs' }, + networkInterfaceIds: { + type: 'string', + description: 'Comma-separated network interface IDs', + }, + volumeIds: { type: 'string', description: 'Comma-separated EBS volume IDs' }, + snapshotIds: { type: 'string', description: 'Comma-separated EBS snapshot IDs' }, + ownerIds: { type: 'string', description: 'Comma-separated snapshot owners' }, + volumeId: { type: 'string', description: 'EBS volume ID to snapshot or delete' }, + description: { type: 'string', description: 'Snapshot or ingress rule description' }, + resourceIds: { type: 'string', description: 'Comma-separated resource IDs to tag or untag' }, + tags: { type: 'json', description: 'Tags as key/value pairs' }, + tagKeys: { type: 'string', description: 'Comma-separated tag keys to remove' }, + regionNames: { type: 'string', description: 'Comma-separated region names' }, + allRegions: { type: 'boolean', description: 'Include Regions not enabled for the account' }, + zoneNames: { type: 'string', description: 'Comma-separated Availability Zone names' }, + allAvailabilityZones: { type: 'boolean', description: 'Include zones that are not opted in' }, + groupId: { type: 'string', description: 'Security group ID for the ingress rule' }, + securityGroupRuleIds: { + type: 'string', + description: 'Comma-separated security group rule IDs', + }, + ipProtocol: { type: 'string', description: 'IP protocol (tcp, udp, icmp, icmpv6, -1)' }, + fromPort: { type: 'number', description: 'Start of the port range' }, + toPort: { type: 'number', description: 'End of the port range' }, + cidrIp: { type: 'string', description: 'Source IPv4 CIDR' }, + cidrIpv6: { type: 'string', description: 'Source IPv6 CIDR' }, + sourceGroupId: { type: 'string', description: 'Source security group ID' }, + networkAclIds: { type: 'string', description: 'Comma-separated network ACL IDs' }, + vpcEndpointIds: { type: 'string', description: 'Comma-separated VPC endpoint IDs' }, + vpcPeeringConnectionIds: { + type: 'string', + description: 'Comma-separated VPC peering connection IDs', + }, + snapshotId: { type: 'string', description: 'EBS snapshot ID to delete' }, + imageIds: { type: 'string', description: 'Comma-separated AMI IDs' }, + owners: { type: 'string', description: 'Comma-separated AMI owners' }, + keyNames: { type: 'string', description: 'Comma-separated key pair names' }, + keyPairIds: { type: 'string', description: 'Comma-separated key pair IDs' }, + filters: { type: 'json', description: 'EC2 filters as [{ Name, Values }]' }, + maxResults: { type: 'number', description: 'Maximum results per page' }, + nextToken: { type: 'string', description: 'Pagination token' }, + }, + outputs: { + instances: { + type: 'array', + description: + 'Instances (describe_instances) or per-instance state transitions (start, stop, terminate)', + }, + instanceStatuses: { + type: 'array', + description: 'Status checks and scheduled events per instance (describe_instance_status)', + }, + rebooted: { + type: 'boolean', + description: 'Whether the reboot was accepted (reboot_instances)', + }, + instanceIds: { type: 'array', description: 'Instance IDs sent the reboot (reboot_instances)' }, + addresses: { type: 'array', description: 'Elastic IP addresses (describe_addresses)' }, + allocationId: { + type: 'string', + description: 'Elastic IP allocation ID (allocate_address, release_address)', + }, + publicIp: { type: 'string', description: 'Allocated Elastic IP address (allocate_address)' }, + domain: { type: 'string', description: 'Address scope (allocate_address)' }, + networkBorderGroup: { type: 'string', description: 'Network border group (allocate_address)' }, + publicIpv4Pool: { type: 'string', description: 'Public IPv4 pool (allocate_address)' }, + associationId: { + type: 'string', + description: 'Elastic IP association ID (associate_address, disassociate_address)', + }, + disassociated: { + type: 'boolean', + description: 'Whether the address was disassociated (disassociate_address)', + }, + released: { + type: 'boolean', + description: 'Whether the address was released (release_address)', + }, + natGateways: { type: 'array', description: 'NAT gateways (describe_nat_gateways)' }, + routeTables: { type: 'array', description: 'Route tables (describe_route_tables)' }, + vpcs: { type: 'array', description: 'VPCs (describe_vpcs)' }, + subnets: { type: 'array', description: 'Subnets (describe_subnets)' }, + securityGroups: { type: 'array', description: 'Security groups (describe_security_groups)' }, + internetGateways: { + type: 'array', + description: 'Internet gateways (describe_internet_gateways)', + }, + networkInterfaces: { + type: 'array', + description: 'Network interfaces (describe_network_interfaces)', + }, + volumes: { type: 'array', description: 'EBS volumes (describe_volumes)' }, + snapshots: { type: 'array', description: 'EBS snapshots (describe_snapshots)' }, + snapshotId: { + type: 'string', + description: 'New or deleted snapshot ID (create_snapshot, delete_snapshot)', + }, + volumeId: { + type: 'string', + description: 'Source or deleted volume ID (create_snapshot, delete_volume)', + }, + volumeSize: { type: 'number', description: 'Source volume size in GiB (create_snapshot)' }, + state: { type: 'string', description: 'Snapshot state (create_snapshot)' }, + startTime: { type: 'string', description: 'Snapshot start time (create_snapshot)' }, + description: { type: 'string', description: 'Snapshot description (create_snapshot)' }, + encrypted: { + type: 'boolean', + description: 'Whether the snapshot is encrypted (create_snapshot)', + }, + ownerId: { type: 'string', description: 'Owning AWS account ID (create_snapshot)' }, + tags: { type: 'json', description: 'Applied tags (create_snapshot, create_tags)' }, + resourceIds: { + type: 'array', + description: 'Resource IDs that were tagged or untagged (create_tags, delete_tags)', + }, + tagKeys: { type: 'array', description: 'Tag keys that were removed (delete_tags)' }, + networkAcls: { + type: 'array', + description: 'Network ACLs with rules and subnet associations (describe_network_acls)', + }, + vpcEndpoints: { type: 'array', description: 'VPC endpoints (describe_vpc_endpoints)' }, + vpcPeeringConnections: { + type: 'array', + description: 'VPC peering connections (describe_vpc_peering_connections)', + }, + images: { type: 'array', description: 'AMIs (describe_images)' }, + keyPairs: { type: 'array', description: 'Key pairs (describe_key_pairs)' }, + authorized: { + type: 'boolean', + description: 'Whether the ingress rule was added (authorize_security_group_ingress)', + }, + securityGroupRules: { + type: 'array', + description: 'Ingress rules that were added (authorize_security_group_ingress)', + }, + revoked: { + type: 'boolean', + description: 'Whether the revoke succeeded (revoke_security_group_ingress)', + }, + revokedRules: { + type: 'array', + description: 'Ingress rules that were removed (revoke_security_group_ingress)', + }, + unmatchedRuleCount: { + type: 'number', + description: 'Requested rules that matched nothing (revoke_security_group_ingress)', + }, + deleted: { + type: 'boolean', + description: 'Whether the volume or snapshot was deleted (delete_volume, delete_snapshot)', + }, + regions: { type: 'array', description: 'AWS Regions (describe_regions)' }, + availabilityZones: { + type: 'array', + description: 'Availability Zones (describe_availability_zones)', + }, + nextToken: { + type: 'string', + description: 'Pagination token for the next page (describe operations)', + }, + }, +} + +export const EC2BlockMeta = { + tags: ['cloud', 'monitoring'], + url: 'https://aws.amazon.com/ec2/', + templates: [ + { + icon: EC2Icon, + title: 'EC2 egress IP map', + prompt: + 'Build a workflow that lists Elastic IPs, NAT gateways, and route tables in Amazon EC2, works out which public IPs each private subnet egresses through, and writes the subnet-to-egress-IP map to a table so partners can allowlist the right addresses.', + modules: ['tables', 'agent', 'workflows'], + category: 'engineering', + tags: ['devops', 'automation'], + }, + { + icon: EC2Icon, + title: 'EC2 off-hours scheduler', + prompt: + 'Create a scheduled workflow that every weekday evening finds Amazon EC2 instances tagged Schedule=office-hours that are running, stops them, starts them again each morning, and posts a summary of the instances changed to Slack.', + modules: ['scheduled', 'agent', 'workflows'], + category: 'operations', + tags: ['devops', 'automation'], + alsoIntegrations: ['slack'], + }, + { + icon: EC2Icon, + title: 'EC2 unused Elastic IP finder', + prompt: + 'Build a scheduled weekly workflow that lists Amazon EC2 Elastic IP addresses, flags any with no association, records them in a cost table with their allocation IDs and tags, and asks for approval in Slack before releasing them.', + modules: ['scheduled', 'tables', 'agent', 'workflows'], + category: 'operations', + tags: ['devops', 'monitoring'], + alsoIntegrations: ['slack'], + }, + { + icon: EC2Icon, + title: 'EC2 open security group audit', + prompt: + 'Create a scheduled daily workflow that describes Amazon EC2 security groups, flags inbound rules open to 0.0.0.0/0 or ::/0 on ports other than 80 and 443, files a finding for each with the group, VPC, and offending rule, and revokes the rule once the owner approves in Slack.', + modules: ['scheduled', 'agent', 'workflows'], + category: 'engineering', + tags: ['devops', 'monitoring'], + alsoIntegrations: ['slack'], + }, + { + icon: EC2Icon, + title: 'EBS nightly snapshot', + prompt: + 'Build a scheduled nightly workflow that lists Amazon EC2 EBS volumes tagged Backup=true, creates a snapshot of each with a dated description and tags, and logs the snapshot IDs to a backup table.', + modules: ['scheduled', 'tables', 'workflows'], + category: 'operations', + tags: ['devops', 'automation'], + }, + { + icon: EC2Icon, + title: 'EC2 unattached volume cleanup', + prompt: + 'Create a scheduled weekly workflow that finds Amazon EC2 EBS volumes in the available state, estimates their monthly cost from size and type, snapshots each one, sends the list to Slack for approval, and deletes the approved volumes.', + modules: ['scheduled', 'agent', 'workflows'], + category: 'operations', + tags: ['devops', 'monitoring'], + alsoIntegrations: ['slack'], + }, + { + icon: EC2Icon, + title: 'EC2 scheduled event watcher', + prompt: + 'Build a scheduled workflow that checks Amazon EC2 instance status for impaired status checks and scheduled events such as instance retirement or system reboot, and opens a ticket for each affected instance with the event window.', + modules: ['scheduled', 'agent', 'workflows'], + category: 'operations', + tags: ['devops', 'monitoring'], + }, + { + icon: EC2Icon, + title: 'EC2 tag compliance enforcer', + prompt: + 'Create a scheduled workflow that lists Amazon EC2 instances, volumes, and Elastic IPs, finds resources missing the Owner or CostCenter tag, applies a default tag where the owner can be inferred, and reports the rest to Slack.', + modules: ['scheduled', 'agent', 'workflows'], + category: 'operations', + tags: ['devops', 'automation'], + alsoIntegrations: ['slack'], + }, + ], + skills: [ + { + name: 'map-subnet-egress-ips', + description: + 'Use Amazon EC2 route tables, NAT gateways, and Elastic IPs to work out which public IP each subnet reaches the internet through. Use when a partner or vendor needs your outbound IPs for an allowlist.', + content: + "# Map Subnet Egress IPs\n\nWork out the public IPs that outbound traffic from each subnet uses.\n\n## Steps\n1. Describe route tables (filter by vpc-id when the VPC is known) and read each table's subnet associations and its 0.0.0.0/0 route.\n2. For routes that target a NAT gateway, describe that NAT gateway and read the public IPs in its addresses.\n3. For routes that target an internet gateway, note that instances egress through their own public or Elastic IP; describe Elastic IPs to list them.\n4. Subnets with no explicit association use the main route table for the VPC.\n\n## Output\nA table of subnet ID, route table ID, egress target (NAT gateway or internet gateway), and the public egress IPs.", + }, + { + name: 'find-unassociated-elastic-ips', + description: + 'List Amazon EC2 Elastic IP addresses that are not associated with any instance or network interface, which AWS bills for while idle. Use for cost reviews.', + content: + '# Find Unassociated Elastic IPs\n\nFind Elastic IPs that are allocated but unused.\n\n## Steps\n1. Describe Elastic IP addresses in the region.\n2. Keep addresses with no association ID, instance ID, or network interface ID.\n3. Exclude addresses whose tags mark them as reserved.\n4. Only release an address after explicit confirmation, because a released IP cannot be guaranteed back.\n\n## Output\nEach unassociated address with its public IP, allocation ID, and tags.', + }, + { + name: 'audit-open-security-groups', + description: + 'Check Amazon EC2 security groups for inbound rules open to the whole internet (0.0.0.0/0 or ::/0), especially on SSH, RDP, and database ports. Use for security reviews.', + content: + '# Audit Open Security Groups\n\nFind inbound rules that expose resources to the internet.\n\n## Steps\n1. Describe security groups, optionally filtered by VPC.\n2. For each ingress rule, check IPv4 ranges for 0.0.0.0/0 and IPv6 ranges for ::/0.\n3. Treat protocol -1 (all traffic) and ports 22, 3389, 3306, and 5432 as high severity.\n4. Ports 80 and 443 open to the internet are usually expected for public load balancers; report them separately.\n5. Only after the owner approves, revoke the offending rule by group ID, protocol, port range, and the open CIDR.\n\n## Output\nEach finding with the group ID, group name, VPC, protocol, port range, and open CIDR, and whether it was revoked.', + }, + { + name: 'stop-instances-off-hours', + description: + 'Stop Amazon EC2 instances tagged for office-hours scheduling outside working hours and start them again in the morning. Use to cut cost on dev and test environments.', + content: + '# Stop Instances Off Hours\n\nRun non-production instances only when they are needed.\n\n## Steps\n1. Describe instances with filters tag:Schedule = office-hours and instance-state-name = running (or stopped for the morning run).\n2. Collect the instance IDs.\n3. Stop the instances in the evening, or start them in the morning.\n4. Report the state transitions returned for each instance.\n\n## Output\nThe instance IDs acted on with their previous and current states.', + }, + { + name: 'snapshot-tagged-volumes', + description: + 'Create EBS snapshots of every Amazon EC2 volume carrying a backup tag. Use for scheduled backups.', + content: + '# Snapshot Tagged Volumes\n\nBack up EBS volumes that are marked for backup.\n\n## Steps\n1. Describe volumes with the filter tag:Backup = true.\n2. For each volume, create a snapshot with a dated description and tags that record the source volume and run date.\n3. Record the snapshot ID and state for each volume.\n4. Describe snapshots later to confirm they reached the completed state.\n\n## Output\nA list of volume IDs and the snapshot IDs created for them.', + }, + { + name: 'clean-up-old-snapshots', + description: + 'Delete Amazon EBS snapshots older than a retention window, keeping the most recent ones per volume. Use to control snapshot storage cost.', + content: + '# Clean Up Old Snapshots\n\nApply a retention policy to EBS snapshots.\n\n## Steps\n1. Describe snapshots owned by the account, optionally filtered by tag.\n2. Group them by source volume and sort each group by start time.\n3. Keep the newest snapshots per volume and anything tagged to retain; mark the rest older than the retention window.\n4. Delete each marked snapshot. A snapshot used by a registered AMI cannot be deleted; report it instead.\n\n## Output\nThe snapshot IDs deleted and any that were skipped with the reason.', + }, + { + name: 'find-blackhole-routes', + description: + 'Find Amazon EC2 VPC routes in the blackhole state, which happen when a route targets a deleted NAT gateway, instance, or network interface. Use when a subnet suddenly loses connectivity.', + content: + '# Find Blackhole Routes\n\nLocate routes that point at targets that no longer exist.\n\n## Steps\n1. Describe route tables with the filter route.state = blackhole, optionally narrowed by vpc-id.\n2. For each table, list the routes whose state is blackhole and their target IDs.\n3. List the subnets associated with each affected table.\n\n## Output\nEach blackhole route with its route table, destination CIDR, missing target, and affected subnets.', + }, + { + name: 'check-instance-scheduled-events', + description: + 'Check Amazon EC2 instance status for failed status checks and scheduled maintenance events such as retirement or system reboot. Use to plan around AWS maintenance.', + content: + '# Check Instance Scheduled Events\n\nSurface instances that need attention.\n\n## Steps\n1. Describe instance status, including stopped instances if needed.\n2. Flag instances whose instance or system status check is impaired.\n3. List scheduled events with their code, description, and not-before and not-after window.\n\n## Output\nEach affected instance with its failed checks and upcoming events.', + }, + ], +} as const satisfies BlockMeta diff --git a/apps/sim/blocks/registry-maps.ts b/apps/sim/blocks/registry-maps.ts index 28a697fc24c..8e25f6ce584 100644 --- a/apps/sim/blocks/registry-maps.ts +++ b/apps/sim/blocks/registry-maps.ts @@ -72,6 +72,7 @@ import { DubBlock, DubBlockMeta, DubV2Block } from '@/blocks/blocks/dub' import { DuckDuckGoBlock, DuckDuckGoBlockMeta } from '@/blocks/blocks/duckduckgo' import { DynamoDBBlock, DynamoDBBlockMeta } from '@/blocks/blocks/dynamodb' import { DynatraceBlock, DynatraceBlockMeta } from '@/blocks/blocks/dynatrace' +import { EC2Block, EC2BlockMeta } from '@/blocks/blocks/ec2' import { ElasticsearchBlock, ElasticsearchBlockMeta } from '@/blocks/blocks/elasticsearch' import { ElevenLabsBlock, ElevenLabsBlockMeta } from '@/blocks/blocks/elevenlabs' import { EmailBisonBlock, EmailBisonBlockMeta } from '@/blocks/blocks/emailbison' @@ -478,6 +479,7 @@ export const BLOCK_REGISTRY: Record = { duckduckgo: DuckDuckGoBlock, dynamodb: DynamoDBBlock, dynatrace: DynatraceBlock, + ec2: EC2Block, elasticsearch: ElasticsearchBlock, elevenlabs: ElevenLabsBlock, emailbison: EmailBisonBlock, @@ -849,6 +851,7 @@ export const BLOCK_META_REGISTRY: Record = { duckduckgo: DuckDuckGoBlockMeta, dynamodb: DynamoDBBlockMeta, dynatrace: DynatraceBlockMeta, + ec2: EC2BlockMeta, elasticsearch: ElasticsearchBlockMeta, elevenlabs: ElevenLabsBlockMeta, emailbison: EmailBisonBlockMeta, diff --git a/apps/sim/components/icons.tsx b/apps/sim/components/icons.tsx index dcb707bcf4b..5fab254e1bd 100644 --- a/apps/sim/components/icons.tsx +++ b/apps/sim/components/icons.tsx @@ -7251,6 +7251,18 @@ export function LambdaIcon(props: SVGProps) { ) } +export function EC2Icon(props: SVGProps) { + return ( + + + + ) +} + export function AthenaIcon(props: SVGProps) { return ( str: + """Return the weather for a supported city.""" + weather = { + "Berlin": "18°C and clear", + "London": "15°C with light rain", + } + return weather.get(city, "Weather is unavailable for that city.") + + +agent = create_agent( + model="openai:gpt-5.5", + tools=[get_weather], + system_prompt="You are a concise weather assistant.", +) + +result = agent.invoke( + {"messages": [{"role": "user", "content": "What is the weather in Berlin?"}]} +) + +print(result["messages"][-1].content) +``` + +This example delegates the tool-selection loop to LangChain. The model identifier is illustrative and requires the matching provider package, credentials, and an available model. The current interface is documented in [LangChain agents](https://docs.langchain.com/oss/python/langchain/agents). + +### What does a basic LangGraph workflow look like? + +LangGraph can define a typed state and move that state through an explicitly declared node. + +```python +from typing_extensions import TypedDict +from langgraph.graph import StateGraph, START, END + + +class TextState(TypedDict): + text: str + character_count: int + + +def count_characters(state: TextState): + return {"character_count": len(state["text"])} + + +builder = StateGraph(TextState) +builder.add_node("count_characters", count_characters) +builder.add_edge(START, "count_characters") +builder.add_edge("count_characters", END) + +graph = builder.compile() +result = graph.invoke({"text": "LangGraph", "character_count": 0}) + +print(result["character_count"]) +``` + +This example makes the execution path visible in code: the graph starts, runs one node, updates state, and ends. A real agent graph can add model calls, tools, conditional edges, loops, persistence, interrupts, and multiple nodes using the same core model. + +## When should you use LangChain instead of LangGraph? + +LangChain is the better starting point when a [conventional tool-calling agent](https://docs.langchain.com/oss/python/langchain/agents) meets the application’s needs and development speed matters more than defining every state transition. + +Choose LangChain when: + +- You want to create an agent from a model, tools, and a system prompt. +- You prefer a prebuilt agent loop over writing graph topology. +- You need LangChain’s model and tool interfaces. +- You expect to customize behavior through middleware rather than replace the entire runtime structure. +- You want underlying LangGraph runtime capabilities without managing graph nodes and edges directly. + +### When should you use LangGraph instead of LangChain? + +LangGraph is the better choice when application logic must [explicitly control state and routing](https://docs.langchain.com/oss/python/langgraph/graph-api), pauses, loops, or the order in which deterministic and model-driven steps run. + +Choose LangGraph directly when: + +- The workflow has custom branches, loops, parallel paths, or stopping conditions. +- State must persist across steps or execution must resume after an interruption. +- Human review is a defined transition in the application’s control flow. +- Some steps must remain deterministic rather than being selected by an agent. +- The team needs to inspect and test the orchestration structure as application code. +- A prebuilt agent loop would hide decisions the team needs to control. + +### Should you use LangChain and LangGraph together? + +LangChain and LangGraph should be used together when LangChain’s agent abstraction is useful but the application also needs [LangGraph-backed persistence, streaming, or runtime customization](https://docs.langchain.com/oss/python/langchain/overview). + +For many projects, developers do not need to choose only one package conceptually: LangChain’s current agents already use LangGraph underneath. The practical decision is whether to work primarily through LangChain’s higher-level API or define the graph directly. + +### When should you choose a visual builder instead? + +Sim, the open-source AI workspace for building, deploying, and managing AI agents, fits teams that want a visual builder, 270+ integrations, and deployment without maintaining framework-level orchestration code. + +That option fits a different operating model from LangChain or LangGraph: the primary users may include technical and non-technical collaborators, and the team may prefer visual workflow ownership over a Python-defined application graph. + +n8n is another incumbent for teams whose main requirement is node-based SaaS automation rather than a code-first agent framework; as of October 2026, n8n uses its [Sustainable Use License](https://docs.n8n.io/n8n-community-license), which n8n describes as a fair-code license. + +### What other LangChain and LangGraph comparisons should you read? + +LangChain and LangGraph buyers can use these related guides to compare adjacent frameworks, orchestration approaches, and agent-building platforms: + +- [Best LangChain and LangGraph Alternatives for Production AI Agent Workflows](https://www.sim.ai/library/langgraph-alternatives) +- [AI Agent Orchestration Frameworks Explained](https://www.sim.ai/library/ai-agent-orchestration-frameworks-explained) +- [Best Multi-Agent Frameworks for Production in 2026](https://www.sim.ai/library/best-multi-agent-frameworks-2026) +- [Best AI Agent Platforms and Builders in 2026](https://www.sim.ai/library/best-ai-agent-platforms-2026) diff --git a/apps/sim/content/library/n8n-vs-zapier-vs-make/index.mdx b/apps/sim/content/library/n8n-vs-zapier-vs-make/index.mdx new file mode 100644 index 00000000000..bbb19cc63ea --- /dev/null +++ b/apps/sim/content/library/n8n-vs-zapier-vs-make/index.mdx @@ -0,0 +1,192 @@ +--- +slug: n8n-vs-zapier-vs-make +title: 'n8n vs Zapier vs Make: Which Automation Platform Is Best in 2026?' +description: 'Compare n8n vs Zapier vs Make on hosting, pricing, AI agents, integrations, and ease of use to choose the best automation platform in 2026.' +seoTitle: 'n8n vs Zapier vs Make: Best Platform in 2026' +date: 2026-10-22 +updated: 2026-10-22 +authors: + - andrew +readingTime: 9 +tags: [Automation, AI Agents, No-Code, Comparison, Sim] +ogImage: /library/n8n-vs-zapier-vs-make/cover.jpg +draft: false +faq: + - q: "Is n8n better than Zapier?" + a: "n8n is better than Zapier for teams that need self-hosting, source access, custom code, technical AI components, or execution-based billing. Zapier is better than n8n for business users who prioritize guided setup, managed infrastructure, and straightforward connections between common SaaS applications." + - q: "Is n8n better than Make?" + a: "n8n is better than Make when self-hosting and developer control are essential, while Make is better when operations teams want a highly visual editor for routers, mappings, iterators, and data transformations. Both support complex workflows, but their deployment and billing models differ." + - q: "Is Make better than Zapier?" + a: "Make is better than Zapier for visually designing complex scenarios with branching and data transformation, while Zapier is better for quickly deploying simple app-to-app automations. Make uses credits for module operations and some AI usage, whereas conventional Zapier usage is primarily measured in successful action tasks." + - q: "Which is cheaper, n8n, Zapier, or Make?" + a: "n8n can be cheaper for long workflows because cloud usage is primarily measured by executions, Zapier can be economical for simple automations with few actions, and Make can be economical when scenarios use few module operations. Actual cost depends on run volume, steps, bundles, AI usage, plan features, and self-hosting expenses." + - q: "Can n8n, Zapier, or Make be self-hosted?" + a: "n8n can be self-hosted, while Zapier and the Make platform are vendor-hosted. Make offers an on-prem agent that connects cloud scenarios to local systems, but the agent does not turn Make into a customer-hosted automation platform." + - q: "Is n8n open source?" + a: "n8n is source-available under the Sustainable Use License, not open source under an OSI-approved license. The license allows many internal uses but includes commercial restrictions, including restrictions relevant to providing n8n’s functionality to third parties." + - q: "Does n8n charge per step?" + a: "n8n Cloud primarily charges by workflow execution rather than charging for every standard node completed during that execution. Plan allowances, concurrency, retention, enterprise features, and infrastructure costs can still affect the total price." + - q: "What counts as a Zapier task?" + a: "Zapier generally counts each successful action completed by a conventional Zap as a task, while trigger steps and built-in utility steps such as Filter, Paths, Formatter, Delay, and Looping do not count. One trigger can consume multiple tasks when it causes several successful downstream actions." + - q: "What counts as a Make credit?" + a: "Make generally consumes credits when modules perform operations, and a single scenario run can consume several credits as bundles pass through multiple modules. Some AI features use dynamic credit consumption, so AI usage should be modeled separately." + - q: "Which is easier to learn, n8n, Zapier, or Make?" + a: "Zapier is generally the easiest to learn for simple automations, Make has a moderate learning curve because of its visual data-processing concepts, and n8n has the steepest learning curve when workflows involve self-hosting, code, APIs, or advanced AI components." + - q: "Which has the best AI agent support, n8n, Zapier, or Make?" + a: "n8n has the strongest technical AI workflow flexibility of the three, Zapier Agents, which Zapier is moving to AI by Zapier, offers a more guided agent experience connected to business applications, and Make AI Agents integrates agent behavior with visual scenarios. The best choice depends on whether the team values technical composition, ease of use, or visual orchestration." + - q: "What is the best open-source Zapier alternative?" + a: "Sim fits teams that need an OSI-approved license, because its core uses Apache 2.0, although its enterprise code has a separate production license. n8n is a popular self-hosted Zapier alternative, but its Sustainable Use License is source-available rather than OSI-approved. The guide Sim vs Zapier: Open-Source AI Agents vs Zaps, Compared explains the difference." + - q: "What is the best n8n alternative?" + a: "Zapier is a strong n8n alternative for simple no-code SaaS automation, Make is a strong alternative for visual multi-step scenarios, and Sim is a strong alternative when the main requirement is building and managing AI agents. The guide 12 Best n8n Alternatives and Competitors for AI Agents in 2026 compares additional options." + - q: "Is Sim free?" + a: "Sim’s Apache 2.0 core is free to self-host, and Sim Cloud has a Free plan at $0 with 1,000 one-time credits as of October 2026. Code in apps/sim/ee uses the separate Sim Enterprise License, which requires an Enterprise subscription for production use. Teams still pay for models and infrastructure." + - q: "How does Sim compare with n8n?" + a: "Sim is the open-source AI workspace for building, deploying, and managing AI agents, while n8n is a source-available automation platform that combines application automation with AI nodes. The guide Sim vs n8n vs OpenAI AgentKit: AI Agent Builder Comparison (2026) provides the direct comparison." + - q: "How does Sim compare with Gumloop?" + a: "Sim emphasizes an open-source AI workspace with self-hosting and multi-model agent workflows, while Gumloop provides a managed visual environment for AI-assisted automation. Buyers should compare deployment control, licensing, model options, governance, integrations, and the amount of infrastructure they want to manage." +--- + +## TL;DR + +n8n, Zapier, and Make are all capable automation platforms. n8n fits technical teams that want self-hosting and execution-based billing, Zapier is the easiest choice for broad app-to-app automation, and Make is best for visually designing complex multi-step scenarios. This guide is published by Sim, the open-source AI workspace for building, deploying, and managing AI agents. + +The right choice depends on how your team values deployment control, setup speed, workflow complexity, and billing predictability. This comparison uses vendor documentation and pricing information available as of October 2026. + +## Is n8n, Zapier, or Make better? + +n8n is better for technical control and self-hosting, Zapier is better for quick no-code app automation, and Make is better for visually mapping data through complex workflows. + +### Key facts at a glance + +[n8n is a source-available automation platform that supports cloud and self-hosted deployments](https://docs.n8n.io/deploy/host-n8n) and [meters its cloud plans primarily by workflow executions](https://n8n.io/pricing/). + +[Zapier meters conventional Zap usage primarily through successful action tasks](https://help.zapier.com/hc/en-us/articles/8496196837261-How-is-task-usage-measured-in-Zapier) on its managed platform. + +[Make meters scenario activity through credits consumed by module operations and some AI usage](https://help.make.com/credits). + +| Criterion | n8n | Zapier | Make | +|---|---|---|---| +| Best fit | Technical teams that want deployment control and flexible workflow logic | Teams that prioritize fast setup and a broad no-code app ecosystem | Teams that want a visual interface for complex, branching scenarios | +| Billing unit | [Workflow executions on n8n Cloud](https://n8n.io/pricing/) | [Successful action tasks for conventional Zaps](https://help.zapier.com/hc/en-us/articles/8496196837261-How-is-task-usage-measured-in-Zapier) | [Credits consumed by module operations and some AI features](https://help.make.com/credits) | +| Hosting | [n8n Cloud or customer-managed self-hosting](https://docs.n8n.io/deploy/host-n8n) | Vendor-hosted | Vendor-hosted; [Make’s on-prem agent connects local systems](https://help.make.com/on-premise-agent) but does not self-host the Make platform | +| License | [Sustainable Use License and Enterprise License](https://docs.n8n.io/n8n-community-license); source-available, not OSI-approved open source | [Proprietary cloud service](https://zapier.com/legal/terms-of-service) | [Proprietary commercial service](https://www.make.com/en/terms-and-conditions) | +| AI support | [AI Agent node and composable AI workflow nodes](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent) | [Zapier Agents](https://zapier.com/agents), now moving to AI by Zapier, plus AI features across Zapier products | [Make AI Agents](https://www.make.com/en/ai-agents) and AI modules inside scenarios | +| Integration experience | Flexible nodes, HTTP requests, code, and community nodes | [Large app directory with guided triggers and actions](https://zapier.com/apps) | Visual modules with detailed mapping between steps, plus [routers, filters, and aggregators](https://help.make.com/expand-your-scenario) | +| Learning curve | Steepest of the three for advanced use | Easiest for straightforward automations | Moderate; visual but increasingly technical as scenarios grow | + +These distinctions are more useful than declaring one universal winner. A five-step CRM notification workflow and a self-hosted AI workflow have different operational requirements. + +## How do n8n, Zapier, and Make compare on hosting, license, AI agents, integrations, and learning curve? + +n8n provides the most deployment control, Zapier provides the most guided no-code experience, and Make provides the most visually explicit representation of data moving between steps. + +### How does n8n compare with Zapier and Make? + +n8n gives technical teams more control over hosting and workflow implementation than Zapier or Make. + +[n8n offers a managed cloud service and documents a self-hosting option](https://docs.n8n.io/deploy/host-n8n). Its editor supports standard application nodes, [code](https://docs.n8n.io/build/code-in-n8n/using-the-code-node), HTTP requests, [branching and sub-workflows](https://docs.n8n.io/build/flow-logic), and AI-oriented nodes. That flexibility makes n8n a good fit when developers or technical operators will maintain the automation. + +The tradeoff is operational responsibility. A self-hosted n8n deployment requires the customer to manage infrastructure, upgrades, security, scaling, backups, and availability. n8n Cloud removes that infrastructure work but does not provide the same deployment control. + +n8n is not OSI-approved open-source software. As of October 2026, n8n distributes its source under the [Sustainable Use License](https://docs.n8n.io/n8n-community-license), a source-available fair-code license that permits many internal and non-commercial uses but restricts offering n8n’s functionality commercially to third parties. Some n8n features are covered by a separate enterprise license. + +For AI workflows, n8n documents an [AI Agent node and related AI components](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent). Its node-level flexibility is useful for teams combining models, tools, APIs, vector stores, and deterministic automation in one workflow. + +### How does Zapier compare with n8n and Make? + +Zapier gives non-technical teams the fastest path from selecting two applications to running a dependable app-to-app automation. + +Zapier’s conventional automation model is built around Zaps composed of triggers and actions. Its guided setup, application directory, templates, and familiar field-mapping experience reduce the work required for common tasks such as moving leads, updating records, sending notifications, or synchronizing SaaS tools. + +[Zapier is a proprietary, cloud-based service](https://zapier.com/legal/terms-of-service). It does not provide a customer-managed version of the Zapier platform comparable to n8n self-hosting. This simplifies operations but gives customers less control over deployment architecture. + +Zapier also offers [Zapier Agents](https://zapier.com/agents), which can use connected applications to complete goal-oriented work. As of October 2026, [Zapier is moving Agents to AI by Zapier](https://help.zapier.com/hc/en-us/articles/47402591569805). Buyers should evaluate Agents separately from conventional Zaps: Agents usage does not count as tasks and uses a separate activity quota. + +Zapier’s main advantage is accessibility. Its main limitation is that [task-based usage can grow when a workflow performs many successful actions](https://help.zapier.com/hc/en-us/articles/8496196837261-How-is-task-usage-measured-in-Zapier) for every incoming record. + +### How does Make compare with n8n and Zapier? + +Make gives operations teams a more visual way to inspect routers, filters, transformations, iterators, and data mappings than either a simple linear Zap or a code-oriented workflow. + +Make calls its workflows scenarios. The visual scenario editor shows how data moves between modules, and Make documents [routers, filters, and aggregators](https://help.make.com/expand-your-scenario) for automations that branch, aggregate data, transform payloads, or process multiple records. + +[Make is a proprietary commercial service](https://www.make.com/en/terms-and-conditions) and is primarily vendor-hosted. Make documents an [on-prem agent](https://help.make.com/on-premise-agent) for connecting enterprise scenarios to systems on a local network, but that agent is a connectivity component rather than a self-hosted edition of the Make platform. + +Make also offers [Make AI Agents](https://www.make.com/en/ai-agents). Its approach suits teams that want agent steps to operate alongside the same modules, routers, and data transformations used in conventional scenarios. + +Make’s visual model is approachable, but large scenarios still demand technical understanding. Bundles, iterators, aggregators, error handlers, mapping functions, and credit consumption can create a meaningful learning curve. + +## How does n8n vs Zapier vs Make pricing work? + +[n8n charges primarily for workflow executions](https://n8n.io/pricing/), [Zapier charges conventional Zaps primarily for successful action tasks](https://help.zapier.com/hc/en-us/articles/8496196837261-How-is-task-usage-measured-in-Zapier), and [Make charges credits for module operations and some AI usage](https://help.make.com/credits). + +Pricing pages and allowances change, so the billing unit matters more than a temporary entry price. The following descriptions reflect vendor materials available as of October 2026. + +### How does n8n pricing work? + +[n8n Cloud pricing is primarily based on complete workflow executions](https://n8n.io/pricing/) rather than charging separately for every standard step in an execution. + +A workflow that runs once and completes many nodes generally consumes one execution allowance, although concurrency, retention, features, and plan-specific limits still matter. This model can be attractive for long workflows with many deterministic steps. Self-hosting changes the cost calculation because the customer must account for infrastructure and operations. The paid self-hosted editions (Business and Enterprise) are also licensed by monthly workflow executions. + +Current cloud allowances and commercial terms are listed on the [n8n pricing page](https://n8n.io/pricing/). + +### How does Zapier pricing work? + +Zapier pricing for conventional Zaps is primarily based on tasks, with [each successful action generally counting toward task usage](https://help.zapier.com/hc/en-us/articles/8496196837261-How-is-task-usage-measured-in-Zapier). + +Trigger steps do not count as tasks, and neither do built-in utility steps such as [Filter, Paths, Formatter, Delay, and Looping](https://help.zapier.com/hc/en-us/articles/8496196837261-How-is-task-usage-measured-in-Zapier), but each successful downstream action can. A single incoming record that causes several actions may therefore consume several tasks. Buyers should model task volume using actual records multiplied by the expected successful actions per record. + +Current task allowances and plan features are listed on the [Zapier pricing page](https://zapier.com/pricing), while Zapier explains task accounting in its [task usage documentation](https://help.zapier.com/hc/en-us/articles/8496196837261-How-is-task-usage-measured-in-Zapier). + +### How does Make pricing work? + +[Make pricing is based on credits](https://www.make.com/en/pricing), with most non-AI module operations consuming credits as a scenario processes data. + +A scenario can consume multiple credits per run because each module may process one or more bundles. Iterators and loops can increase consumption substantially. [Some AI features use dynamic credit consumption](https://help.make.com/credits) rather than the same fixed operation pattern, so AI-heavy scenarios need separate usage estimates. + +Current allowances are listed on the [Make pricing page](https://www.make.com/en/pricing), and Make describes the accounting model in its [credit documentation](https://help.make.com/credits). + +### Which pricing model is most predictable? + +n8n is often the most predictable for long workflows, Zapier is easy to estimate for simple Zaps, and Make is predictable only after teams understand how many modules and bundles each scenario processes. + +For a fair estimate, model one real workflow on all three platforms. Multiply monthly trigger volume by expected n8n executions, successful Zapier actions, and Make module operations or AI credit usage. Add infrastructure and maintenance costs when comparing self-hosted n8n with managed services, and remember that paid self-hosted n8n editions are also priced by executions. + +## When should you choose n8n, Zapier, Make, or an AI agent platform? + +Choose n8n for technical control, Zapier for setup speed, Make for visual scenario design, and an AI agent platform when model-driven decisions are the primary requirement. + +### When should you choose n8n? + +Choose n8n when self-hosting, source access, custom code, API flexibility, or execution-based billing matters more than the easiest onboarding experience. + +n8n is the strongest fit of these three for engineering-led teams that want to manage deployment architecture or combine conventional automation with technical AI components. It is also a practical choice for workflows with many steps when per-action billing would be costly. + +Do not choose n8n solely because it is frequently described as open source. [n8n’s Sustainable Use License is source-available but not OSI-approved](https://docs.n8n.io/n8n-community-license), and its commercial-use restrictions should be reviewed before deployment. + +### When should you choose Zapier? + +Choose Zapier when business users need to connect common SaaS applications quickly without managing infrastructure or mastering a complex workflow editor. + +Zapier is particularly effective for straightforward triggers and actions, such as creating a CRM record from a form submission, notifying a channel about a new sale, or copying data between business applications. Teams should monitor task volume when each trigger causes several actions. + +### When should you choose Make? + +Choose Make when operators want a visual map of branching logic, transformations, loops, and data movement without moving to a primarily code-driven system. + +Make is well suited to complex operational scenarios whose maintainers benefit from seeing routers and mappings in one interface. Teams should test scenarios with realistic bundle volumes because iterators and repeated module operations affect credit usage. + +### What should you choose when the goal is AI agents rather than app-to-app automation? + +Sim, the open-source AI workspace for building, deploying, and managing AI agents, fits teams whose primary goal is AI agents rather than conventional app-to-app automation, with 270+ integrations. + +Sim’s core is Apache 2.0, while code in `apps/sim/ee` is governed by the separate [Sim Enterprise License](https://github.com/simstudioai/sim/blob/main/apps/sim/ee/LICENSE), which requires an Enterprise subscription for production use. The broader agent-platform category is compared in [Best AI Agent Platforms and Builders in 2026](https://www.sim.ai/library/best-ai-agent-platforms-2026). + +## What other n8n, Zapier, and Make comparisons should you read? + +n8n, Zapier, and Make buyers should use alternatives guides to compare each platform with products that serve the same specific job. + +- [12 Best n8n Alternatives and Competitors for AI Agents in 2026](https://www.sim.ai/library/n8n-alternatives) +- [15 Best Zapier Alternatives in 2026, Compared](https://www.sim.ai/library/best-zapier-alternatives) +- [6 Best Make.com Alternatives for AI Agents in 2026](https://www.sim.ai/library/best-make-com-alternatives-ai-agents-2026) +- [Sim vs Zapier: Open-Source AI Agents vs Zaps, Compared](https://www.sim.ai/library/sim-open-source-zapier-alternative) diff --git a/apps/sim/content/library/openclaw-vs-claude-cowork/index.mdx b/apps/sim/content/library/openclaw-vs-claude-cowork/index.mdx new file mode 100644 index 00000000000..b923b2aefcf --- /dev/null +++ b/apps/sim/content/library/openclaw-vs-claude-cowork/index.mdx @@ -0,0 +1,142 @@ +--- +slug: openclaw-vs-claude-cowork +title: 'OpenClaw vs Claude Cowork: Setup, Pricing, Security, and Scheduling Compared' +description: 'Compare OpenClaw vs Claude Cowork on setup, pricing, security, scheduling, customization, and the best fit for individual or team agent work.' +seoTitle: 'OpenClaw vs Claude Cowork: Full Comparison' +date: 2026-10-22 +updated: 2026-10-22 +authors: + - andrew +readingTime: 8 +tags: [AI Agents, OpenClaw, Claude Cowork, Comparisons, Sim] +ogImage: /library/openclaw-vs-claude-cowork/cover.jpg +draft: false +faq: + - q: "Is OpenClaw better than Claude Cowork?" + a: "OpenClaw is better than Claude Cowork for technical builders who want self-hosting, extensive configuration, communication channels, and control over persistent jobs. Claude Cowork is better for people who prioritize a managed experience and fast setup for file-based tasks. The best choice depends on whether control or convenience is the primary requirement." + - q: "Is OpenClaw free?" + a: "OpenClaw is free to download and use under the MIT License as of October 2026, but operating it is not necessarily free. Operators may pay for model API usage, hosting, storage, and maintenance. The total depends on the selected models, task volume, and whether the assistant runs locally or on an always-on server." + - q: "Is Claude Cowork free?" + a: "No. As of October 2026, Claude Cowork is available only on paid Claude plans (Pro, Max, Team, and Enterprise), and Cowork usage counts against the plan’s usage limits. Anthropic’s current pricing page is the authoritative source for plan eligibility, prices, and allowances because those details can change." + - q: "Can OpenClaw and Claude Cowork run scheduled tasks?" + a: "OpenClaw and Claude Cowork can both run scheduled tasks. OpenClaw jobs run inside a Gateway that the operator keeps online, while Cowork scheduled tasks run remotely in Anthropic’s cloud unless a task needs local files or apps, in which case it runs only on the local device." + - q: "Is OpenClaw safer than Claude Cowork?" + a: "OpenClaw is not inherently safer than Claude Cowork because self-hosting provides control without guaranteeing secure configuration. A hardened OpenClaw deployment can keep infrastructure under the operator’s control, while Cowork provides managed isolation and explicit file permissions. Both require limited access, careful credential handling, and defenses against untrusted instructions." + - q: "Is OpenClaw or Claude Cowork better for teams?" + a: "OpenClaw and Claude Cowork are not built primarily as platforms for centrally governed team agents. OpenClaw can run as a personal assistant or as a shared team gateway, but it leaves administration to its operator and treats each gateway as one trust domain, while Cowork is centered on individual Claude accounts, with admin controls on Team and Enterprise plans. Teams needing shared ownership, deployment governance, and organization-wide visibility should evaluate a dedicated team agent platform." +--- + +## TL;DR + +[OpenClaw](https://github.com/openclaw/openclaw) and [Claude Cowork](https://claude.com/product/cowork/) solve different versions of computer-based agent work: OpenClaw is a self-hosted assistant, run for one person or as a shared team deployment, with extensive configuration and channel support, while Claude Cowork is a managed agent for completing tasks with approved files and tools. This guide is published by Sim, the open-source AI workspace for building, deploying, and managing AI agents. + +The practical choice is less about which product is universally better and more about whether you want to operate the agent yourself. Choose OpenClaw when control, customization, messaging channels, and [persistent automation](https://docs.openclaw.ai/automation/cron-jobs/how-it-works) matter most. Choose Claude Cowork when you want a simpler experience backed by Anthropic’s managed Claude service. + +## What is the difference between OpenClaw and Claude Cowork? + +OpenClaw gives technical builders more control over where an assistant runs and how it connects to tools, while Claude Cowork gives individuals a more managed way to delegate file-based tasks. + +[OpenClaw](https://github.com/openclaw/openclaw) is software you install and operate in your own environment. Its gateway can connect an assistant to supported messaging channels, tools, model providers, scheduled jobs, and persistent background processes. That flexibility also makes the operator responsible for deployment, credentials, network exposure, updates, and security policy. + +[Claude Cowork](https://claude.com/product/cowork/) is an Anthropic product available through Claude on supported desktop, web, and mobile surfaces. It is designed around assigning Claude a task, granting access to specific files, folders, or tools, and letting Claude plan and complete multi-step work. Anthropic manages the model service and product experience, so builders have fewer infrastructure decisions to make. + +### What are the key facts about OpenClaw and Claude Cowork? + +OpenClaw and Claude Cowork differ most clearly in licensing, self-hosting, and how usage is paid for. + +- **OpenClaw:** As of October 2026, OpenClaw is distributed under the [MIT License](https://github.com/openclaw/openclaw/blob/main/LICENSE), runs in an environment controlled by the operator, and normally incurs costs through the chosen model provider and hosting environment rather than a mandatory OpenClaw software subscription. +- **Claude Cowork:** As of October 2026, Claude Cowork is a managed Anthropic product, [runs in Anthropic-managed cloud environments by default on supported plans](https://support.claude.com/en/articles/14479288-claude-cowork-architecture-overview), and follows the eligibility and usage limits of the account holder’s [Claude plan](https://claude.com/pricing) rather than charging a separate self-hosted software fee. + +## How do OpenClaw and Claude Cowork compare? + +OpenClaw leads on deployment control, customization, and unattended automation, while Claude Cowork leads on setup simplicity and managed file-based work. + +| Criterion | OpenClaw | Claude Cowork | +|---|---|---| +| Primary use | A [configurable personal assistant](https://github.com/openclaw/openclaw) connected to channels, tools, and background jobs | A [managed agent for multi-step tasks](https://claude.com/product/cowork/) involving approved files, folders, and tools | +| Where it runs | In an [operator-controlled environment](https://github.com/openclaw/openclaw), such as a local machine or private server | In [Anthropic-managed cloud environments by default](https://support.claude.com/en/articles/14479288-claude-cowork-architecture-overview), accessed through supported Claude surfaces | +| Setup | Requires [installation and configuration](https://github.com/openclaw/openclaw), including credentials and security decisions | Requires [access to an eligible Claude plan](https://support.claude.com/en/articles/13345190-get-started-with-claude-cowork), task instructions, and permission to selected resources | +| Pricing | As of October 2026, the MIT-licensed software has no mandatory license fee; model and infrastructure charges depend on the operator’s choices | As of October 2026, [access follows Anthropic’s eligible paid Claude plans](https://support.claude.com/en/articles/13345190-get-started-with-claude-cowork) and their usage limits rather than a separate self-hosted license | +| Security model | The [operator controls](https://docs.openclaw.ai/gateway/security) the host, credentials, tools, network exposure, and optional isolation | Anthropic manages the service with [isolated execution modes and controls](https://support.claude.com/en/articles/14479288-claude-cowork-architecture-overview) | +| Scheduling | [Supports recurring jobs](https://docs.openclaw.ai/automation/cron-jobs/how-it-works) through its Gateway scheduler | [Supports recurring and on-demand scheduled tasks](https://support.claude.com/en/articles/13854387-schedule-recurring-tasks-in-claude-cowork) on eligible plans and surfaces | +| Customization | High; intended for builders willing to configure providers, channels, tools, and policies | Lower infrastructure burden, with [customization through task context, instructions, connectors, and plugins](https://claude.com/product/cowork/) | +| Best fit | Technical builders who want a persistent, self-operated assistant for one person or a shared team gateway | Individuals who want a managed agent for document and knowledge-work tasks | + +Neither product is primarily a shared visual workspace for centrally building, governing, and deploying agents across a team. Their overlap is strongest for individual builders who want an agent to act on files, tools, or recurring instructions. + +## Where do OpenClaw and Claude Cowork run, and how hard are they to set up? + +OpenClaw requires more setup because the operator manages the assistant environment, whereas Claude Cowork minimizes infrastructure work through a managed experience. + +### Where does OpenClaw run? + +OpenClaw runs on infrastructure controlled by its operator, which provides deployment flexibility but creates an ongoing administration obligation. + +The operator installs OpenClaw, selects and configures a model provider, stores credentials, and decides how the gateway can be reached. The [OpenClaw gateway](https://github.com/openclaw/openclaw) can then connect the assistant to supported communication channels and tools. A local installation does not automatically mean every task stays offline: prompts and data may still go to an external model or tool provider unless the operator deliberately selects local services. + +This design suits builders who are comfortable managing a daemon or server process and reviewing configuration. It also lets them decide whether the assistant should remain on one computer, run continuously on a separate machine, or sit behind private networking controls. + +### Where does Claude Cowork run? + +Claude Cowork [runs in managed cloud environments](https://support.claude.com/en/articles/14479288-claude-cowork-architecture-overview), making it faster to start but unsuitable for buyers who require a fully self-hosted agent stack. + +The account holder describes the task and grants Claude access to the files, folders, or tools needed to complete it. Cowork can plan several steps, work with those approved resources, and return completed outputs without requiring the account holder to deploy a gateway or maintain model infrastructure. + +The simpler setup comes with less control over deployment architecture. Organizations should evaluate Anthropic’s current privacy, retention, and administrative terms for their account type before using Cowork with sensitive information. + +## How do OpenClaw and Claude Cowork compare on pricing, security, and scheduling? + +OpenClaw makes cost and security the operator’s responsibility, while Claude Cowork packages those decisions into Anthropic’s product, plan, and security model. + +### How much do OpenClaw and Claude Cowork cost? + +OpenClaw has no mandatory software license fee, while Claude Cowork access follows Anthropic’s eligible paid Claude plans as of October 2026. + +OpenClaw’s total operating cost can include model API usage, the computer or server that keeps it running, storage, and the engineering time needed to maintain it. A low-volume local installation may cost little beyond model usage, but an always-on deployment with premium models can cost more. + +Anthropic’s [pricing page](https://claude.com/pricing) is the authoritative source for current Claude plan prices and usage allowances. Cowork usage can consume plan capacity, so buyers should compare the practical amount of agent work available under each eligible plan rather than treating subscription price as unlimited usage. + +### Is OpenClaw or Claude Cowork more secure? + +OpenClaw offers greater security control, while Claude Cowork offers a more managed isolation and permission model; neither is automatically safer in every deployment. + +OpenClaw can keep the gateway and related data within infrastructure chosen by the operator. That is valuable when the environment is correctly hardened, but an assistant with shell access, credentials, messaging channels, and untrusted content can create substantial risk. OpenClaw operators should follow the project’s [security guidance](https://docs.openclaw.ai/gateway/security), minimize tool permissions, restrict network exposure, isolate risky execution, and treat prompt injection as an operational threat. + +Claude Cowork limits access to approved resources and [isolates agentic work according to its execution mode](https://support.claude.com/en/articles/14479288-claude-cowork-architecture-overview). However, model requests still use Anthropic’s service, and approved files may contain malicious or misleading instructions. Buyers should review Anthropic’s current account-level data terms and avoid granting broader access than a task needs. + +### Can OpenClaw and Claude Cowork run scheduled tasks? + +OpenClaw and Claude Cowork can both handle scheduled work; OpenClaw gives the operator full control of the scheduler and host, while Cowork runs scheduled tasks in Anthropic’s cloud. + +OpenClaw provides a [Gateway scheduler for recurring jobs](https://docs.openclaw.ai/automation/cron-jobs/how-it-works) that should run without a new message. Reliability depends on keeping the OpenClaw Gateway available and on configuring credentials and notifications appropriately. + +Claude Cowork [supports scheduled tasks on eligible paid plans](https://support.claude.com/en/articles/13854387-schedule-recurring-tasks-in-claude-cowork) with hourly, daily, weekly, weekday, or manual cadences. Scheduled tasks run remotely, so they keep running when the computer is asleep or the Claude Desktop app is closed, but a task that needs local files or apps runs only on the device. OpenClaw suits builders who want to own the scheduler and host, while Cowork suits builders who want scheduling without running infrastructure. + +## Who should choose OpenClaw, Claude Cowork, or a team agent platform? + +OpenClaw is the stronger fit for technical builders who want a persistent self-hosted assistant, Claude Cowork is the stronger fit for managed individual work, and a team agent platform is better for shared ownership and governance. + +Choose **OpenClaw** when you want to: + +- Operate the assistant in an environment you control. +- Connect a persistent assistant to [messaging channels and tools](https://github.com/openclaw/openclaw). +- Choose model providers and deployment architecture. +- Configure [recurring jobs and proactive background behavior](https://docs.openclaw.ai/automation/cron-jobs/how-it-works). +- Accept responsibility for hardening, credentials, updates, and uptime. + +Choose **Claude Cowork** when you want to: + +- Start assigning [multi-step tasks with minimal setup](https://claude.com/product/cowork/). +- Work with files, folders, and tools you explicitly approve. +- Use [Anthropic’s managed Claude service](https://support.claude.com/en/articles/14479288-claude-cowork-architecture-overview) instead of operating model infrastructure. +- Avoid maintaining an assistant gateway or server. +- Keep the experience centered on an individual Claude account. + +Choose a team platform when agents need shared editing, deployment controls, reusable connections, run visibility, and governance across multiple people. [Sim, the open-source AI workspace for building, deploying, and managing AI agents](https://www.sim.ai/library/best-ai-agent-platforms-2026), fits teams that need those controls along with 270+ integrations; Sim’s core is Apache 2.0, while code in `apps/sim/ee` is governed by the separate [Sim Enterprise License](https://github.com/simstudioai/sim/blob/main/apps/sim/ee/LICENSE). If n8n is also on your shortlist, see the [n8n alternatives comparison](https://www.sim.ai/library/n8n-alternatives) for that separate buying decision. + +### What should you compare next? + +OpenClaw and Claude Cowork should also be compared with products built for the buyer’s specific deployment and collaboration requirements. + +- Read [6 Best OpenClaw Alternatives for Teams in 2026](https://www.sim.ai/library/best-openclaw-alternatives-for-teams-2026) if a self-operated gateway, which is one trust domain, does not provide enough shared control. +- Read [5 Best Claude Cowork Alternatives in 2026 for Shared and Scheduled AI Agents](https://www.sim.ai/library/best-claude-cowork-alternatives-2026) if Cowork’s managed model is too individual or constrained. diff --git a/apps/sim/ee/organization-usage/components/usage-consumers.tsx b/apps/sim/ee/organization-usage/components/usage-consumers.tsx index e013aca40d9..7261870c136 100644 --- a/apps/sim/ee/organization-usage/components/usage-consumers.tsx +++ b/apps/sim/ee/organization-usage/components/usage-consumers.tsx @@ -299,7 +299,7 @@ export function UsageConsumers({ row={row} info={ dimension === 'workspace' && !row.id - ? 'Usage without a workspace link, including organization-level activity and retained charges from permanently deleted workspaces. This view cannot distinguish between them.' + ? 'Includes organization-wide activity and charges from deleted workspaces.' : undefined } isMember={dimension === 'member'} diff --git a/apps/sim/ee/scim/TESTING.md b/apps/sim/ee/scim/TESTING.md index 3a12121a398..3abfe6d9d81 100644 --- a/apps/sim/ee/scim/TESTING.md +++ b/apps/sim/ee/scim/TESTING.md @@ -9,9 +9,10 @@ provisioning service. ## Requirements - Bun and the repository dependencies installed. -- A running local app configured for Enterprise SCIM, using a dedicated local +- A running local app configured for hosted Enterprise SCIM with billing enabled, using a dedicated local PostgreSQL database with all migrations applied (including `0325`). Leave Redis unconfigured so the app uses PostgreSQL for rate-limit storage. + For `next dev`, set `NEXT_PUBLIC_FORCE_HOSTED=true` and `BILLING_ENABLED=true`. - The app's local `BETTER_AUTH_SECRET`, at least 32 characters long. - An app URL using HTTP on `localhost`, `127.0.0.1`, or `::1`. The database must also use a loopback host, and its name must include `test` or `scim`. @@ -53,6 +54,8 @@ timeout. - Discovery, session-authenticated configuration, credential hashing, tenant isolation, bearer authentication, content type, and malformed JSON errors. +- Hosted Enterprise entitlement loss rejects both session-authenticated administration + and an existing bearer token; restoring the subscription restores both paths. - User and group creation, reads, replacement, PATCH, deletion, conflict errors, stable pagination, count-only queries, and group/member attribute projection. - Case-insensitive user lookup, external IDs, secondary/work/primary email @@ -78,10 +81,14 @@ timeout. The `e2e (scim)` job in `.github/workflows/checks.yml` provisions its own database through `db:migrate`, starts a local Next.js app -with hosted Enterprise configuration, and runs the HTTP suite above. It has its +with hosted Enterprise configuration, and runs the HTTP suite above. The production +app's public URL uses `scim-e2e.sim.ai`, mapped to loopback on that runner; the +tests and internal API requests still connect to `127.0.0.1`. Production ignores +`NEXT_PUBLIC_FORCE_HOSTED`, so setting that flag alone cannot provide hosted coverage. +It has its own database because the hosted app runs background usage replay against it. -Readiness is bounded to 300 seconds, since the first request cold-compiles the -app; the server is stopped when the step exits. A failure prints the server log +Readiness is bounded to 600 seconds for either production or local development +startup; the server is stopped when the step exits. A failure prints the server log tail and uploads the credential-free scenario report, an allowlist of HTTP status log lines, and the local app's server log. The CI app uses only fixture secrets. diff --git a/apps/sim/instrumentation-node.ts b/apps/sim/instrumentation-node.ts index d361721efba..1cad219a68f 100644 --- a/apps/sim/instrumentation-node.ts +++ b/apps/sim/instrumentation-node.ts @@ -15,7 +15,12 @@ import type { import { createLogger } from '@sim/logger' import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1' import { env } from './lib/core/config/env' -import { parseOtlpHeaders } from './lib/monitoring/otlp' +import { + ANONYMOUS_TELEMETRY_ENDPOINT, + isTelemetryDisabled, + normalizeOtlpTracesUrl, + resolveOtlpTarget, +} from './lib/monitoring/otlp' diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR) @@ -27,7 +32,7 @@ const SPAN_NAME_PREFIX = `${MOTHERSHIP_ORIGIN}: ` const SERVICE_INSTANCE_SLUG = 'sim' as const const DEFAULT_TELEMETRY_CONFIG = { - endpoint: env.TELEMETRY_ENDPOINT || 'https://telemetry.simstudio.ai/v1/traces', + endpoint: ANONYMOUS_TELEMETRY_ENDPOINT, serviceName: 'mothership', serviceVersion: '0.1.0', serverSide: { enabled: true }, @@ -49,21 +54,6 @@ function isBusinessSpan(spanName: string): boolean { return ALLOWED_SPAN_PREFIXES.some((prefix) => spanName.startsWith(prefix)) } -// Append `/v1/traces` to the OTLP base URL unless already present. -// The HTTP exporter doesn't auto-suffix the signal path even though -// the spec says the env var is a base URL. -function normalizeOtlpTracesUrl(url: string): string { - if (!url) return url - try { - const u = new URL(url) - if (u.pathname.endsWith('/v1/traces')) return url - const base = url.replace(/\/$/, '') - return `${base}/v1/traces` - } catch { - return url - } -} - // Metrics counterpart to `normalizeOtlpTracesUrl`. Operates on the parsed // pathname (not a raw string suffix) so query strings and trailing slashes // don't corrupt the result: swap a `/v1/traces` suffix for `/v1/metrics`, @@ -151,7 +141,7 @@ class MothershipOriginSpanProcessor implements SpanProcessor { async function initializeOpenTelemetry() { try { - if (env.NEXT_TELEMETRY_DISABLED === '1' || process.env.NEXT_TELEMETRY_DISABLED === '1') { + if (isTelemetryDisabled()) { logger.info('OpenTelemetry disabled via NEXT_TELEMETRY_DISABLED=1') return } @@ -163,15 +153,10 @@ async function initializeOpenTelemetry() { telemetryConfig = DEFAULT_TELEMETRY_CONFIG } - // Prefer the OTel spec env var, fall back to legacy TELEMETRY_ENDPOINT. - const resolvedEndpoint = - process.env.OTEL_EXPORTER_OTLP_ENDPOINT || - process.env.TELEMETRY_ENDPOINT || - env.TELEMETRY_ENDPOINT || - telemetryConfig.endpoint + const target = resolveOtlpTarget(telemetryConfig.endpoint) telemetryConfig = { ...telemetryConfig, - endpoint: resolvedEndpoint, + endpoint: target.endpoint, serviceName: 'mothership', } @@ -244,7 +229,7 @@ async function initializeOpenTelemetry() { }, }) - const otlpHeaders = parseOtlpHeaders(process.env.OTEL_EXPORTER_OTLP_HEADERS || '') + const otlpHeaders = target.headers const exporterUrl = normalizeOtlpTracesUrl(telemetryConfig.endpoint) const exporter = new OTLPTraceExporter({ @@ -279,28 +264,33 @@ async function initializeOpenTelemetry() { // Metrics (hosted-key counters/histograms) share the trace endpoint and // headers — only the signal path differs. Unlike spans these aren't sampled. - const metricReader = new PeriodicExportingMetricReader({ - exporter: new OTLPMetricExporter({ - url: normalizeOtlpMetricsUrl(telemetryConfig.endpoint), - headers: otlpHeaders, - timeoutMillis: Math.min(telemetryConfig.batchSettings.exportTimeoutMillis, 10000), - keepAlive: false, - }), - exportIntervalMillis: 60000, - }) + // Neither metrics nor logs go to the anonymous collector, which takes traces only. + const metricReader = target.anonymous + ? undefined + : new PeriodicExportingMetricReader({ + exporter: new OTLPMetricExporter({ + url: normalizeOtlpMetricsUrl(telemetryConfig.endpoint), + headers: otlpHeaders, + timeoutMillis: Math.min(telemetryConfig.batchSettings.exportTimeoutMillis, 10000), + keepAlive: false, + }), + exportIntervalMillis: 60000, + }) // Logs share the trace endpoint and headers as well (signal path // /v1/logs). Every @sim/logger line fans out through the global Logs API // (see packages/logger), which the NodeSDK wires to this processor — the // stdout JSON lines continue to CloudWatch unchanged. - const logRecordProcessor = new BatchLogRecordProcessor({ - exporter: new OTLPLogExporter({ - url: normalizeOtlpLogsUrl(telemetryConfig.endpoint), - headers: otlpHeaders, - timeoutMillis: Math.min(telemetryConfig.batchSettings.exportTimeoutMillis, 10000), - keepAlive: false, - }), - }) + const logRecordProcessor = target.anonymous + ? undefined + : new BatchLogRecordProcessor({ + exporter: new OTLPLogExporter({ + url: normalizeOtlpLogsUrl(telemetryConfig.endpoint), + headers: otlpHeaders, + timeoutMillis: Math.min(telemetryConfig.batchSettings.exportTimeoutMillis, 10000), + keepAlive: false, + }), + }) // Must be unique per process: replicas sharing one instance id collapse // into a single Prometheus series, so their independent cumulative @@ -350,8 +340,9 @@ async function initializeOpenTelemetry() { resource, spanProcessors, sampler, - metricReader, - logRecordProcessors: [logRecordProcessor], + // Explicit empty lists: left undefined, NodeSDK builds default OTLP exporters from env. + metricReaders: metricReader ? [metricReader] : [], + logRecordProcessors: logRecordProcessor ? [logRecordProcessor] : [], }) sdk.start() @@ -403,6 +394,9 @@ export async function register() { const { startMemoryTelemetry } = await import('./lib/monitoring/memory-telemetry') startMemoryTelemetry() + const { startEventLoopTelemetry } = await import('@/lib/monitoring/event-loop-telemetry') + startEventLoopTelemetry() + // Not awaited: the connection is warmed in the background so the first request // that needs Redis does not pay the handshake inside its own command deadline, // but boot never waits on Redis to serve requests that do not touch it. diff --git a/apps/sim/lib/api/contracts/logs.ts b/apps/sim/lib/api/contracts/logs.ts index a9a8d37a04f..0c85e989a31 100644 --- a/apps/sim/lib/api/contracts/logs.ts +++ b/apps/sim/lib/api/contracts/logs.ts @@ -218,6 +218,7 @@ export type LogTraceSpan = { tokens?: number | { total?: number; input?: number; output?: number } cost?: { total?: number; input?: number; output?: number; toolCost?: number } relativeStartMs?: number + contentWithheld?: true toolCalls?: Array> children?: LogTraceSpan[] } @@ -273,6 +274,12 @@ export const traceSpanSchema: z.ZodType = z .number() .describe('Offset from the root span in milliseconds.') .optional(), + contentWithheld: z + .literal(true) + .describe( + "Present when the log projection withheld some or all of this span's content (input, output, thinking, error message, tool-call or provider-segment content) because it could not be proven safe to display. Status, timing, and usage remain. A withheld content field is omitted whole, never a key inside it: a content field absent from a span carrying this marker may exist on the run but was not returned, while a key missing inside a content field that is present is genuinely absent." + ) + .optional(), toolCalls: z.array(toolCallSchema).describe('Tool calls recorded by the span.').optional(), children: z.array(traceSpanSchema).describe('Nested child trace spans.').optional(), }) diff --git a/apps/sim/lib/api/contracts/v2/knowledge.ts b/apps/sim/lib/api/contracts/v2/knowledge.ts index 185ec13cb60..2aab9f6129c 100644 --- a/apps/sim/lib/api/contracts/v2/knowledge.ts +++ b/apps/sim/lib/api/contracts/v2/knowledge.ts @@ -44,6 +44,7 @@ import { v2TimestampSchema, } from '@/lib/api/contracts/v2/shared' import { + v2OptionalUploadTokenHeadersSchema, v2PartUrlsBodySchema, v2PartUrlsDataSchema, v2UploadStatusSchema, @@ -63,7 +64,10 @@ import { KNOWLEDGE_DOCUMENT_UPLOAD_RECIPES, knowledgeDocumentUploadMetadataSchema, } from '@/lib/knowledge/upload-metadata' -import { MAX_KNOWLEDGE_DOCUMENT_FILE_SIZE } from '@/lib/uploads/shared/types' +import { + MAX_KNOWLEDGE_DOCUMENT_FILE_SIZE, + MAX_WORKSPACE_FILE_SIZE, +} from '@/lib/uploads/shared/types' /** * v2 knowledge contracts. @@ -803,6 +807,206 @@ export const v2ExportKnowledgeBaseContract = defineRouteContract({ response: { mode: 'binary' }, }) +const v2KnowledgeImportParamsSchema = z.object({ + importId: z.string().min(1).describe('Unique knowledge-base import identifier.'), +}) + +const v2KnowledgeImportWorkspaceQuerySchema = z + .object({ + workspaceId: workspaceIdSchema.describe('Workspace that owns the import.'), + }) + .strict() + +const v2KnowledgeImportOptionalUploadTokenHeadersSchema = v2OptionalUploadTokenHeadersSchema.extend( + { + 'upload-token': v2OptionalUploadTokenHeadersSchema.shape['upload-token'].describe( + 'Signed upload control token returned when the import was created; required to read or cancel the import before its upload completes.' + ), + } +) + +const v2KnowledgeImportSourceSchema = z + .object({ + type: z.literal('upload').describe('Upload-backed import discriminator.'), + name: z + .string() + .trim() + .min(1, 'name is required') + .max(255) + .describe('Bundle filename, as produced by a knowledge base export.'), + contentType: z + .string() + .trim() + .min(1, 'contentType is required') + .max(255) + .describe('Bundle MIME type, normally application/zip.'), + size: z + .number() + .int() + .min(1) + .max(MAX_WORKSPACE_FILE_SIZE) + .describe('Exact bundle size in bytes; the maximum is 5 GiB.'), + }) + .strict() + .meta({ + id: 'V2KnowledgeImportSource', + title: 'Knowledge base import source', + description: 'Bundle archive uploaded through signed transfer instructions.', + }) + +const v2CreateKnowledgeImportBodySchema = z + .object({ + workspaceId: workspaceIdSchema.describe('Workspace in which to create the knowledge base.'), + name: v1CreateKnowledgeBaseBodySchema.shape.name + .optional() + .describe("Name for the new knowledge base; defaults to the bundle's own name.") + .meta({ examples: ['Product Documentation'] }), + source: v2KnowledgeImportSourceSchema, + }) + .strict() +export type V2CreateKnowledgeImportBody = z.input + +/** + * `uploading` until the archive's upload completes, then `processing` while the + * base and its documents are created. There is no `queued`: the durable record + * is written as the runner is dispatched. + */ +const v2KnowledgeImportStatusSchema = z.enum([ + 'uploading', + 'processing', + 'completed', + 'failed', + 'canceled', + 'expired', +]) +export type V2KnowledgeImportStatus = z.output + +const v2KnowledgeImportFailureSchema = z + .object({ + filename: z.string().describe('Filename of the document that was not imported.'), + message: z.string().describe('Why the document was not imported.'), + }) + .strict() + .meta({ + id: 'V2KnowledgeImportFailure', + title: 'Knowledge import failure', + description: 'One bundle document the import could not bring over.', + }) + +const v2KnowledgeImportSchema = z + .object({ + id: z.string().describe('Unique knowledge-base import identifier.'), + workspaceId: z.string().describe('Workspace that owns the import.'), + status: v2KnowledgeImportStatusSchema.describe('Current import lifecycle state.'), + knowledgeBaseId: z + .string() + .nullable() + .describe('Knowledge base the import created, or null until it exists.'), + documentsTotal: z + .number() + .int() + .nonnegative() + .describe('Documents the bundle carries; zero until its manifest has been read.'), + documentsImported: z + .number() + .int() + .nonnegative() + .describe( + 'Documents created so far. A document whose vectors could not be reused is indexed afterwards, as an upload is, so it may still be processing in the knowledge base.' + ), + documentsFailed: z + .number() + .int() + .nonnegative() + .describe('Documents that could not be imported. Non-zero still allows `completed`.'), + vectorsReused: z + .boolean() + .describe( + "Whether the bundle's vectors matched this deployment's embedding model and were stored without re-embedding." + ), + failures: z + .array(v2KnowledgeImportFailureSchema) + .describe('Bounded sample of the documents that could not be imported.'), + error: z.string().nullable().describe('Terminal failure reason, or null.'), + createdAt: v2TimestampSchema.describe('ISO 8601 creation timestamp.'), + updatedAt: v2TimestampSchema.describe('ISO 8601 last-update timestamp.'), + completedAt: v2TimestampSchema.nullable().describe('ISO 8601 completion timestamp, or null.'), + }) + .meta({ + id: 'V2KnowledgeImport', + title: 'Knowledge base import', + description: 'Durable lifecycle resource for importing a knowledge base bundle.', + }) +export type V2KnowledgeImport = z.output + +const v2CreateKnowledgeImportDataSchema = z + .object({ + session: v2KnowledgeImportSchema.describe('Created import, waiting for its upload.'), + uploadToken: z.string().min(1).describe('Signed token for upload control requests.'), + transfer: v2UploadTransferSchema.describe('Signed bundle upload instructions.'), + }) + .strict() + .meta({ + id: 'V2CreateKnowledgeImportData', + title: 'Create knowledge base import data', + description: 'Created import and the instructions for uploading its bundle.', + }) +export type V2CreateKnowledgeImportData = z.output + +export const v2CreateKnowledgeImportContract = defineRouteContract({ + method: 'POST', + path: '/api/v2/knowledge/imports', + query: noInputSchema, + body: v2CreateKnowledgeImportBodySchema, + response: { + mode: 'json', + schema: v2DataResponse(v2CreateKnowledgeImportDataSchema), + status: 201, + }, +}) + +/** + * Reads an import in any of its states. The optional upload token makes the + * upload phase readable: the durable record is written only once the upload + * completes, so without it the id the 201 returned would 404 until then. + */ +export const v2GetKnowledgeImportContract = defineRouteContract({ + method: 'GET', + path: '/api/v2/knowledge/imports/[importId]', + params: v2KnowledgeImportParamsSchema, + query: v2KnowledgeImportWorkspaceQuerySchema, + headers: v2KnowledgeImportOptionalUploadTokenHeadersSchema, + response: { mode: 'json', schema: v2DataResponse(v2KnowledgeImportSchema) }, +}) + +export const v2CancelKnowledgeImportContract = defineRouteContract({ + method: 'DELETE', + path: '/api/v2/knowledge/imports/[importId]', + params: v2KnowledgeImportParamsSchema, + query: v2KnowledgeImportWorkspaceQuerySchema, + headers: v2KnowledgeImportOptionalUploadTokenHeadersSchema, + response: { mode: 'json', schema: v2DataResponse(v2KnowledgeImportSchema) }, +}) + +export const v2CreateKnowledgeImportPartUrlsContract = defineRouteContract({ + method: 'POST', + path: '/api/v2/knowledge/imports/[importId]/parts', + params: v2KnowledgeImportParamsSchema, + query: v2KnowledgeImportWorkspaceQuerySchema, + headers: v2UploadTokenHeadersSchema, + body: v2PartUrlsBodySchema, + response: { mode: 'json', schema: v2DataResponse(v2PartUrlsDataSchema) }, +}) + +export const v2CompleteKnowledgeImportContract = defineRouteContract({ + method: 'POST', + path: '/api/v2/knowledge/imports/[importId]/complete', + params: v2KnowledgeImportParamsSchema, + query: v2KnowledgeImportWorkspaceQuerySchema, + headers: v2UploadTokenHeadersSchema, + response: { mode: 'json', schema: v2DataResponse(v2KnowledgeImportSchema) }, +}) + /** * PATCH, not PUT: every mutable field is optional and a `superRefine` requires * at least one, so this is a partial update rather than a replacement. diff --git a/apps/sim/lib/api/contracts/v2/logs.ts b/apps/sim/lib/api/contracts/v2/logs.ts index 447ba629afb..f5847eac519 100644 --- a/apps/sim/lib/api/contracts/v2/logs.ts +++ b/apps/sim/lib/api/contracts/v2/logs.ts @@ -20,6 +20,7 @@ import { v2TimestampSchema, } from '@/lib/api/contracts/v2/shared' import { v2RunFileSchema } from '@/lib/api/contracts/v2/workflows' +import { MATERIALIZE_CONCURRENCY } from '@/lib/core/utils/concurrency' import { PERSISTED_WORKFLOW_EXECUTION_STATUSES } from '@/lib/logs/types' /** @@ -594,7 +595,7 @@ export const v2ListLogsQuerySchema = v1ListLogsQuerySchema max: 1000, fallback: 100, outOfRange: 'clamp', - description: 'Maximum log entries per page.', + description: `Maximum log entries per page. When execution data is returned (\`includeTraceSpans\` or \`includeFinalOutput\`), a page holds at most ${MATERIALIZE_CONCURRENCY} entries, and fewer when their stored traces are large; follow \`nextCursor\` for the rest. A page whose execution data is withheld by permissions is not capped.`, }), ...v2LogSortFieldSchemas, /** diff --git a/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts b/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts index 25ceaba8ac4..0b1b09e43c9 100644 --- a/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts +++ b/apps/sim/lib/api/contracts/v2/openapi/knowledge.ts @@ -2,12 +2,16 @@ import { v2AbortKnowledgeDocumentUploadContract, v2AddWorkspaceFilesToKnowledgeBaseContract, v2BulkUpdateKnowledgeDocumentsContract, + v2CancelKnowledgeImportContract, v2CompleteKnowledgeDocumentUploadContract, + v2CompleteKnowledgeImportContract, v2CreateKnowledgeBaseContract, v2CreateKnowledgeConnectorContract, v2CreateKnowledgeDocumentUploadContract, v2CreateKnowledgeDocumentUploadPartUrlsContract, v2CreateKnowledgeFolderContract, + v2CreateKnowledgeImportContract, + v2CreateKnowledgeImportPartUrlsContract, v2DeleteKnowledgeBaseContract, v2DeleteKnowledgeConnectorContract, v2DeleteKnowledgeDocumentContract, @@ -16,6 +20,7 @@ import { v2GetKnowledgeBaseContract, v2GetKnowledgeConnectorContract, v2GetKnowledgeDocumentContract, + v2GetKnowledgeImportContract, v2ListKnowledgeBasesContract, v2ListKnowledgeConnectorDocumentsContract, v2ListKnowledgeConnectorsContract, @@ -67,6 +72,7 @@ import { MAX_KNOWLEDGE_BUNDLE_DOCUMENTS } from '@/lib/knowledge/constants' const WORKSPACE_ID = 'a91c4b2e-6d3f-4e8a-b5c7-0d9e2f1a8c64' const KNOWLEDGE_BASE_ID = '7c9e6679-7425-40de-944b-e07fc1f90ae7' const KNOWLEDGE_CONNECTOR_ID = 'kc-9f8e7d6c' +const KNOWLEDGE_IMPORT_ID = '5e8a2c4f-1d7b-4396-a0e3-8f6b2d9c1a47' const KNOWLEDGE_CONNECTOR_EXAMPLE = { id: KNOWLEDGE_CONNECTOR_ID, @@ -232,6 +238,205 @@ const declaredRoutes = [ ), } ), + defineOpenApiRoute( + v2CreateKnowledgeImportContract, + knowledgeOperation({ + applicationOperation: knowledgeOperations.importCreate, + operationId: 'createKnowledgeImport', + summary: 'Create knowledge base import', + description: + 'Start importing a knowledge base bundle produced by an export. The response carries signed transfer instructions for the archive; once its bytes are uploaded, complete the import to create the knowledge base. Bundles must be `.zip` archives of at most 5 GiB.', + errors: [...WORKSPACE_ERRORS, 'NotFound', 'PayloadTooLarge', 'UsageLimitExceeded'], + success: { description: 'The created import and its upload instructions.' }, + }), + { + query: v2CreateKnowledgeImportContract.query, + body: documentedSchema( + v2CreateKnowledgeImportContract.body, + 'CreateKnowledgeImportRequest', + 'Create knowledge base import request', + 'Workspace, bundle archive, and an optional name for the new knowledge base.', + [ + { + workspaceId: WORKSPACE_ID, + name: 'Product Documentation', + source: { + type: 'upload', + name: 'product-documentation.simkb.zip', + contentType: 'application/zip', + size: 7340032, + }, + }, + ] + ), + response: documentedSchema( + v2CreateKnowledgeImportContract.response.schema, + 'V2CreateKnowledgeImportResponse', + 'Create knowledge base import response', + 'The import and the instructions for uploading its bundle.' + ), + } + ), + defineOpenApiRoute( + v2GetKnowledgeImportContract, + knowledgeOperation({ + applicationOperation: knowledgeOperations.importRead, + operationId: 'getKnowledgeImport', + summary: 'Get knowledge base import', + description: + "Get an import's progress and outcome. During `uploading`, the signed upload token is required; omitting it returns `404`.", + errors: RESOURCE_ERRORS, + success: { description: 'The requested knowledge base import.' }, + }), + { + params: documentedSchema( + v2GetKnowledgeImportContract.params, + 'GetKnowledgeImportParams', + 'Get knowledge base import path parameters', + 'Import selected for retrieval.', + [{ importId: KNOWLEDGE_IMPORT_ID }] + ), + query: documentedSchema( + v2GetKnowledgeImportContract.query, + 'GetKnowledgeImportQuery', + 'Get knowledge base import query', + 'Workspace scope for the import.' + ), + headers: documentedSchema( + v2GetKnowledgeImportContract.headers, + 'GetKnowledgeImportHeaders', + 'Get knowledge base import headers', + 'Optional signed upload control token for the import.' + ), + response: documentedSchema( + v2GetKnowledgeImportContract.response.schema, + 'V2KnowledgeImportResponse', + 'Knowledge base import response', + 'A knowledge base import lifecycle resource.' + ), + } + ), + defineOpenApiRoute( + v2CancelKnowledgeImportContract, + knowledgeOperation({ + applicationOperation: knowledgeOperations.importCancel, + operationId: 'cancelKnowledgeImport', + summary: 'Cancel knowledge base import', + description: + 'Cancel an import. During its upload the transfer is aborted; while processing, it stops after the document in flight and the documents already imported stay in the new knowledge base. Settled imports return `409`.', + errors: RESOURCE_CONFLICT_ERRORS, + success: { description: 'The canceled knowledge base import.' }, + }), + { + params: documentedSchema( + v2CancelKnowledgeImportContract.params, + 'CancelKnowledgeImportParams', + 'Cancel knowledge base import path parameters', + 'Import selected for cancellation.' + ), + query: documentedSchema( + v2CancelKnowledgeImportContract.query, + 'CancelKnowledgeImportQuery', + 'Cancel knowledge base import query', + 'Workspace scope for the import.' + ), + headers: documentedSchema( + v2CancelKnowledgeImportContract.headers, + 'CancelKnowledgeImportHeaders', + 'Cancel knowledge base import headers', + 'Optional signed upload control token for the import.' + ), + response: documentedSchema( + v2CancelKnowledgeImportContract.response.schema, + 'V2CancelKnowledgeImportResponse', + 'Cancel knowledge base import response', + 'The canceled knowledge base import.' + ), + } + ), + defineOpenApiRoute( + v2CreateKnowledgeImportPartUrlsContract, + knowledgeOperation({ + applicationOperation: knowledgeOperations.importParts, + operationId: 'createKnowledgeImportPartUrls', + summary: 'Create knowledge base import part URLs', + description: + 'Create signed URLs for multipart bundle upload parts. Requires the `uploading` state; other states return `409`.', + errors: RESOURCE_CONFLICT_ERRORS, + success: { description: 'The signed multipart upload URLs.' }, + }), + { + params: documentedSchema( + v2CreateKnowledgeImportPartUrlsContract.params, + 'CreateKnowledgeImportPartUrlsParams', + 'Create knowledge base import part URLs path parameters', + 'Import receiving uploaded parts.' + ), + query: documentedSchema( + v2CreateKnowledgeImportPartUrlsContract.query, + 'CreateKnowledgeImportPartUrlsQuery', + 'Create knowledge base import part URLs query', + 'Workspace scope for the import.' + ), + headers: documentedSchema( + v2CreateKnowledgeImportPartUrlsContract.headers, + 'CreateKnowledgeImportPartUrlsHeaders', + 'Create knowledge base import part URLs headers', + 'Signed upload control token for the import.' + ), + body: documentedSchema( + v2CreateKnowledgeImportPartUrlsContract.body, + 'CreateKnowledgeImportPartUrlsRequest', + 'Create knowledge base import part URLs request', + 'Multipart part numbers for which signed URLs should be created.', + [{ partNumbers: [1, 2, 3] }] + ), + response: documentedSchema( + v2CreateKnowledgeImportPartUrlsContract.response.schema, + 'V2CreateKnowledgeImportPartUrlsResponse', + 'Create knowledge base import part URLs response', + 'Signed URLs and required headers for each requested upload part.' + ), + } + ), + defineOpenApiRoute( + v2CompleteKnowledgeImportContract, + knowledgeOperation({ + applicationOperation: knowledgeOperations.importComplete, + operationId: 'completeKnowledgeImport', + summary: 'Complete knowledge base import upload', + description: + "Verify the uploaded bundle and start creating the knowledge base under the same import ID. Vectors are reused when the bundle was embedded with this deployment's model; otherwise documents are re-indexed. Completion records an audit event. Repeating it returns the running import.", + errors: [...RESOURCE_CONFLICT_ERRORS, 'UsageLimitExceeded'], + success: { description: 'The knowledge base import after its upload completed.' }, + }), + { + params: documentedSchema( + v2CompleteKnowledgeImportContract.params, + 'CompleteKnowledgeImportParams', + 'Complete knowledge base import path parameters', + 'Import whose upload should be completed.' + ), + query: documentedSchema( + v2CompleteKnowledgeImportContract.query, + 'CompleteKnowledgeImportQuery', + 'Complete knowledge base import query', + 'Workspace scope for the import.' + ), + headers: documentedSchema( + v2CompleteKnowledgeImportContract.headers, + 'CompleteKnowledgeImportHeaders', + 'Complete knowledge base import headers', + 'Signed upload control token for the import.' + ), + response: documentedSchema( + v2CompleteKnowledgeImportContract.response.schema, + 'V2CompleteKnowledgeImportResponse', + 'Complete knowledge base import response', + 'The import lifecycle resource once processing has started.' + ), + } + ), defineOpenApiRoute( v2UpdateKnowledgeBaseContract, knowledgeOperation({ diff --git a/apps/sim/lib/api/mcp/generated/v2-operations.ts b/apps/sim/lib/api/mcp/generated/v2-operations.ts index 4c274046247..f56b0e612f6 100644 --- a/apps/sim/lib/api/mcp/generated/v2-operations.ts +++ b/apps/sim/lib/api/mcp/generated/v2-operations.ts @@ -97,12 +97,16 @@ import { v2AbortKnowledgeDocumentUploadContract, v2AddWorkspaceFilesToKnowledgeBaseContract, v2BulkUpdateKnowledgeDocumentsContract, + v2CancelKnowledgeImportContract, v2CompleteKnowledgeDocumentUploadContract, + v2CompleteKnowledgeImportContract, v2CreateKnowledgeBaseContract, v2CreateKnowledgeConnectorContract, v2CreateKnowledgeDocumentUploadContract, v2CreateKnowledgeDocumentUploadPartUrlsContract, v2CreateKnowledgeFolderContract, + v2CreateKnowledgeImportContract, + v2CreateKnowledgeImportPartUrlsContract, v2DeleteKnowledgeBaseContract, v2DeleteKnowledgeConnectorContract, v2DeleteKnowledgeDocumentContract, @@ -110,6 +114,7 @@ import { v2GetKnowledgeBaseContract, v2GetKnowledgeConnectorContract, v2GetKnowledgeDocumentContract, + v2GetKnowledgeImportContract, v2ListKnowledgeBasesContract, v2ListKnowledgeConnectorDocumentsContract, v2ListKnowledgeConnectorsContract, @@ -512,6 +517,14 @@ export const V2_MCP_OPERATIONS = { handler: () => import('@/app/api/v2/tables/[tableId]/rows/bulk-update/route').then((route) => route.POST), }, + cancelKnowledgeImport: { + contract: v2CancelKnowledgeImportContract, + summary: 'Cancel knowledge base import', + description: + 'Cancel an import. During its upload the transfer is aborted; while processing, it stops after the document in flight and the documents already imported stay in the new knowledge base. Settled imports return `409`.\n\nOAuth scope: `api:write`.', + handler: () => + import('@/app/api/v2/knowledge/imports/[importId]/route').then((route) => route.DELETE), + }, cancelOrganizationAccessRequest: { contract: v2CancelOrganizationAccessRequestContract, summary: 'Cancel organization access request', @@ -611,6 +624,16 @@ export const V2_MCP_OPERATIONS = { '@/app/api/v2/knowledge/[knowledgeBaseId]/documents/uploads/[uploadId]/complete/route' ).then((route) => route.POST), }, + completeKnowledgeImport: { + contract: v2CompleteKnowledgeImportContract, + summary: 'Complete knowledge base import upload', + description: + "Verify the uploaded bundle and start creating the knowledge base under the same import ID. Vectors are reused when the bundle was embedded with this deployment's model; otherwise documents are re-indexed. Completion records an audit event. Repeating it returns the running import.\n\nOAuth scope: `api:write`.", + handler: () => + import('@/app/api/v2/knowledge/imports/[importId]/complete/route').then( + (route) => route.POST + ), + }, completeTableImport: { contract: v2CompleteTableImportContract, summary: 'Complete table import upload', @@ -718,6 +741,21 @@ export const V2_MCP_OPERATIONS = { 'Create a folder in the knowledge-base folder tree. Workspace folder trees exceeding 10,000 folders return `413`.\n\nOAuth scope: `api:write`.', handler: () => import('@/app/api/v2/knowledge/folders/route').then((route) => route.POST), }, + createKnowledgeImport: { + contract: v2CreateKnowledgeImportContract, + summary: 'Create knowledge base import', + description: + 'Start importing a knowledge base bundle produced by an export. The response carries signed transfer instructions for the archive; once its bytes are uploaded, complete the import to create the knowledge base. Bundles must be `.zip` archives of at most 5 GiB.\n\nOAuth scope: `api:write`.', + handler: () => import('@/app/api/v2/knowledge/imports/route').then((route) => route.POST), + }, + createKnowledgeImportPartUrls: { + contract: v2CreateKnowledgeImportPartUrlsContract, + summary: 'Create knowledge base import part URLs', + description: + 'Create signed URLs for multipart bundle upload parts. Requires the `uploading` state; other states return `409`.\n\nOAuth scope: `api:write`.', + handler: () => + import('@/app/api/v2/knowledge/imports/[importId]/parts/route').then((route) => route.POST), + }, createKnowledgeTag: { contract: v2CreateKnowledgeTagContract, summary: 'Create tag', @@ -1328,6 +1366,14 @@ export const V2_MCP_OPERATIONS = { (route) => route.GET ), }, + getKnowledgeImport: { + contract: v2GetKnowledgeImportContract, + summary: 'Get knowledge base import', + description: + "Get an import's progress and outcome. During `uploading`, the signed upload token is required; omitting it returns `404`.\n\nOAuth scope: `api:read`.", + handler: () => + import('@/app/api/v2/knowledge/imports/[importId]/route').then((route) => route.GET), + }, getLog: { contract: v2GetLogContract, summary: 'Get log', diff --git a/apps/sim/lib/api/server/routes/v2-route-table.generated.ts b/apps/sim/lib/api/server/routes/v2-route-table.generated.ts index 173f838e7fc..97242c2b333 100644 --- a/apps/sim/lib/api/server/routes/v2-route-table.generated.ts +++ b/apps/sim/lib/api/server/routes/v2-route-table.generated.ts @@ -274,6 +274,22 @@ export const V2_ROUTES: readonly V2RouteEntry[] = [ pattern: '/api/v2/knowledge/folders', load: () => import('@/app/api/v2/knowledge/folders/route'), }, + { + pattern: '/api/v2/knowledge/imports', + load: () => import('@/app/api/v2/knowledge/imports/route'), + }, + { + pattern: '/api/v2/knowledge/imports/{importId}', + load: () => import('@/app/api/v2/knowledge/imports/[importId]/route'), + }, + { + pattern: '/api/v2/knowledge/imports/{importId}/complete', + load: () => import('@/app/api/v2/knowledge/imports/[importId]/complete/route'), + }, + { + pattern: '/api/v2/knowledge/imports/{importId}/parts', + load: () => import('@/app/api/v2/knowledge/imports/[importId]/parts/route'), + }, { pattern: '/api/v2/knowledge/search', load: () => import('@/app/api/v2/knowledge/search/route'), diff --git a/apps/sim/lib/block-metadata/names.generated.ts b/apps/sim/lib/block-metadata/names.generated.ts index 39869f8cb0b..de08e09baf6 100644 --- a/apps/sim/lib/block-metadata/names.generated.ts +++ b/apps/sim/lib/block-metadata/names.generated.ts @@ -72,6 +72,7 @@ export const BLOCK_NAMES: Readonly> = { duckduckgo: 'DuckDuckGo', dynamodb: 'Amazon DynamoDB', dynatrace: 'Dynatrace', + ec2: 'Amazon EC2', elasticsearch: 'Elasticsearch', elevenlabs: 'ElevenLabs', emailbison: 'Email Bison', diff --git a/apps/sim/lib/core/application/authorized-workspace-use-case.ts b/apps/sim/lib/core/application/authorized-workspace-use-case.ts index 233c51e9d74..618f0d2fc62 100644 --- a/apps/sim/lib/core/application/authorized-workspace-use-case.ts +++ b/apps/sim/lib/core/application/authorized-workspace-use-case.ts @@ -1,6 +1,12 @@ -import { type AuditActionType, type AuditResourceTypeValue, recordAudit } from '@sim/audit' +import { + type AuditActionType, + type AuditResourceTypeValue, + recordAudit, + recordAuditOnce, +} from '@sim/audit' import type { Principal, PrincipalAuditAttribution } from '@sim/auth/principal' import { resolvePrincipalAuditAttribution } from '@sim/auth/principal' +import { createLogger } from '@sim/logger' import { runDeclaredContentOperation } from '@/lib/core/application/content-delivery' import type { ApplicationOperation, OperationUseCase } from '@/lib/core/application/operation' import { @@ -18,6 +24,8 @@ import { runWithOutboundOrganization } from '@/lib/core/network/context.server' import type { OrchestrationRequestContext } from '@/lib/core/orchestration/types' import type { ResourcePolicyBinding } from '@/lib/resource-policies/registry' +const logger = createLogger('WorkspaceUseCaseAudit') + export interface WorkspaceUseCaseAuditEntry { /** Canonical affected workspace; null keeps an organization event outside the authorization workspace. */ workspaceId?: string | null @@ -27,6 +35,11 @@ export interface WorkspaceUseCaseAuditEntry { resourceName?: string description?: string metadata?: Record + /** + * Records the entry at most once for this key, for an operation a caller may + * retry after losing its response: each retry projects the same entry again. + */ + idempotencyKey?: string } export interface AuthorizedWorkspaceUseCaseContext< @@ -106,8 +119,8 @@ export function recordProjectedUseCaseAuditEntries( organizationId?: string ): void { const attribution: PrincipalAuditAttribution = resolvePrincipalAuditAttribution(principal) - for (const entry of entries) { - recordAudit({ + for (const { idempotencyKey, ...entry } of entries) { + const params = { workspaceId: entry.workspaceId === undefined ? workspaceId : entry.workspaceId, actorId: attribution.actorId, actorName: attribution.actorName, @@ -123,6 +136,13 @@ export function recordProjectedUseCaseAuditEntries( actor: attribution.actor, }, request, + } + if (!idempotencyKey) { + recordAudit(params) + continue + } + recordAuditOnce(idempotencyKey, params).catch((error) => { + logger.error('Failed to record audit log', { error, action: params.action }) }) } } diff --git a/apps/sim/lib/core/async-jobs/background-task.ts b/apps/sim/lib/core/async-jobs/background-task.ts new file mode 100644 index 00000000000..9ffa0882eca --- /dev/null +++ b/apps/sim/lib/core/async-jobs/background-task.ts @@ -0,0 +1,32 @@ +import type { AnyTask, TaskIdentifier, TaskPayload, TriggerOptions } from '@trigger.dev/sdk' +import { isTriggerDevEnabled } from '@/lib/core/config/env-flags' +import { runDetached } from '@/lib/core/utils/background' + +/** + * Starts one run of a background task: on Trigger.dev, in the region the + * deployment routes to, when Trigger.dev is enabled; otherwise detached in this + * process through the runner the task wraps. A caller names its task by type + * alone (`import type`), and the SDK loads only on the Trigger.dev path, so + * neither enters the caller's static import graph. + */ +export async function dispatchBackgroundTask( + id: TaskIdentifier, + payload: TaskPayload, + options: { + runInProcess: (payload: TaskPayload) => Promise + trigger?: Omit + } +): Promise { + if (!isTriggerDevEnabled) { + runDetached(id, () => options.runInProcess(payload)) + return + } + const [{ tasks }, { resolveTriggerRegion }] = await Promise.all([ + import('@trigger.dev/sdk'), + import('@/lib/core/async-jobs/region'), + ]) + await tasks.trigger(id, payload, { + ...options.trigger, + region: await resolveTriggerRegion(), + }) +} diff --git a/apps/sim/lib/core/utils/csv.test.ts b/apps/sim/lib/core/utils/csv.test.ts index c2c938f1337..2f207cecae2 100644 --- a/apps/sim/lib/core/utils/csv.test.ts +++ b/apps/sim/lib/core/utils/csv.test.ts @@ -1,5 +1,10 @@ import { describe, expect, it } from 'vitest' -import { formatCsvValue, neutralizeCsvFormula, toCsvRow } from '@/lib/core/utils/csv' +import { + formatCsvValue, + neutralizeCsvFormula, + toCsvLinePieces, + toCsvRow, +} from '@/lib/core/utils/csv' describe('CSV formatting', () => { it.each(['=1+1', '+1+1', '-1+1', '@SUM(A1)', '\t=1+1', '\r=1+1'])( @@ -19,4 +24,26 @@ describe('CSV formatting', () => { 'plain,"with,comma","with""quote","with\nnewline","with\rreturn"' ) }) + + it.each([1, 2, 3, 7, 0, -5, 1.5, Number.NaN])( + 'splits a line into pieces that encode to the same bytes as the whole line (piece size %s)', + (maxPieceChars) => { + const values = [ + 'plain', + 'a"b,c', + '\u{1F600}"x\u{1F600}\n\u{1F600}', + '', + '\uD83D\u{1F600}', + '\uDE00\u{1F600}\uDE00', + 'lone\uD83D', + 'tail\u{1F600}', + ] + const pieces = [...toCsvLinePieces(values, maxPieceChars)] + const encoder = new TextEncoder() + const pieceBytes = Buffer.concat(pieces.map((piece) => encoder.encode(piece))) + + expect(pieces.join('')).toBe(`${toCsvRow(values)}\n`) + expect(pieceBytes.equals(encoder.encode(`${toCsvRow(values)}\n`))).toBe(true) + } + ) }) diff --git a/apps/sim/lib/core/utils/csv.ts b/apps/sim/lib/core/utils/csv.ts index 3b59d3c947e..c743094f313 100644 --- a/apps/sim/lib/core/utils/csv.ts +++ b/apps/sim/lib/core/utils/csv.ts @@ -17,10 +17,65 @@ export function formatCsvValue( return String(value) } +const CSV_QUOTE_TRIGGER = /[",\n\r]/ +const CSV_LINE_PIECE_CHARS = 256 * 1024 + export function toCsvRow(values: string[]): string { return values.map(escapeCsvField).join(',') } function escapeCsvField(field: string): string { - return /[",\n\r]/.test(field) ? `"${field.replace(/"/g, '""')}"` : field + return CSV_QUOTE_TRIGGER.test(field) ? `"${field.replace(/"/g, '""')}"` : field +} + +/** + * Yields `toCsvRow(values) + '\n'` as consecutive pieces of about `maxPieceChars` source + * characters, so a caller can yield to the event loop between pieces instead of escaping a + * multi-megabyte field in one synchronous run. A piece never ends between the two halves of a + * surrogate pair, so encoding each piece separately produces the same UTF-8 bytes as encoding the + * whole line; a lone surrogate stays lone either way. A non-finite size falls back to the default + * and anything below one becomes one. + */ +export function* toCsvLinePieces( + values: readonly string[], + maxPieceChars = CSV_LINE_PIECE_CHARS +): Generator { + const pieceChars = Number.isFinite(maxPieceChars) + ? Math.max(1, Math.floor(maxPieceChars)) + : CSV_LINE_PIECE_CHARS + let pending = '' + for (let index = 0; index < values.length; index++) { + if (index > 0) pending += ',' + const field = values[index] + const quoted = CSV_QUOTE_TRIGGER.test(field) + if (quoted) pending += '"' + let start = 0 + while (start < field.length) { + let end = Math.min(start + pieceChars, field.length) + if ( + end < field.length && + isHighSurrogate(field.charCodeAt(end - 1)) && + isLowSurrogate(field.charCodeAt(end)) + ) { + end += 1 + } + const slice = field.slice(start, end) + pending += quoted ? slice.replace(/"/g, '""') : slice + start = end + if (pending.length >= pieceChars) { + yield pending + pending = '' + } + } + if (quoted) pending += '"' + } + yield `${pending}\n` +} + +function isHighSurrogate(code: number): boolean { + return code >= 0xd800 && code <= 0xdbff +} + +function isLowSurrogate(code: number): boolean { + return code >= 0xdc00 && code <= 0xdfff } diff --git a/apps/sim/lib/core/utils/event-loop.ts b/apps/sim/lib/core/utils/event-loop.ts new file mode 100644 index 00000000000..2200c539dc4 --- /dev/null +++ b/apps/sim/lib/core/utils/event-loop.ts @@ -0,0 +1,35 @@ +const CPU_SLICE_MS = 10 + +let sliceEndsAt = 0 +let turnScheduled = false +const turnQueue: Array<() => void> = [] + +/** + * Cooperative yield for CPU-bound request work. Awaits settle as microtasks, which never let the + * event loop service I/O, so a loop that only awaits holds the whole process until it finishes. + * Call this between units of work: it returns immediately while the current slice lasts and + * otherwise waits for a macrotask turn. + * + * The slice is process-wide and shared by every caller in the process, not per caller or per + * request: each turn hands one fresh slice to one waiter. Releasing every waiter together would + * let each finish its in-flight unit before I/O runs again, so a turn would grow with concurrency + * instead of staying at one slice plus one unit. + */ +export async function yieldWhenSliceExpires(): Promise { + if (performance.now() < sliceEndsAt) return + await new Promise((resolve) => { + turnQueue.push(resolve) + scheduleTurn() + }) +} + +function scheduleTurn(): void { + if (turnScheduled) return + turnScheduled = true + setImmediate(() => { + turnScheduled = false + sliceEndsAt = performance.now() + CPU_SLICE_MS + turnQueue.shift()?.() + if (turnQueue.length > 0) scheduleTurn() + }) +} diff --git a/apps/sim/lib/core/utils/with-route-handler.ts b/apps/sim/lib/core/utils/with-route-handler.ts index 47a35f4be7c..d0d2110322e 100644 --- a/apps/sim/lib/core/utils/with-route-handler.ts +++ b/apps/sim/lib/core/utils/with-route-handler.ts @@ -9,6 +9,7 @@ import { FILE_DELIVERY_CSP_PATH_PATTERN, getMainCSPPolicy } from '@/lib/core/sec import { HttpError } from '@/lib/core/utils/http-error' import { generateRequestId } from '@/lib/core/utils/request' import { MAX_CALL_CHAIN_DEPTH, parseCallChain, SIM_VIA_HEADER } from '@/lib/execution/call-chain' +import { trackInFlightRequest } from '@/lib/monitoring/in-flight-requests' import { withPermissionGroupScope } from '@/lib/permission-groups/request-scope.server' const fileDeliveryPath = new RegExp(`^${FILE_DELIVERY_CSP_PATH_PATTERN}$`) @@ -178,6 +179,7 @@ export function withRouteHandler( callChain: callChainFor(request), } + const settleInFlight = trackInFlightRequest(requestId, method, path) return runWithRequestContext(requestContext, async () => { let response: NextResponse | Response try { @@ -242,6 +244,6 @@ export function withRouteHandler( applyResponseHeaders(response, request, requestId) return response - }) + }).finally(settleInFlight) } } diff --git a/apps/sim/lib/execution/payloads/serializer.test.ts b/apps/sim/lib/execution/payloads/serializer.test.ts index f0ba04e2a00..cb1d5ee11bf 100644 --- a/apps/sim/lib/execution/payloads/serializer.test.ts +++ b/apps/sim/lib/execution/payloads/serializer.test.ts @@ -40,6 +40,17 @@ const TEST_EXECUTION_CONTEXT = { userId: 'user-1', } +/** Wraps `leaf` in `depth` levels built by `level`, innermost first. */ +function nest( + depth: number, + level: (child: unknown, index: number) => unknown, + leaf: unknown = 'leaf' +): unknown { + let value = leaf + for (let index = 0; index < depth; index++) value = level(value, index) + return value +} + describe('compactExecutionPayload', () => { beforeEach(() => { clearLargeValueCacheForTests() @@ -128,6 +139,51 @@ describe('compactExecutionPayload', () => { }) }) + it('spills or rejects an oversized child of an object whose toJSON serializes small', async () => { + const value = () => ({ nested: { toJSON: () => 1, big: 'x'.repeat(2000) } }) + const options = { thresholdBytes: 500, ...TEST_EXECUTION_CONTEXT } + + const compacted = await compactExecutionPayload(value(), options) + expect(isLargeValueRef(compacted.nested.big)).toBe(true) + + await expect( + compactExecutionPayload(value(), { ...options, rejectLargeValues: true }) + ).rejects.toMatchObject({ name: 'PayloadSizeLimitError', maxBytes: 500, observedBytes: 2002 }) + }) + + it('sizes a parent by what toJSON returns under its key, not on its own', async () => { + const compacted = await compactExecutionPayload( + { wrapper: { inner: { toJSON: (key: string) => (key === '' ? 'ok' : 'x'.repeat(2000)) } } }, + { thresholdBytes: 500, ...TEST_EXECUTION_CONTEXT } + ) + + expect(isLargeValueRef(compacted.wrapper)).toBe(true) + }) + + it('spills a value exactly one byte over the threshold, counting JSON escapes and omissions', async () => { + const payload = () => ({ + text: 'é"\\\n😀\ud800 line', + lone: 'a\udc00b', + list: [undefined, () => 1, 1.5, -0, Number.NaN, 'ünï'], + omitted: undefined, + fn: () => 1, + nested: { empty: {}, none: null, '키"': [[]] }, + }) + const bytes = Buffer.byteLength(JSON.stringify(payload()), 'utf8') + + const fitting = await compactExecutionPayload( + { payload: payload() }, + { thresholdBytes: bytes, preserveRoot: true, ...TEST_EXECUTION_CONTEXT } + ) + expect(isLargeValueRef(fitting.payload)).toBe(false) + + const over = await compactExecutionPayload( + { payload: payload() }, + { thresholdBytes: bytes - 1, preserveRoot: true, ...TEST_EXECUTION_CONTEXT } + ) + expect(over.payload).toMatchObject({ __simLargeValueRef: true, size: bytes }) + }) + it('does not double-spill existing refs', async () => { const compacted = await compactExecutionPayload( { results: [[{ payload: 'x'.repeat(2048) }]] }, @@ -258,6 +314,23 @@ describe('compactExecutionPayload', () => { expect(compacted.every(isLargeArrayManifest)).toBe(true) }) + it('spills subflow results once their aggregate is one byte over the threshold', async () => { + const results = () => [{ text: 'é"\\'.repeat(5) }, undefined, [1, null], 'plain'] + const bytes = Buffer.byteLength(JSON.stringify({ results: results() }), 'utf8') + + const fitting = await compactSubflowResults(results(), { + thresholdBytes: bytes, + ...TEST_EXECUTION_CONTEXT, + }) + expect(fitting).toEqual(results()) + + const over = await compactSubflowResults(results(), { + thresholdBytes: bytes - 1, + ...TEST_EXECUTION_CONTEXT, + }) + expect(over.map((result) => isLargeValueRef(result))).toEqual([true, false, true, true]) + }) + it('reuses already-compacted subflow entries instead of rebuilding them', async () => { const unchanged = { rows: [{ id: 1, data: { name: 'a' } }], meta: { count: 1 } } const file = { id: 'f1', key: 'k1', url: 'u', name: 'a.txt', size: 3, type: 'text/plain' } @@ -274,6 +347,35 @@ describe('compactExecutionPayload', () => { expect(stripped.other).toBe(withBase64.other) }) + it('compacts trees nested deeper than one synchronous stack can walk', async () => { + // Both overflow an unbroken synchronous walk even on Vitest's larger worker stack. + const plain = nest(10_000, (child) => ({ child })) + // A Date has a toJSON, so every level serializes its subtree from where the walk stands. + const datePerLevel = nest(8_000, (child, index) => ({ at: new Date(index), child })) + const datePerLevelCompacted = nest(8_000, (child) => ({ at: {}, child })) + + expect(JSON.stringify(await compactExecutionPayload(plain))).toBe(JSON.stringify(plain)) + expect(JSON.stringify(await compactExecutionPayload(datePerLevel))).toBe( + JSON.stringify(datePerLevelCompacted) + ) + }) + + it('compacts an object shared across a resumed walk where the walk first reaches it', async () => { + const shared = { text: 'x'.repeat(8192) } + const depth = 300 + const deep = nest(depth, (child) => ({ child }), { shared }) + + const compacted = await compactExecutionPayload( + { deep, later: shared }, + { thresholdBytes: 4096, preserveRoot: true, ...TEST_EXECUTION_CONTEXT } + ) + + let tail = compacted.deep as Record + for (let index = 0; index < depth; index++) tail = tail.child as Record + expect(isLargeValueRef((tail.shared as { text: unknown }).text)).toBe(true) + expect(compacted.later).toBe(shared) + }) + it('rejects durable compaction when storage context is incomplete', async () => { await expect( compactExecutionPayload( diff --git a/apps/sim/lib/execution/payloads/serializer.ts b/apps/sim/lib/execution/payloads/serializer.ts index b6f47e2a1f2..36fa5da379e 100644 --- a/apps/sim/lib/execution/payloads/serializer.ts +++ b/apps/sim/lib/execution/payloads/serializer.ts @@ -79,152 +79,488 @@ function assertRejectSize(observedBytes: number, options: CompactExecutionPayloa } } -async function compactValue( +type MaybePromise = T | Promise + +/** `JSON.stringify` returned `undefined` (a function, symbol, or `undefined`). */ +const JSON_OMITTED = -1 +/** `JSON.stringify` threw (a cycle, a BigInt, or a throwing `toJSON` or getter). */ +const JSON_UNSERIALIZABLE = -2 + +/** Matches every string `JSON.stringify` writes other than as `"` + itself + `"`. */ +const JSON_ESCAPED_CHARACTER = /["\\\u0000-\u001f\ud800-\udfff]/ + +/** + * What `getJsonAndSize` would report for a value, without necessarily + * serializing it: `bytes` is the UTF-8 length of `JSON.stringify(value)`, or + * {@link JSON_OMITTED} / {@link JSON_UNSERIALIZABLE}. + */ +interface JsonMeasure { + bytes: number + /** + * Whether the value serializes the same nested under any key as on its own, + * so a parent can add its bytes up instead of serializing it again. False + * when it has a callable `toJSON`, which receives the key. + */ + composable: boolean + json?: string +} + +interface CompactedNode { + value: unknown + bytes: number + composable: boolean +} + +interface CompactedChildren { + compacted: unknown + measured: JsonMeasure +} + +const OMITTED_NODE: CompactedNode = { value: undefined, bytes: JSON_OMITTED, composable: true } + +function isComposable(value: unknown): boolean { + if ( + value === null || + (typeof value !== 'object' && typeof value !== 'function' && typeof value !== 'bigint') + ) { + return true + } + try { + return typeof (value as { toJSON?: unknown }).toJSON !== 'function' + } catch { + return false + } +} + +function measureJson(value: unknown): JsonMeasure { + let json: string | undefined + try { + json = JSON.stringify(value) + } catch { + return { bytes: JSON_UNSERIALIZABLE, composable: isComposable(value) } + } + if (json === undefined) { + return { bytes: JSON_OMITTED, composable: isComposable(value) } + } + return { bytes: Buffer.byteLength(json, 'utf8'), composable: isComposable(value), json } +} + +/** UTF-8 bytes of `JSON.stringify(text)`. */ +function jsonStringBytes(text: string): number { + return JSON_ESCAPED_CHARACTER.test(text) + ? Buffer.byteLength(JSON.stringify(text), 'utf8') + : Buffer.byteLength(text, 'utf8') + 2 +} + +/** + * Measures a non-object value. A string that cannot fit the threshold (its + * JSON is never shorter than its length + 2) is serialized, since it spills. + */ +function measureLeaf(value: unknown, thresholdBytes: number): JsonMeasure { + if (typeof value === 'string' && value.length + 2 <= thresholdBytes) { + return { bytes: jsonStringBytes(value), composable: true } + } + return measureJson(value) +} + +function exceedsThreshold(bytes: number, thresholdBytes: number): boolean { + return bytes >= 0 && bytes > thresholdBytes +} + +function sumArrayBytes(nodes: readonly CompactedNode[]): number { + let bytes = 1 + Math.max(nodes.length, 1) + for (const node of nodes) { + if (node.bytes === JSON_UNSERIALIZABLE) return JSON_UNSERIALIZABLE + bytes += node.bytes === JSON_OMITTED ? 4 : node.bytes + } + return bytes +} + +function sumObjectBytes(keys: readonly string[], nodes: readonly CompactedNode[]): number { + let bytes = 2 + let propertyCount = 0 + for (let index = 0; index < nodes.length; index++) { + const node = nodes[index] + if (node.bytes === JSON_UNSERIALIZABLE) return JSON_UNSERIALIZABLE + if (node.bytes === JSON_OMITTED) continue + bytes += (propertyCount > 0 ? 1 : 0) + jsonStringBytes(keys[index]) + 1 + node.bytes + propertyCount += 1 + } + return bytes +} + +/** + * Measures a rebuilt container from its children's measures, falling back to + * serializing it when a `toJSON` (its own or a child's) makes the sum unsound. + */ +function measureContainer( + compacted: unknown, + nodes: readonly CompactedNode[], + sumBytes: () => number, + mustSerialize = false +): JsonMeasure { + if (mustSerialize || !isComposable(compacted) || nodes.some((node) => !node.composable)) { + return measureJson(compacted) + } + return { bytes: sumBytes(), composable: true } +} + +function toNode(value: unknown, measured: JsonMeasure): CompactedNode { + return { value, bytes: measured.bytes, composable: measured.composable } +} + +function measuredNode(value: unknown): CompactedNode { + return toNode(value, measureJson(value)) +} + +/** + * Nesting levels walked on one synchronous stack before the walk resumes on a + * fresh one. Each level costs several frames, and a level with a `toJSON` + * serializes its subtree from where it stands, so an unbroken walk overflows + * the stack on trees an awaiting walk handles. + */ +const RESUME_WALK_EVERY_DEPTH = 256 + +/** + * A subtree whose walk continues on a fresh stack. `walked` settles once the + * walk has visited every object below it, with its result (still pending while + * a spill is in flight). Later siblings start only after it, so objects are + * first seen in the same order as an unbroken walk. + */ +class ResumedWalk { + constructor(readonly walked: Promise<{ result: MaybePromise }>) {} +} + +/** The result of walking a subtree: ready, pending on a spill, or still walking. */ +type Walk = MaybePromise | ResumedWalk + +/** Unwraps a walk into the promise of its result. */ +async function settleWalk(walk: Walk): Promise { + return walk instanceof ResumedWalk ? (await walk.walked).result : walk +} + +function thenMaybe( + value: MaybePromise, + next: (resolved: T) => MaybePromise +): MaybePromise { + return value instanceof Promise ? value.then(next) : next(value) +} + +function thenWalk(walk: Walk, next: (resolved: T) => MaybePromise): Walk { + return walk instanceof ResumedWalk + ? new ResumedWalk(walk.walked.then(({ result }) => ({ result: thenMaybe(result, next) }))) + : thenMaybe(walk, next) +} + +/** + * Starts every step in order and joins them like `Promise.all`, staying + * synchronous when none is async. A step that throws synchronously still + * observes the steps already pending, so none rejects unhandled. A step whose + * walk resumed holds back the rest until it has walked. + */ +function startAll(count: number, start: (index: number) => Walk): Walk { + const results = new Array>(count) + let hasPending = false + try { + for (let index = 0; index < count; index++) { + const result = start(index) + if (result instanceof ResumedWalk) { + return new ResumedWalk(continueAll(result, index, count, start, results)) + } + results[index] = result + if (result instanceof Promise) hasPending = true + } + } catch (error) { + if (hasPending) Promise.all(results).catch(() => {}) + throw error + } + return hasPending ? Promise.all(results) : (results as T[]) +} + +async function continueAll( + resumed: ResumedWalk, + resumedIndex: number, + count: number, + start: (index: number) => Walk, + results: MaybePromise[] +): Promise<{ result: MaybePromise }> { + let hasPending = false + /** Observes each pending step now, as a later step may throw before the join. */ + const accept = (result: MaybePromise, index: number) => { + results[index] = result + if (result instanceof Promise) { + hasPending = true + result.catch(() => {}) + } + } + for (let index = 0; index < resumedIndex; index++) accept(results[index], index) + accept((await resumed.walked).result, resumedIndex) + for (let index = resumedIndex + 1; index < count; index++) { + const result = start(index) + accept(result instanceof ResumedWalk ? (await result.walked).result : result, index) + } + return { result: hasPending ? Promise.all(results) : (results as T[]) } +} + +/** Runs `start` for each index in order, awaiting only when a step is async. */ +function forEachInOrder( + count: number, + start: (index: number) => Walk, + accept: (result: T, index: number) => void +): MaybePromise { + for (let index = 0; index < count; index++) { + const result = start(index) + if (result instanceof Promise || result instanceof ResumedWalk) { + return continueInOrder(result, index, count, start, accept) + } + accept(result, index) + } +} + +async function continueInOrder( + pending: Promise | ResumedWalk, + pendingIndex: number, + count: number, + start: (index: number) => Walk, + accept: (result: T, index: number) => void +): Promise { + accept(await settleWalk(pending), pendingIndex) + for (let index = pendingIndex + 1; index < count; index++) { + accept(await settleWalk(start(index)), index) + } +} + +function storeMeasured( + value: unknown, + measured: JsonMeasure, + options: CompactExecutionPayloadOptions +): Promise { + return storeLargeValue( + value, + measured.json ?? (JSON.stringify(value) as string), + measured.bytes, + options + ).then(measuredNode) +} + +/** + * Compacts a value bottom-up, returning it with its JSON measure so each + * ancestor sizes itself from its children instead of re-serializing them. + * Stays synchronous until something spills or block logs compact, so a + * fitting tree allocates no promises. + */ +function compactValue( value: unknown, options: CompactExecutionPayloadOptions, state: CompactState, depth = 0 -): Promise { +): Walk { + const thresholdBytes = options.thresholdBytes ?? LARGE_VALUE_THRESHOLD_BYTES if (!value || typeof value !== 'object') { - const measured = getJsonAndSize(value) - if (measured && measured.size > (options.thresholdBytes ?? LARGE_VALUE_THRESHOLD_BYTES)) { + const measured = measureLeaf(value, thresholdBytes) + if (exceedsThreshold(measured.bytes, thresholdBytes)) { if (options.rejectLargeValues) { - throw largeValueLimitError(options, measured.size) + throw largeValueLimitError(options, measured.bytes) } return options.preserveRoot && depth === 0 - ? value - : storeLargeValue(value, measured.json, measured.size, options) + ? toNode(value, measured) + : storeMeasured(value, measured, options) } - return value + return toNode(value, measured) } if (isLargeValueRef(value)) { - return value + return measuredNode(value) } if (isLargeArrayManifest(value)) { - const measured = getJsonAndSize(value) - if (measured && measured.size > (options.thresholdBytes ?? LARGE_VALUE_THRESHOLD_BYTES)) { + const measured = measureJson(value) + if (exceedsThreshold(measured.bytes, thresholdBytes)) { if (options.rejectLargeValues) { - throw largeValueLimitError(options, measured.size) + throw largeValueLimitError(options, measured.bytes) } - return storeLargeValue(value, measured.json, measured.size, options) + return storeMeasured(value, measured, options) } - return value + return toNode(value, measured) } if (isUserFileWithMetadata(value) && !options.preserveUserFileBase64) { - return stripUserFileBase64(value) + return measuredNode(stripUserFileBase64(value)) } if (state.seen.has(value)) { - return value + return measuredNode(value) } state.seen.add(value) - const compacted = await compactEntries(value, options, state, depth) - - const measured = getJsonAndSize(compacted) - if (measured && measured.size > (options.thresholdBytes ?? LARGE_VALUE_THRESHOLD_BYTES)) { + const children = + depth > 0 && depth % RESUME_WALK_EVERY_DEPTH === 0 + ? resumeEntries(value, options, state, depth) + : compactEntries(value, options, state, depth) + return thenWalk(children, ({ compacted, measured }) => { + if (!exceedsThreshold(measured.bytes, thresholdBytes)) { + return toNode(compacted, measured) + } if (options.rejectLargeValues) { - throw largeValueLimitError(options, measured.size) + throw largeValueLimitError(options, measured.bytes) } if (Array.isArray(compacted) && (canPersistDurably(options) || options.requireDurable)) { - return createLargeArrayManifest(compacted, { ...options, requireDurable: true }) + return createLargeArrayManifest(compacted, { ...options, requireDurable: true }).then( + measuredNode + ) } if (options.preserveRoot && depth === 0) { - return compacted + return toNode(compacted, measured) } - return storeLargeValue(compacted, measured.json, measured.size, options) - } + return storeMeasured(compacted, measured, options) + }) +} - return compacted +/** + * Walks a container's entries on a fresh stack. Kept out of `compactValue` so + * that function allocates no closure on every call. + */ +function resumeEntries( + value: object, + options: CompactExecutionPayloadOptions, + state: CompactState, + depth: number +): ResumedWalk { + return new ResumedWalk( + Promise.resolve().then(() => { + const result = compactEntries(value, options, state, depth) + return result instanceof ResumedWalk ? result.walked : { result } + }) + ) } -async function compactEntries( +function compactEntryValue( + key: string, + entryValue: unknown, + options: CompactExecutionPayloadOptions, + state: CompactState, + depth: number +): Walk { + return key === 'finalBlockLogs' && Array.isArray(entryValue) + ? compactBlockLogs(entryValue as BlockLog[], options).then(measuredNode) + : compactValue(entryValue, options, state, depth + 1) +} + +function compactEntries( value: object, options: CompactExecutionPayloadOptions, state: CompactState, depth: number -): Promise { +): Walk { if (options.rejectLargeValues) { return compactEntriesWithEarlyReject(value, options, state, depth) } if (Array.isArray(value)) { - const compactedItems = await Promise.all( - value.map((item) => compactValue(item, options, state, depth + 1)) + const pending = startAll(value.length, (index) => + index in value ? compactValue(value[index], options, state, depth + 1) : OMITTED_NODE ) - return state.reuseUnchanged && - Object.getPrototypeOf(value) === Array.prototype && - compactedItems.every((item, index) => item === value[index]) - ? value - : compactedItems + return thenWalk(pending, (nodes) => { + const compacted = + state.reuseUnchanged && + Object.getPrototypeOf(value) === Array.prototype && + nodes.every((node, index) => node.value === value[index]) + ? value + : nodes.map((node) => node.value) + return { compacted, measured: measureContainer(compacted, nodes, () => sumArrayBytes(nodes)) } + }) } const entries = Object.entries(value) - const compactedEntries = await Promise.all( - entries.map( - async ([key, entryValue]): Promise<[string, unknown]> => [ - key, - key === 'finalBlockLogs' && Array.isArray(entryValue) - ? await compactBlockLogs(entryValue as BlockLog[], options) - : await compactValue(entryValue, options, state, depth + 1), - ] - ) + const pending = startAll(entries.length, (index) => + compactEntryValue(entries[index][0], entries[index][1], options, state, depth) ) - return state.reuseUnchanged && - Object.getPrototypeOf(value) === Object.prototype && - compactedEntries.every(([, compacted], index) => compacted === entries[index][1]) - ? value - : Object.fromEntries(compactedEntries) + return thenWalk(pending, (nodes) => { + const compacted = + state.reuseUnchanged && + Object.getPrototypeOf(value) === Object.prototype && + nodes.every((node, index) => node.value === entries[index][1]) + ? value + : Object.fromEntries(entries.map(([key], index) => [key, nodes[index].value])) + return { + compacted, + measured: measureContainer(compacted, nodes, () => + sumObjectBytes( + entries.map(([key]) => key), + nodes + ) + ), + } + }) } -async function compactEntriesWithEarlyReject( +function compactEntriesWithEarlyReject( value: object, options: CompactExecutionPayloadOptions, state: CompactState, depth: number -): Promise { +): MaybePromise { if (Array.isArray(value)) { const compacted: unknown[] = [] + const nodes: CompactedNode[] = [] let estimatedBytes = 2 - for (const item of value) { - const compactedItem = await compactValue(item, options, state, depth + 1) - compacted.push(compactedItem) - const measured = getJsonAndSize(compactedItem) - estimatedBytes += (compacted.length > 1 ? 1 : 0) + (measured?.size ?? 4) - assertRejectSize(estimatedBytes, options) - } - return compacted + return thenMaybe( + forEachInOrder( + value.length, + (index) => compactValue(value[index], options, state, depth + 1), + (node) => { + compacted.push(node.value) + nodes.push(node) + estimatedBytes += (compacted.length > 1 ? 1 : 0) + (node.bytes >= 0 ? node.bytes : 4) + assertRejectSize(estimatedBytes, options) + } + ), + () => ({ + compacted, + measured: measureContainer(compacted, nodes, () => sumArrayBytes(nodes)), + }) + ) } const compacted: Record = {} + const entries = Object.entries(value) + const nodes: CompactedNode[] = [] let estimatedBytes = 2 let serializedPropertyCount = 0 - for (const [key, entryValue] of Object.entries(value)) { - const compactedEntry = - key === 'finalBlockLogs' && Array.isArray(entryValue) - ? await compactBlockLogs(entryValue as BlockLog[], options) - : await compactValue(entryValue, options, state, depth + 1) - compacted[key] = compactedEntry - - const measured = getJsonAndSize(compactedEntry) - if (measured) { - const keyJson = JSON.stringify(key) - estimatedBytes += - (serializedPropertyCount > 0 ? 1 : 0) + - Buffer.byteLength(keyJson, 'utf8') + - 1 + - measured.size - serializedPropertyCount += 1 - assertRejectSize(estimatedBytes, options) - } - } - return compacted + return thenMaybe( + forEachInOrder( + entries.length, + (index) => compactEntryValue(entries[index][0], entries[index][1], options, state, depth), + (node, index) => { + const key = entries[index][0] + compacted[key] = node.value + nodes.push(node) + if (node.bytes >= 0) { + estimatedBytes += + (serializedPropertyCount > 0 ? 1 : 0) + jsonStringBytes(key) + 1 + node.bytes + serializedPropertyCount += 1 + assertRejectSize(estimatedBytes, options) + } + } + ), + () => ({ + compacted, + measured: measureContainer( + compacted, + nodes, + () => + sumObjectBytes( + entries.map(([key]) => key), + nodes + ), + // Assigning `__proto__` sets the prototype instead of adding a key. + entries.some(([key]) => key === '__proto__') + ), + }) + ) } async function forceStoreValue( @@ -245,7 +581,8 @@ export async function compactExecutionPayload( value: T, options: CompactExecutionPayloadOptions = {} ): Promise { - return (await compactValue(value, options, { seen: new WeakSet() })) as T + return (await settleWalk(compactValue(value, options, { seen: new WeakSet() }))) + .value as T } export async function compactWorkflowVariableValue( @@ -263,14 +600,29 @@ export async function compactSubflowResults( options: CompactExecutionPayloadOptions = {} ): Promise { const entryOptions = { ...options, preserveRoot: false } - let compactedResults = (await Promise.all( - results.map((result) => - compactValue(result, entryOptions, { seen: new WeakSet(), reuseUnchanged: true }) + const nodes = await settleWalk( + startAll(results.length, (index) => + index in results + ? compactValue(results[index], entryOptions, { + seen: new WeakSet(), + reuseUnchanged: true, + }) + : OMITTED_NODE ) - )) as T[] - - const aggregate = getJsonAndSize({ results: compactedResults }) - if (aggregate && aggregate.size <= (options.thresholdBytes ?? LARGE_VALUE_THRESHOLD_BYTES)) { + ) + let compactedResults = nodes.map((node) => node.value) as T[] + + const aggregate = { results: compactedResults } + const resultsBytes = + isComposable(aggregate) && isComposable(compactedResults) + ? measureContainer(compactedResults, nodes, () => sumArrayBytes(nodes)).bytes + : JSON_UNSERIALIZABLE + const aggregateBytes = + resultsBytes >= 0 ? resultsBytes + '{"results":}'.length : measureJson(aggregate).bytes + if ( + aggregateBytes >= 0 && + aggregateBytes <= (options.thresholdBytes ?? LARGE_VALUE_THRESHOLD_BYTES) + ) { return compactedResults } diff --git a/apps/sim/lib/execution/remote-sandbox/image-registry.ts b/apps/sim/lib/execution/remote-sandbox/image-registry.ts index bfbadb008ee..99815a31c0b 100644 --- a/apps/sim/lib/execution/remote-sandbox/image-registry.ts +++ b/apps/sim/lib/execution/remote-sandbox/image-registry.ts @@ -6,12 +6,11 @@ import { sleep } from '@sim/utils/helpers' import { generateId } from '@sim/utils/id' import { backoffWithJitter } from '@sim/utils/retry' import { and, eq, inArray, lt, notInArray, or, type SQL, sql } from 'drizzle-orm' -import { isTriggerDevEnabled } from '@/lib/core/config/env-flags' +import { dispatchBackgroundTask } from '@/lib/core/async-jobs/background-task' import { recordSandboxCliBuildFailure, recordSandboxImageCleanupFailure, } from '@/lib/core/execution-limits/metrics' -import { runDetached } from '@/lib/core/utils/background' import { buildTimeoutError, providerBuildError, @@ -28,6 +27,7 @@ import { type SandboxImageStatus, type SandboxProviderId, } from '@/lib/execution/remote-sandbox/types' +import type { sandboxImageBuildTask } from '@/background/sandbox-image-build' const logger = createLogger('SandboxImageRegistry') @@ -284,28 +284,20 @@ async function enqueueSandboxImageBuild( payload: SandboxImageBuildPayload, attemptAt: Date ): Promise { - if (!isTriggerDevEnabled) { - runDetached('sandbox-image-build', () => runSandboxImageBuild(payload)) - return - } - // Dynamically imported so Trigger.dev stays out of the web bundle's static graph. - const [{ sandboxImageBuildTask }, { tasks }, { resolveTriggerRegion }] = await Promise.all([ - import('@/background/sandbox-image-build'), - import('@trigger.dev/sdk'), - import('@/lib/core/async-jobs/region'), - ]) - await tasks.trigger(SANDBOX_IMAGE_BUILD_TASK_ID, payload, { - // Keyed by the claim, not by the spec alone. Concurrent saves are already - // collapsed by the conditional update above — only one caller gets a row back, - // so only one reaches here. A spec-only key would instead suppress the *next* - // legitimate attempt: Trigger.dev returns the finished run rather than starting - // one, leaving the row `pending` with no worker and unclaimable until it goes - // stale. That is half an hour of a save-to-retry doing nothing. - idempotencyKey: sandboxBuildIdempotencyKey(payload.provider, payload.specHash, attemptAt), - // Still short, so even a duplicate delivery of one attempt cannot linger. - idempotencyKeyTTL: '5m', - tags: [`sandboxSpec:${payload.specHash}`], - region: await resolveTriggerRegion(), + await dispatchBackgroundTask(SANDBOX_IMAGE_BUILD_TASK_ID, payload, { + runInProcess: runSandboxImageBuild, + trigger: { + // Keyed by the claim, not by the spec alone. Concurrent saves are already + // collapsed by the conditional update above — only one caller gets a row back, + // so only one reaches here. A spec-only key would instead suppress the *next* + // legitimate attempt: Trigger.dev returns the finished run rather than starting + // one, leaving the row `pending` with no worker and unclaimable until it goes + // stale. That is half an hour of a save-to-retry doing nothing. + idempotencyKey: sandboxBuildIdempotencyKey(payload.provider, payload.specHash, attemptAt), + // Still short, so even a duplicate delivery of one attempt cannot linger. + idempotencyKeyTTL: '5m', + tags: [`sandboxSpec:${payload.specHash}`], + }, }) } diff --git a/apps/sim/lib/file-parsers/index.ts b/apps/sim/lib/file-parsers/index.ts index 03bf72c26b8..91f4e92895a 100644 --- a/apps/sim/lib/file-parsers/index.ts +++ b/apps/sim/lib/file-parsers/index.ts @@ -26,11 +26,24 @@ import type { SupportedFileType, } from '@/lib/file-parsers/types' import { XlsxParser } from '@/lib/file-parsers/xlsx-parser' +import { parseXlsxBufferOffThread } from '@/lib/file-parsers/xlsx-worker-pool' import { parseYAML, parseYAMLBuffer } from '@/lib/file-parsers/yaml-parser' import { assertOoxmlArchiveWithinLimits } from '@/lib/file-parsers/zip-guard' const logger = createLogger('FileParser') +const xlsxParser = new XlsxParser() + +/** + * Spreadsheet buffers parse on a worker thread (see `xlsx-worker-pool.ts`); the + * in-process parser stays the fallback and the `parseFile` path. + */ +const SPREADSHEET_PARSER: FileParser = { + parseFile: (filePath, options) => xlsxParser.parseFile(filePath, options), + parseBuffer: (buffer, options = {}) => + parseXlsxBufferOffThread(buffer, options, () => xlsxParser.parseBuffer(buffer, options)), +} + /** * Extension → parser. Several extensions deliberately share one parser because * they are the same container: @@ -65,12 +78,12 @@ const PARSERS = new Map([ ['dotx', new DocxParser()], ['txt', new TxtParser()], ['md', new MdParser()], - ['xlsx', new XlsxParser()], - ['xls', new XlsxParser()], - ['xlsm', new XlsxParser()], - ['xlsb', new XlsxParser()], - ['xltx', new XlsxParser()], - ['ods', new XlsxParser()], + ['xlsx', SPREADSHEET_PARSER], + ['xls', SPREADSHEET_PARSER], + ['xlsm', SPREADSHEET_PARSER], + ['xlsb', SPREADSHEET_PARSER], + ['xltx', SPREADSHEET_PARSER], + ['ods', SPREADSHEET_PARSER], ['pptx', new PptxParser()], ['pptm', new PptxParser()], ['potx', new PptxParser()], diff --git a/apps/sim/lib/file-parsers/officeparser-module.test.ts b/apps/sim/lib/file-parsers/officeparser-module.test.ts index b2b28ea1c76..b2b46af3e2a 100644 --- a/apps/sim/lib/file-parsers/officeparser-module.test.ts +++ b/apps/sim/lib/file-parsers/officeparser-module.test.ts @@ -6,18 +6,38 @@ vi.mock('officeparser', () => ({ parseOfficeAsync: mockParseOfficeAsync })) import { parseOfficeText } from '@/lib/file-parsers/officeparser-module' +const ZIP_PACKAGE = Buffer.concat([Buffer.from([0x50, 0x4b, 0x03, 0x04]), Buffer.alloc(26)]) + +/** + * GHSA-5v7r-6r5c-r473: an ASF header followed by a sub-header of size zero sends `file-type` + * 16's ASF detector, which officeparser runs on every buffer, back over the same sub-header + * forever. A `.docx` or `.odt` upload reached it once mammoth or the ODF walker gave up. + */ +const ASF_ZERO_SIZE_SUB_HEADER = Buffer.concat([ + Buffer.from([0x30, 0x26, 0xb2, 0x75, 0x8e, 0x66, 0xcf, 0x11, 0xa6, 0xd9]), + Buffer.alloc(45), +]) + describe('parseOfficeText', () => { beforeEach(() => { + mockParseOfficeAsync.mockReset() mockParseOfficeAsync.mockResolvedValue('slide text') }) + it('refuses a buffer that is not a ZIP package before officeparser sniffs it', async () => { + await expect(parseOfficeText(ASF_ZERO_SIZE_SUB_HEADER)).rejects.toMatchObject({ + code: 'invalid_format', + }) + expect(mockParseOfficeAsync).not.toHaveBeenCalled() + }) + it('rejects cancellation before loading the parser', async () => { const controller = new AbortController() controller.abort() - await expect( - parseOfficeText(Buffer.from('office archive'), { signal: controller.signal }) - ).rejects.toMatchObject({ name: 'AbortError' }) + await expect(parseOfficeText(ZIP_PACKAGE, { signal: controller.signal })).rejects.toMatchObject( + { name: 'AbortError' } + ) expect(mockParseOfficeAsync).not.toHaveBeenCalled() }) @@ -28,8 +48,8 @@ describe('parseOfficeText', () => { return 'slide text' }) - await expect( - parseOfficeText(Buffer.from('office archive'), { signal: controller.signal }) - ).rejects.toMatchObject({ name: 'AbortError' }) + await expect(parseOfficeText(ZIP_PACKAGE, { signal: controller.signal })).rejects.toMatchObject( + { name: 'AbortError' } + ) }) }) diff --git a/apps/sim/lib/file-parsers/officeparser-module.ts b/apps/sim/lib/file-parsers/officeparser-module.ts index 724822302f9..17e3001fb15 100644 --- a/apps/sim/lib/file-parsers/officeparser-module.ts +++ b/apps/sim/lib/file-parsers/officeparser-module.ts @@ -1,5 +1,6 @@ import { FileParserError } from '@/lib/file-parsers/errors' import type { FileParseOptions } from '@/lib/file-parsers/types' +import { isZipShaped } from '@/lib/file-parsers/zip-guard' type ParseOfficeAsync = (input: Buffer) => Promise @@ -34,12 +35,23 @@ async function loadParseOfficeAsync(): Promise { } } -/** Parse an Office archive as plain text after the caller enforces app-level archive limits. */ +/** + * Parse an Office archive as plain text after the caller enforces app-level archive limits. + * + * Only a ZIP container reaches officeparser. It sniffs a buffer's type with `file-type` 16, + * whose ASF detector loops forever on a sub-header of size zero (GHSA-5v7r-6r5c-r473), so a + * 55-byte upload named `.docx` would stall the event loop once mammoth or the ODF walker + * rejected it. Every format routed here is a ZIP package, and a buffer that opens with a ZIP + * signature can never match the ASF header. + */ export async function parseOfficeText( input: Buffer, options: FileParseOptions = {} ): Promise { options.signal?.throwIfAborted() + if (!isZipShaped(input)) { + throw new FileParserError('invalid_format', 'Not an Office (ZIP) package') + } const parseOfficeAsync = await loadParseOfficeAsync() const result = await parseOfficeAsync(input) options.signal?.throwIfAborted() diff --git a/apps/sim/lib/file-parsers/pdf-furniture.test.ts b/apps/sim/lib/file-parsers/pdf-furniture.test.ts index dab7fbf6234..12e4e3fd750 100644 --- a/apps/sim/lib/file-parsers/pdf-furniture.test.ts +++ b/apps/sim/lib/file-parsers/pdf-furniture.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' +import { yieldWhenSliceExpires } from '@/lib/core/utils/event-loop' import { isPageNumber, normalizeFurnitureText, @@ -33,10 +34,54 @@ function texts(pages: PdfLine[][]): string[][] { } describe('suppressFurniture', () => { - it('drops a header repeated on enough pages but keeps its first occurrence', () => { + it('lets timers run between pages instead of holding the event loop for the whole document', async () => { + const pages = Array.from({ length: 3000 }, (_, i) => + page(i + 1, { header: 'Annual Report', footer: 'Confidential' }) + ) + let timerFired = false + let timerFiredBeforeLastPage = false + const lastPage = pages[pages.length - 1] + const [first, ...rest] = lastPage.lines + lastPage.lines = [ + { + ...first, + get text() { + timerFiredBeforeLastPage ||= timerFired + return first.text + }, + }, + ...rest, + ] + await yieldWhenSliceExpires() + setTimeout(() => { + timerFired = true + }, 0) + + await suppressFurniture(pages) + + expect(timerFiredBeforeLastPage).toBe(true) + }) + + it('resolves a tall page packed with band baselines in linear time', async () => { + const lineCount = 40_000 + const pageHeight = 100 * lineCount + const lines = Array.from({ length: lineCount }, (_, i) => + line(`w${i.toString(36)}`, pageHeight - 3 * i, 50) + ) + const startedAt = performance.now() + + await suppressFurniture([ + { lines, pageHeight }, + { lines: [], pageHeight }, + ]) + + expect(performance.now() - startedAt).toBeLessThan(1000) + }) + + it('drops a header repeated on enough pages but keeps its first occurrence', async () => { const pages = [1, 2, 3, 4].map((i) => page(i, { header: 'ACME Corp — Internal Use Only' })) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) expect(result[0]).toContain('ACME Corp — Internal Use Only') for (const remaining of result.slice(1)) { @@ -45,34 +90,34 @@ describe('suppressFurniture', () => { } }) - it('never applies the frequency rule to a single page', () => { - const result = texts(suppressFurniture([page(1, { header: 'Draft' })])) + it('never applies the frequency rule to a single page', async () => { + const result = texts(await suppressFurniture([page(1, { header: 'Draft' })])) expect(result[0]).toContain('Draft') }) - it('treats two matching pages as furniture when the document has exactly two pages', () => { + it('treats two matching pages as furniture when the document has exactly two pages', async () => { const pages = [1, 2].map((i) => page(i, { footer: `Confidential draft, do not distribute — Page ${i} of 2` }) ) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) expect(result[0]).toContain('Confidential draft, do not distribute — Page 1 of 2') expect(result[1]).not.toContain('Confidential draft, do not distribute — Page 2 of 2') }) - it('requires the fraction threshold on longer documents without a streak', () => { + it('requires the fraction threshold on longer documents without a streak', async () => { const pages = Array.from({ length: 10 }, (_, i) => page(i, { footer: i % 4 === 0 ? 'Sporadic note' : undefined }) ) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) expect(result.flat().filter((text) => text === 'Sporadic note')).toHaveLength(3) }) - it('detects a footer by a three-page streak even when its title changes per chapter', () => { + it('detects a footer by a three-page streak even when its title changes per chapter', async () => { const pages = Array.from({ length: 12 }, (_, i) => { const chapter = i < 6 ? 'Chapter 1 Filing Information' : 'Chapter 2 Filing Status' const pageNumber = i + 6 @@ -83,7 +128,7 @@ describe('suppressFurniture', () => { return page(i, { footer }) }) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) const footers = result.flat().filter((text) => text.includes('Publication 17')) expect(footers).toEqual([ @@ -92,21 +137,21 @@ describe('suppressFurniture', () => { ]) }) - it('drops page numbers in the bands regardless of repetition', () => { + it('drops page numbers in the bands regardless of repetition', async () => { const pages: PdfPageLines[] = [ { lines: [line('Page 1 of 3', 55), ...body(3, 600)], pageHeight: PAGE_HEIGHT }, { lines: [line('2', 55), ...body(3, 600), line('ii', 729)], pageHeight: PAGE_HEIGHT }, { lines: [line('- 3 -', 55), ...body(3, 600), line('925', 60)], pageHeight: PAGE_HEIGHT }, ] - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) expect(result[0]).toEqual(['Body line 1', 'Body line 2', 'Body line 3']) expect(result[1]).toEqual(['Body line 1', 'Body line 2', 'Body line 3']) expect(result[2]).toEqual(['Body line 1', 'Body line 2', 'Body line 3', '925']) }) - it('drops a folio outside the band only when a margin gap separates it from the text', () => { + it('drops a folio outside the band only when a margin gap separates it from the text', async () => { const pages = [1, 2].map((i) => ({ lines: [...body(20, 700), line(`${i}`, 100)], pageHeight: PAGE_HEIGHT, @@ -116,21 +161,21 @@ describe('suppressFurniture', () => { pageHeight: PAGE_HEIGHT, })) - for (const kept of texts(suppressFurniture(pages))) expect(kept).toHaveLength(20) - for (const kept of texts(suppressFurniture(tableCells))) expect(kept).toContain('1') + for (const kept of texts(await suppressFurniture(pages))) expect(kept).toHaveLength(20) + for (const kept of texts(await suppressFurniture(tableCells))) expect(kept).toContain('1') }) - it('ignores band text longer than the furniture cap, such as a repeated table header', () => { + it('ignores band text longer than the furniture cap, such as a repeated table header', async () => { const header = `SKU Product Unit price Lead time Notes ${'Column '.repeat(14)}`.trim() expect(header.length).toBeGreaterThan(120) const pages = [1, 2, 3, 4].map((i) => page(i, { header })) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) for (const kept of result) expect(kept).toContain(header) }) - it('merges same-baseline fragments into one key before matching', () => { + it('merges same-baseline fragments into one key before matching', async () => { const pages = [1, 2, 3, 4].map((i) => ({ lines: [ ...body(3, 600), @@ -141,13 +186,13 @@ describe('suppressFurniture', () => { pageHeight: PAGE_HEIGHT, })) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) expect(result[0].slice(3)).toEqual(['1', 'Chapter 1', 'Publication 17 (2025)']) expect(result[3]).toHaveLength(3) }) - it('keeps a table header that repeats at the top of every page while dropping the running header above it', () => { + it('keeps a table header that repeats at the top of every page while dropping the running header above it', async () => { const pages = Array.from({ length: 5 }, () => { const rows = Array.from({ length: 50 }, (_, i) => line(`${1000 + i} ${2000 + i} ${3000 + i}`, 740 - (i + 1) * 8, 7.5) @@ -163,7 +208,7 @@ describe('suppressFurniture', () => { } }) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) for (const kept of result) { expect(kept).toContain('Single Married filing jointly Head of household') @@ -174,7 +219,7 @@ describe('suppressFurniture', () => { ).toHaveLength(1) }) - it('keeps a footnote that sits directly under the body while dropping the footer below it', () => { + it('keeps a footnote that sits directly under the body while dropping the footer below it', async () => { const pages = Array.from({ length: 4 }, () => ({ lines: [ ...body(52, 700), @@ -188,7 +233,7 @@ describe('suppressFurniture', () => { pageHeight: PAGE_HEIGHT, })) - const result = texts(suppressFurniture(pages)) + const result = texts(await suppressFurniture(pages)) for (const kept of result) { expect(kept).toContain('* This column must also be used by a qualifying surviving spouse.') @@ -196,7 +241,7 @@ describe('suppressFurniture', () => { expect(result.flat().filter((text) => text === 'Visit IRS.gov.')).toHaveLength(1) }) - it('keeps a band line whose text also occurs in body positions', () => { + it('keeps a band line whose text also occurs in body positions', async () => { const pages = [1, 2, 3, 4].map((i) => ({ lines: [ line('Quarter Revenue Margin', 760), @@ -206,29 +251,29 @@ describe('suppressFurniture', () => { pageHeight: PAGE_HEIGHT, })) - for (const kept of texts(suppressFurniture(pages))) { + for (const kept of texts(await suppressFurniture(pages))) { expect(kept).toContain('Quarter Revenue Margin') } }) - it('never drops a band line that would leave a hyphenated word orphaned', () => { + it('never drops a band line that would leave a hyphenated word orphaned', async () => { const pages = [1, 2, 3, 4].map(() => ({ lines: [line('Married filing sepa-', 760), ...body(40, 660)], pageHeight: PAGE_HEIGHT, })) - for (const kept of texts(suppressFurniture(pages))) { + for (const kept of texts(await suppressFurniture(pages))) { expect(kept).toContain('Married filing sepa-') } }) - it('leaves body text alone even when it repeats', () => { + it('leaves body text alone even when it repeats', async () => { const pages = [1, 2, 3, 4].map(() => ({ lines: [line('Repeated body sentence.', 400)], pageHeight: PAGE_HEIGHT, })) - for (const kept of texts(suppressFurniture(pages))) { + for (const kept of texts(await suppressFurniture(pages))) { expect(kept).toEqual(['Repeated body sentence.']) } }) diff --git a/apps/sim/lib/file-parsers/pdf-furniture.ts b/apps/sim/lib/file-parsers/pdf-furniture.ts index ff65d0b827b..0ce52601937 100644 --- a/apps/sim/lib/file-parsers/pdf-furniture.ts +++ b/apps/sim/lib/file-parsers/pdf-furniture.ts @@ -9,6 +9,7 @@ * on every page. Known limitation. */ +import { yieldWhenSliceExpires } from '@/lib/core/utils/event-loop' import type { PdfLine } from '@/lib/file-parsers/pdf-lines' export interface PdfPageLines { @@ -101,25 +102,27 @@ interface KeyOccurrences { groups: Array<{ page: number; group: BandGroup }> } -/** Returns each page's lines with repeated furniture and page numbers removed. */ -export function suppressFurniture(pages: readonly PdfPageLines[]): PdfLine[][] { +/** + * Returns each page's lines with repeated furniture and page numbers removed, + * yielding to the event loop between pages. + */ +export async function suppressFurniture(pages: readonly PdfPageLines[]): Promise { const drops = pages.map(() => new Set()) const occurrences = new Map() - const interiorKeys = collectInteriorKeys(pages) + const interiorKeys = await collectInteriorKeys(pages) - pages.forEach((page, pageIndex) => { + for (const [pageIndex, page] of pages.entries()) { + await yieldWhenSliceExpires() const seen = new Set() - const baselines = pageBaselines(page) - const pitch = baselinePitch(baselines) + const reachesInterior = textFlow(pageBaselines(page)) for (const index of edgeLineIndices(page)) { if (sharesBaseline(page.lines, index)) continue const line = page.lines[index] if (!isPageNumber(line.text, pages.length)) continue const y = line.y as number const half: Band = y > (page.pageHeight as number) / 2 ? 'top' : 'bottom' - const folio = { band: half, indices: [index], text: line.text, y, height: line.height } - if (isInTextFlow(folio, baselines, pitch)) continue + if (reachesInterior(y, half)) continue drops[pageIndex].add(index) } for (const group of bandGroups(page)) { @@ -132,7 +135,7 @@ export function suppressFurniture(pages: readonly PdfPageLines[]): PdfLine[][] { if (normalized.length === 0) continue if (interiorKeys.has(normalized)) continue if (isHyphenOrphan(page.lines, group)) continue - if (isInTextFlow(group, baselines, pitch)) continue + if (reachesInterior(group.y, group.band)) continue const key = `${group.band}|${normalized}` const entry = occurrences.get(key) ?? { pages: [], groups: [] } if (!seen.has(key)) { @@ -142,7 +145,7 @@ export function suppressFurniture(pages: readonly PdfPageLines[]): PdfLine[][] { entry.groups.push({ page: pageIndex, group }) occurrences.set(key, entry) } - }) + } const threshold = furnitureThreshold(pages.length) for (const entry of occurrences.values()) { @@ -158,11 +161,15 @@ export function suppressFurniture(pages: readonly PdfPageLines[]): PdfLine[][] { } } - return pages.map((page, pageIndex) => - drops[pageIndex].size === 0 - ? page.lines - : page.lines.filter((_, index) => !drops[pageIndex].has(index)) - ) + const filtered: PdfLine[][] = [] + for (const [pageIndex, page] of pages.entries()) { + await yieldWhenSliceExpires() + const pageDrops = drops[pageIndex] + filtered.push( + pageDrops.size === 0 ? page.lines : page.lines.filter((_, index) => !pageDrops.has(index)) + ) + } + return filtered } /** @@ -276,9 +283,10 @@ function bandGroups(page: PdfPageLines): BandGroup[] { * body positions — a table header on a page where the table starts mid-page — * is recognised as content rather than furniture. */ -function collectInteriorKeys(pages: readonly PdfPageLines[]): Set { +async function collectInteriorKeys(pages: readonly PdfPageLines[]): Promise> { const keys = new Set() for (const page of pages) { + await yieldWhenSliceExpires() const { pageHeight } = page if (pageHeight === undefined || !(pageHeight > 0)) continue for (const line of page.lines) { @@ -340,28 +348,57 @@ function baselinePitch(baselines: readonly Baseline[]): number { } /** - * Whether a group reaches an interior line through steps no larger than a line - * pitch. A running header, footer, or folio is cut off from the body by a - * margin gap; a repeated table header runs straight into its rows, and a table - * cell near the page edge sits at the row pitch. + * Precomputes, for every baseline of a page, whether the walk toward the page + * interior reaches an interior baseline before a gap wider than the line pitch. + * Each answer extends its neighbour's, so a page is resolved in one linear pass + * per direction instead of one walk per band line, which grows quadratically on + * a tall page packed with band baselines. + * + * @returns Whether the band line on baseline `y` reaches an interior line + * through steps no larger than a line pitch. A running header, footer, or folio + * is cut off from the body by a margin gap; a repeated table header runs + * straight into its rows, and a table cell near the page edge sits at the row + * pitch. */ -function isInTextFlow(group: BandGroup, baselines: readonly Baseline[], pitch: number): boolean { - let index = baselines.findIndex((entry) => Math.abs(entry.y - group.y) <= SAME_BASELINE_TOLERANCE) - if (index === -1) return false - const step = group.band === 'top' ? 1 : -1 - while (true) { - const current = baselines[index] - const next = baselines[index + step] - if (!next) return false - const gap = Math.abs(current.y - next.y) - const limit = Math.max( - FLOW_PITCH_RATIO * pitch, - FLOW_HEIGHT_RATIO * Math.max(current.height, next.height) - ) - if (gap > limit) return false - if (next.band === undefined) return true - index += step +function textFlow(baselines: readonly Baseline[]): (y: number, band: Band) => boolean { + const pitch = baselinePitch(baselines) + const count = baselines.length + const joinsNext = (from: Baseline, to: Baseline): boolean => + Math.abs(from.y - to.y) <= + Math.max(FLOW_PITCH_RATIO * pitch, FLOW_HEIGHT_RATIO * Math.max(from.height, to.height)) + const reach = (step: 1 | -1): boolean[] => { + const reaches = new Array(count).fill(false) + for (let k = 1; k < count; k++) { + const i = step === 1 ? count - 1 - k : k + const next = baselines[i + step] + reaches[i] = joinsNext(baselines[i], next) && (next.band === undefined || reaches[i + step]) + } + return reaches + } + const downward = reach(1) + const upward = reach(-1) + + return (y, band) => { + const index = firstBaselineAt(baselines, y) + if (index === -1) return false + return band === 'top' ? downward[index] : upward[index] + } +} + +/** + * Index of the first baseline within `SAME_BASELINE_TOLERANCE` of `y`, or -1. + * Baselines are sorted from top to bottom, so the matches are contiguous and + * the first is the first baseline not above `y + SAME_BASELINE_TOLERANCE`. + */ +function firstBaselineAt(baselines: readonly Baseline[], y: number): number { + let low = 0 + let high = baselines.length + while (low < high) { + const mid = (low + high) >>> 1 + if (baselines[mid].y > y + SAME_BASELINE_TOLERANCE) low = mid + 1 + else high = mid } + return low < baselines.length && baselines[low].y >= y - SAME_BASELINE_TOLERANCE ? low : -1 } /** Whether a neighbouring line in reading order shares this line's baseline. */ diff --git a/apps/sim/lib/file-parsers/pdf-lines.test.ts b/apps/sim/lib/file-parsers/pdf-lines.test.ts index 0abe14893fc..985883b9bfa 100644 --- a/apps/sim/lib/file-parsers/pdf-lines.test.ts +++ b/apps/sim/lib/file-parsers/pdf-lines.test.ts @@ -1,4 +1,5 @@ import { describe, expect, it } from 'vitest' +import { yieldWhenSliceExpires } from '@/lib/core/utils/event-loop' import { collectCompounds, collectWords, @@ -134,26 +135,30 @@ describe('joinLines', () => { }) describe('dehyphenation', () => { - it('removes a line-end hyphen when the document shows the joined word', () => { + it('removes a line-end hyphen when the document shows the joined word', async () => { const lines = paragraph(['archived by the Infra-', 'structure team.'], 627.4) - const words = collectWords([{ text: 'The Infrastructure team owns it.', height: BODY }]) + const words = await collectWords([ + [{ text: 'The Infrastructure team owns it.', height: BODY }], + ]) expect(joinLines(lines, { words, headingMarkers: false })).toBe( 'archived by the Infrastructure team.' ) }) - it('keeps an unknown line-end hyphen rather than inventing a word', () => { + it('keeps an unknown line-end hyphen rather than inventing a word', async () => { const lines = paragraph(['we ship high-', 'quality builds'], 627.4) - const words = collectWords(lines) + const words = await collectWords([lines]) expect(joinLines(lines, { words, headingMarkers: false })).toBe('we ship high-quality builds') expect(joinLines(lines, { headingMarkers: false })).toBe('we ship high-quality builds') }) - it('keeps the hyphen when the compound appears intact elsewhere in the document', () => { + it('keeps the hyphen when the compound appears intact elsewhere in the document', async () => { const lines = paragraph(['we compare attention-', 'based models with others'], 700) - const compounds = collectCompounds([{ text: 'Attention-based models win.', height: BODY }]) + const compounds = await collectCompounds([ + [{ text: 'Attention-based models win.', height: BODY }], + ]) expect(joinLines(lines, { compounds, headingMarkers: false })).toBe( 'we compare attention-based models with others' @@ -257,31 +262,68 @@ describe('readItemGeometry', () => { }) describe('helpers', () => { - it('picks the character-weighted modal height as body height', () => { + it.each([ + ['dominantLineHeight', dominantLineHeight], + ['collectCompounds', collectCompounds], + ['collectWords', collectWords], + ])('%s lets timers run between pages of a long document', async (_, pass) => { + let timerFired = false + let timerFiredBeforeLastPage = false + const pages = Array.from({ length: 4000 }, (_, page) => + paragraph( + Array.from( + { length: 40 }, + (_, row) => `page ${page} row ${row} well-known cross-page prose` + ), + 700 + ) + ) + const lastPage = pages[pages.length - 1] + const first = lastPage[0] + lastPage[0] = { + ...first, + get text() { + timerFiredBeforeLastPage ||= timerFired + return first.text + }, + } + await yieldWhenSliceExpires() + setTimeout(() => { + timerFired = true + }, 0) + + await pass(pages) + + expect(timerFiredBeforeLastPage).toBe(true) + }) + + it('picks the character-weighted modal height as body height', async () => { expect( - dominantLineHeight([ - { text: 'Heading', height: 15.4 }, - { text: 'A long body line of text', height: 11 }, - { text: 'Another body line', height: 11.02 }, + await dominantLineHeight([ + [ + { text: 'Heading', height: 15.4 }, + { text: 'A long body line of text', height: 11 }, + { text: 'Another body line', height: 11.02 }, + ], ]) ).toBe(11) }) - it('weighs only prose-like lines when the document has any, so table text cannot become the body', () => { + it('weighs only prose-like lines when the document has any, so table text cannot become the body', async () => { const cells = Array.from({ length: 200 }, (_, i) => ({ text: `${i} 4,512 7%`, height: 7.5 })) const prose = [ { text: 'This sentence is long enough and has enough words to count as prose.', height: 11 }, ] - expect(dominantLineHeight([...cells, ...prose])).toBe(11) - expect(dominantLineHeight(cells)).toBe(7.5) + expect(await dominantLineHeight([[...cells, ...prose]])).toBe(11) + expect(await dominantLineHeight([cells])).toBe(7.5) }) - it('disables heading markers when too many lines would qualify', () => { + it('disables heading markers when too many lines would qualify', async () => { const bullets = Array.from({ length: 6 }, () => ({ text: 'Bullet', height: 15 })) const body = Array.from({ length: 4 }, () => ({ text: 'Body', height: 11 })) - expect(headingMarkersViable([...bullets, ...body], 11)).toBe(false) - expect(headingMarkersViable([bullets[0], ...body], 11)).toBe(true) + expect(await headingMarkersViable([[...bullets, ...body]], 11)).toBe(false) + expect(await headingMarkersViable([[bullets[0], ...body]], 11)).toBe(true) }) }) diff --git a/apps/sim/lib/file-parsers/pdf-lines.ts b/apps/sim/lib/file-parsers/pdf-lines.ts index 0e7594eff5c..7b68e2b397d 100644 --- a/apps/sim/lib/file-parsers/pdf-lines.ts +++ b/apps/sim/lib/file-parsers/pdf-lines.ts @@ -9,6 +9,8 @@ * headings, and running furniture can be recovered afterwards. */ +import { yieldWhenSliceExpires } from '@/lib/core/utils/event-loop' + /** One text item as pdf.js streams it; every field is untrusted. */ export interface PdfTextItem { str?: unknown @@ -263,14 +265,17 @@ export function normalizePdfWhitespace(text: string): string { * outward from each hyphen rather than matching `\p{L}+-\p{L}+`, which retries * from every letter of a long hyphen-free line. */ -export function collectCompounds(lines: Iterable): Set { +export async function collectCompounds(pages: Iterable): Promise> { const compounds = new Set() - for (const line of lines) { - const text = line.text - for (let at = text.indexOf('-'); at !== -1; at = text.indexOf('-', at + 1)) { - const start = letterRunStart(text, at) - const end = letterRunEnd(text, at + 1) - if (start < at && end > at + 1) compounds.add(text.slice(start, end).toLowerCase()) + for (const lines of pages) { + await yieldWhenSliceExpires() + for (const line of lines) { + const text = line.text + for (let at = text.indexOf('-'); at !== -1; at = text.indexOf('-', at + 1)) { + const start = letterRunStart(text, at) + const end = letterRunEnd(text, at + 1) + if (start < at && end > at + 1) compounds.add(text.slice(start, end).toLowerCase()) + } } } return compounds @@ -294,14 +299,17 @@ function letterRunEnd(text: string, index: number): number { * Lowercase words of three to `MAX_COLLECTED_WORD_CHARS` letters seen anywhere * in the document, capped at `MAX_COLLECTED_WORDS` entries. */ -export function collectWords(lines: Iterable): Set { +export async function collectWords(pages: Iterable): Promise> { const words = new Set() - for (const line of lines) { - for (const match of line.text.matchAll(WORD_TOKEN)) { - const word = match[0] - if (word.length < 3 || word.length > MAX_COLLECTED_WORD_CHARS) continue - words.add(word.toLowerCase()) - if (words.size >= MAX_COLLECTED_WORDS) return words + for (const lines of pages) { + await yieldWhenSliceExpires() + for (const line of lines) { + for (const match of line.text.matchAll(WORD_TOKEN)) { + const word = match[0] + if (word.length < 3 || word.length > MAX_COLLECTED_WORD_CHARS) continue + words.add(word.toLowerCase()) + if (words.size >= MAX_COLLECTED_WORDS) return words + } } } return words @@ -311,15 +319,18 @@ export function collectWords(lines: Iterable): Set { * Character-weighted modal height of the document's prose-like lines; falls * back to every line when nothing reads as prose. 0 when unknown. */ -export function dominantLineHeight(lines: Iterable): number { +export async function dominantLineHeight(pages: Iterable): Promise { const prose = new Map() const all = new Map() - for (const line of lines) { - if (line.height <= 0) continue - const key = Math.round(line.height * 10) / 10 - const text = line.text.trim() - all.set(key, (all.get(key) ?? 0) + text.length) - if (isProseLike(text)) prose.set(key, (prose.get(key) ?? 0) + text.length) + for (const lines of pages) { + await yieldWhenSliceExpires() + for (const line of lines) { + if (line.height <= 0) continue + const key = Math.round(line.height * 10) / 10 + const text = line.text.trim() + all.set(key, (all.get(key) ?? 0) + text.length) + if (isProseLike(text)) prose.set(key, (prose.get(key) ?? 0) + text.length) + } } const weights = prose.size > 0 ? prose : all let best = 0 @@ -410,13 +421,19 @@ function sameHeightRuns(lines: readonly PdfLine[]): number[] { * Whether heading markers make sense for a document: false when so many lines * qualify that the dominant height is not the body text. */ -export function headingMarkersViable(lines: Iterable, bodyHeight: number): boolean { +export async function headingMarkersViable( + pages: Iterable, + bodyHeight: number +): Promise { let total = 0 let candidates = 0 - for (const line of lines) { - if (line.height <= 0) continue - total++ - if (isHeadingCandidate(line, bodyHeight)) candidates++ + for (const lines of pages) { + await yieldWhenSliceExpires() + for (const line of lines) { + if (line.height <= 0) continue + total++ + if (isHeadingCandidate(line, bodyHeight)) candidates++ + } } return total === 0 || candidates / total <= MAX_HEADING_LINE_FRACTION } diff --git a/apps/sim/lib/file-parsers/pdf-parser-cancellation.test.ts b/apps/sim/lib/file-parsers/pdf-parser-cancellation.test.ts index 28259979fef..59f4bc57781 100644 --- a/apps/sim/lib/file-parsers/pdf-parser-cancellation.test.ts +++ b/apps/sim/lib/file-parsers/pdf-parser-cancellation.test.ts @@ -74,7 +74,8 @@ describe('PdfParser cancellation', () => { }) it('cancels a stalled text reader at the extraction deadline and returns a partial result', async () => { - vi.useFakeTimers() + // Fakes only the deadline clock: the shared event-loop turnstile must keep real immediates. + vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'Date'] }) const reader = { cancel: vi.fn().mockResolvedValue(undefined), read: vi @@ -94,8 +95,7 @@ describe('PdfParser cancellation', () => { mockOpenPdfDocument.mockResolvedValueOnce(pdf) const parsing = new PdfParser().parseBuffer(Buffer.from('%PDF-1.4')) - await vi.advanceTimersByTimeAsync(0) - expect(reader.read).toHaveBeenCalledTimes(2) + await vi.waitFor(() => expect(reader.read).toHaveBeenCalledTimes(2)) await vi.advanceTimersByTimeAsync(60_000) const result = await parsing @@ -154,4 +154,89 @@ describe('PdfParser cancellation', () => { expect(pdf.getPage).not.toHaveBeenCalled() expect(pdf.destroy).toHaveBeenCalledOnce() }) + + it('lets timers run between CPU-bound pages instead of holding the event loop for the whole document', async () => { + const pageCount = 12 + let timerFired = false + let timerFiredBeforeLastPage = false + const { pdf } = pdfWithPageText(pageCount, (pageNumber) => { + const busyUntil = performance.now() + 5 + while (performance.now() < busyUntil) {} + if (pageNumber === pageCount) timerFiredBeforeLastPage = timerFired + return 'page text' + }) + mockOpenPdfDocument.mockResolvedValueOnce(pdf) + + setTimeout(() => { + timerFired = true + }, 0) + await new PdfParser().parseBuffer(Buffer.from('%PDF-1.4')) + + expect(timerFiredBeforeLastPage).toBe(true) + }) + + it('shares one event-loop slice across concurrent parses instead of giving each its own', async () => { + const parseCount = 8 + for (let i = 0; i < parseCount; i++) { + const { pdf } = pdfWithPageText(20, () => { + const busyUntil = performance.now() + 2 + while (performance.now() < busyUntil) {} + return 'page text' + }) + mockOpenPdfDocument.mockResolvedValueOnce(pdf) + } + let longestTimerWait = 0 + let probing = true + let lastTick = performance.now() + const probe = () => { + const now = performance.now() + longestTimerWait = Math.max(longestTimerWait, now - lastTick) + lastTick = now + if (probing) setTimeout(probe, 0) + } + setTimeout(probe, 0) + + await Promise.all( + Array.from({ length: parseCount }, () => new PdfParser().parseBuffer(Buffer.from('%PDF-1.4'))) + ) + probing = false + + expect(longestTimerWait).toBeLessThan(40) + }) + + it('lets timers run while one page streams a huge content stream', async () => { + const chunkCount = 12 + let timerFired = false + let timerFiredBeforeLastChunk = false + let chunksRead = 0 + const reader = { + cancel: vi.fn().mockResolvedValue(undefined), + read: vi.fn(async () => { + const busyUntil = performance.now() + 5 + while (performance.now() < busyUntil) {} + chunksRead++ + if (chunksRead === chunkCount) timerFiredBeforeLastChunk = timerFired + if (chunksRead > chunkCount) return { done: true } + return { value: { items: [{ str: `chunk ${chunksRead} ` }] }, done: false } + }), + } + const page = { + cleanup: vi.fn(), + streamTextContent: vi.fn(() => ({ getReader: () => reader })), + } + const pdf = { + destroy: vi.fn().mockResolvedValue(undefined), + getPage: vi.fn().mockResolvedValue(page), + numPages: 1, + } + mockOpenPdfDocument.mockResolvedValueOnce(pdf) + + setTimeout(() => { + timerFired = true + }, 0) + const result = await new PdfParser().parseBuffer(Buffer.from('%PDF-1.4')) + + expect(timerFiredBeforeLastChunk).toBe(true) + expect(result.content).toContain(`chunk ${chunkCount}`) + }) }) diff --git a/apps/sim/lib/file-parsers/pdf-parser.ts b/apps/sim/lib/file-parsers/pdf-parser.ts index a599f3d7806..5d0ec36481b 100644 --- a/apps/sim/lib/file-parsers/pdf-parser.ts +++ b/apps/sim/lib/file-parsers/pdf-parser.ts @@ -1,7 +1,7 @@ import { readFile } from 'fs/promises' import { createLogger } from '@sim/logger' -import { sleep } from '@sim/utils/helpers' import type { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist/types/src/pdf' +import { yieldWhenSliceExpires } from '@/lib/core/utils/event-loop' import { FileParserError } from '@/lib/file-parsers/errors' import { type PdfPageLines, suppressFurniture } from '@/lib/file-parsers/pdf-furniture' import { PdfPageCollector } from '@/lib/file-parsers/pdf-layout' @@ -51,9 +51,6 @@ const PDF_EXTRACTION_TIMEOUT_MS = 60_000 */ const MAX_LINE_DECORATION_BYTES = 5 -/** Pages assembled between event-loop yields, so a long document cannot block the loop. */ -const ASSEMBLY_YIELD_EVERY_PAGES = 32 - /** Pages are joined with a paragraph break. */ const PAGE_SEPARATOR = '\n\n' @@ -189,6 +186,7 @@ async function readPageWithinBudget( * zero: text that ends exactly on the budget is complete, not truncated. */ while (!dropped) { + await yieldWhenSliceExpires() const result = await waitForDeadline( reader.read(), deadline, @@ -262,8 +260,9 @@ function estimateRetainedPageBytes(lines: readonly PdfLine[]): number { /** * Turns the collected pages into text: repeated furniture is dropped, lines are * joined into paragraphs, hyphenation is undone, and pages are separated by a - * paragraph break. Yields to the event loop periodically and honours `signal` - * between pages, since this runs after the streaming budgets have stopped. + * paragraph break. Every whole-document pass yields to the event loop between + * pages and `signal` is honoured between joined pages, since this runs after + * the streaming budgets have stopped. */ async function assemblePages( pages: readonly PdfPageLines[], @@ -272,22 +271,20 @@ async function assemblePages( maxTextBytes: number ): Promise { signal?.throwIfAborted() - const filteredPages = suppressFurniture(pages) - const allLines = filteredPages.flat() - const bodyHeight = dominantLineHeight(allLines) + const filteredPages = await suppressFurniture(pages) + const bodyHeight = await dominantLineHeight(filteredPages) const options = { - compounds: collectCompounds(allLines), - words: collectWords(allLines), + compounds: await collectCompounds(filteredPages), + words: await collectWords(filteredPages), bodyHeight, - headingMarkers: PDF_HEADING_MARKERS_ENABLED && headingMarkersViable(allLines, bodyHeight), + headingMarkers: + PDF_HEADING_MARKERS_ENABLED && (await headingMarkersViable(filteredPages, bodyHeight)), } const pageTexts: string[] = [] let outputBytes = 0 - for (const [index, lines] of filteredPages.entries()) { - if (index > 0 && index % ASSEMBLY_YIELD_EVERY_PAGES === 0) { - await sleep(0) - signal?.throwIfAborted() - } + for (const lines of filteredPages) { + await yieldWhenSliceExpires() + signal?.throwIfAborted() const joined = joinLines(lines, options) const text = complete ? normalizePdfWhitespace(sanitizeTextForUTF8(joined)).trim() : joined if (text.length > 0) { @@ -317,6 +314,13 @@ function completeBudget(value: number | undefined, ceiling: number): number { return Math.min(value, ceiling) } +/** + * pdf.js runs its "fake worker" on this thread and delivers every message as a + * microtask, so a loop that only awaits pdf.js never yields to timers or I/O: a + * large PDF, or one page with a huge content stream, would hold the event loop + * for the whole extraction, freezing every other request on the process. Page + * reads, text-stream reads, and assembly yield via `yieldWhenSliceExpires`. + */ async function extractTextWithinBudget( pdf: PDFDocumentProxy, options: FileParseOptions, @@ -344,6 +348,7 @@ async function extractTextWithinBudget( } for (let pageNumber = 1; pageNumber <= pageLimit; pageNumber++) { + await yieldWhenSliceExpires() signal?.throwIfAborted() const pagePromise = pdf.getPage(pageNumber) const cleanupLatePage = () => { diff --git a/apps/sim/lib/file-parsers/xlsx-worker-entry.ts b/apps/sim/lib/file-parsers/xlsx-worker-entry.ts new file mode 100644 index 00000000000..25cee0a9bb8 --- /dev/null +++ b/apps/sim/lib/file-parsers/xlsx-worker-entry.ts @@ -0,0 +1,37 @@ +/** + * Worker-thread entry for spreadsheet parsing, bundled to + * `apps/sim/dist/xlsx-worker.mjs` by `bun run build:xlsx-worker` and + * spawned by `xlsx-worker-pool.ts`. It runs the same {@link XlsxParser} the + * main thread falls back to, so the two paths cannot drift. + */ +import { parentPort } from 'node:worker_threads' +import { XlsxParser } from '@/lib/file-parsers/xlsx-parser' +import { + serializeXlsxWorkerError, + type XlsxWorkerMessage, + type XlsxWorkerParseRequest, +} from '@/lib/file-parsers/xlsx-worker-protocol' + +const port = parentPort +if (!port) throw new Error('xlsx-worker-entry must run inside a worker thread') + +const parser = new XlsxParser() + +function reply(message: XlsxWorkerMessage) { + port?.postMessage(message) +} + +port.on('message', async (request: XlsxWorkerParseRequest) => { + try { + const buffer = Buffer.from( + request.data.buffer, + request.data.byteOffset, + request.data.byteLength + ) + reply({ type: 'result', result: await parser.parseBuffer(buffer, request.options) }) + } catch (error) { + reply({ type: 'error', error: serializeXlsxWorkerError(error) }) + } +}) + +reply({ type: 'ready' }) diff --git a/apps/sim/lib/file-parsers/xlsx-worker-pool.test.ts b/apps/sim/lib/file-parsers/xlsx-worker-pool.test.ts new file mode 100644 index 00000000000..22daa089e2d --- /dev/null +++ b/apps/sim/lib/file-parsers/xlsx-worker-pool.test.ts @@ -0,0 +1,231 @@ +/** + * The parse worker is a cross-process boundary type-check cannot see: results + * and errors are structured-cloned, and the bundle is built by a separate + * script. Failure modes this file guards, each one test: + * + * 1. Worker output diverges from in-process parsing (preview, complete). + * 2. A typed parser error loses its class, `code`, or message crossing back. + * 3. A missing bundle breaks parsing instead of falling back in-process. + * 4. An unloadable bundle (throws at load, or the Worker constructor itself + * throws) breaks parsing or strands queued jobs instead of falling back. + * 5. A worker crash mid-parse loses the job instead of re-running it in-process. + * 6. An abort during a worker parse hangs or leaves the worker occupying its slot. + * 7. An abort while queued still dispatches the job. + * 8. Dispatch detaches the caller's buffer (transfer of caller-owned memory). + */ +import { execFileSync } from 'node:child_process' +import { mkdtempSync, writeFileSync } from 'node:fs' +import { tmpdir } from 'node:os' +import path from 'node:path' +import { beforeAll, describe, expect, it } from 'vitest' +import * as XLSX from 'xlsx' +import type { FileParseOptions, FileParseResult } from '@/lib/file-parsers/types' +import { XlsxParser } from '@/lib/file-parsers/xlsx-parser' +import { resolveXlsxWorkerPath, XlsxWorkerPool } from '@/lib/file-parsers/xlsx-worker-pool' + +const APP_ROOT = path.resolve(__dirname, '..', '..') +const parser = new XlsxParser() +let builtWorkerPath: string +let fakeWorkerDir: string + +function workbook(): Buffer { + const book = XLSX.utils.book_new() + XLSX.utils.book_append_sheet( + book, + XLSX.utils.aoa_to_sheet([ + ['Name', 'Amount', 'When'], + ['alpha', 1250.5, new Date(Date.UTC(2024, 0, 2))], + ['beta\twith tab', 0.2, 'text'], + ]), + 'First' + ) + XLSX.utils.book_append_sheet(book, XLSX.utils.aoa_to_sheet([['only'], ['cells']]), 'Second') + return XLSX.write(book, { type: 'buffer', bookType: 'xlsx', cellDates: true }) as Buffer +} + +/** A ZIP declaring more central-directory records than the archive guard allows. */ +function oversizedCentralDirectory(): Buffer { + const entryCount = 10_001 + const centralDirectory = Buffer.alloc(46 * entryCount) + for (let index = 0; index < entryCount; index++) { + centralDirectory.writeUInt32LE(0x02014b50, index * 46) + } + const eocd = Buffer.alloc(22) + eocd.writeUInt32LE(0x06054b50, 0) + eocd.writeUInt16LE(entryCount, 8) + eocd.writeUInt16LE(entryCount, 10) + eocd.writeUInt32LE(centralDirectory.length, 12) + return Buffer.concat([centralDirectory, eocd]) +} + +function writeFakeWorker(name: string, source: string): string { + const file = path.join(fakeWorkerDir, name) + writeFileSync(file, source) + return file +} + +type Outcome = + | { ok: true; result: FileParseResult } + | { ok: false; error: { ctor: string; name: string; code: unknown; message: string } } + +async function settle(promise: Promise): Promise { + try { + return { ok: true, result: await promise } + } catch (error) { + const e = error as Error & { code?: unknown } + return { + ok: false, + error: { ctor: e.constructor.name, name: e.name, code: e.code, message: e.message }, + } + } +} + +function inProcess(buffer: Buffer, options: FileParseOptions = {}) { + return () => parser.parseBuffer(buffer, options) +} + +beforeAll(() => { + execFileSync('bun', ['run', 'build:xlsx-worker'], { cwd: APP_ROOT, stdio: 'pipe' }) + const resolved = resolveXlsxWorkerPath() + if (!resolved) throw new Error('build:xlsx-worker did not produce a resolvable bundle') + builtWorkerPath = resolved + fakeWorkerDir = mkdtempSync(path.join(tmpdir(), 'xlsx-worker-pool-')) +}, 60_000) + +describe('XlsxWorkerPool against the built bundle', () => { + const cases: Array<{ name: string; buffer: () => Buffer; options: FileParseOptions }> = [ + { name: 'preview workbook', buffer: workbook, options: {} }, + { name: 'complete workbook', buffer: workbook, options: { contentMode: 'complete' } }, + { + name: 'complete text budget exceeded', + buffer: workbook, + options: { contentMode: 'complete', maxTextBytes: 8 }, + }, + { name: 'archive guard rejection', buffer: oversizedCentralDirectory, options: {} }, + { + name: 'corrupt ZIP payload', + buffer: () => Buffer.concat([Buffer.from('PK\u0003\u0004'), Buffer.alloc(256, 7)]), + options: {}, + }, + ] + + it.each(cases)('matches in-process parsing for $name', async ({ buffer, options }) => { + const expected = await settle(parser.parseBuffer(buffer(), options)) + const pool = new XlsxWorkerPool({ workerPath: builtWorkerPath, size: 1 }) + const input = buffer() + + const actual = await settle( + pool.parse(input, options, () => Promise.reject(new Error('fell back'))) + ) + + expect(actual).toEqual(expected) + }) + + it('leaves the caller buffer intact after dispatch', async () => { + const input = workbook() + const snapshot = Buffer.from(input) + const pool = new XlsxWorkerPool({ workerPath: builtWorkerPath, size: 1 }) + + await pool.parse(input, {}, () => Promise.reject(new Error('fell back'))) + + expect(input.byteLength).toBe(snapshot.byteLength) + expect(input.equals(snapshot)).toBe(true) + }) +}) + +describe('XlsxWorkerPool fallback', () => { + it('parses in-process when no bundle is available', async () => { + const input = workbook() + const expected = await parser.parseBuffer(input) + const pool = new XlsxWorkerPool({ workerPath: null, size: 1 }) + + await expect(pool.parse(input, {}, inProcess(input))).resolves.toEqual(expected) + }) + + it('parses in-process when the bundle throws while loading', async () => { + const input = workbook() + const expected = await parser.parseBuffer(input) + const workerPath = writeFakeWorker('throws.mjs', "throw new Error('broken bundle')\n") + const pool = new XlsxWorkerPool({ workerPath, size: 1 }) + + await expect(pool.parse(input, {}, inProcess(input))).resolves.toEqual(expected) + await expect(pool.parse(input, {}, inProcess(input))).resolves.toEqual(expected) + }) + + it('parses every queued job in-process when the Worker constructor throws', async () => { + const input = workbook() + const expected = await parser.parseBuffer(input) + const pool = new XlsxWorkerPool({ workerPath: 'not-a-resolvable-worker-path.mjs', size: 1 }) + + const results = await Promise.all([ + pool.parse(input, {}, inProcess(input)), + pool.parse(input, {}, inProcess(input)), + ]) + + expect(results).toEqual([expected, expected]) + }) + + it('re-runs a job in-process when the worker dies mid-parse', async () => { + const input = workbook() + const expected = await parser.parseBuffer(input) + const workerPath = writeFakeWorker( + 'crashes.mjs', + [ + "import { parentPort } from 'node:worker_threads'", + "parentPort.on('message', () => process.exit(3))", + "parentPort.postMessage({ type: 'ready' })", + ].join('\n') + ) + const pool = new XlsxWorkerPool({ workerPath, size: 1 }) + + await expect(pool.parse(input, {}, inProcess(input))).resolves.toEqual(expected) + }) +}) + +describe('XlsxWorkerPool cancellation', () => { + /** Spins forever on `maxTextBytes: 1`, otherwise answers immediately. */ + const spinningWorkerSource = [ + "import { parentPort } from 'node:worker_threads'", + "parentPort.on('message', (request) => {", + ' if (request.options.maxTextBytes === 1) for (;;) {}', + " parentPort.postMessage({ type: 'result', result: { content: 'answered' } })", + '})', + "parentPort.postMessage({ type: 'ready' })", + ].join('\n') + + it('rejects with the abort reason and frees the slot held by a spinning worker', async () => { + const workerPath = writeFakeWorker('spins.mjs', spinningWorkerSource) + const pool = new XlsxWorkerPool({ workerPath, size: 1 }) + const controller = new AbortController() + const reason = new Error('deadline') + const fallback = () => Promise.reject(new Error('fell back')) + + const spinning = pool.parse( + workbook(), + { signal: controller.signal, maxTextBytes: 1 }, + fallback + ) + const queued = pool.parse(workbook(), {}, fallback) + setTimeout(() => controller.abort(reason), 50) + + await expect(spinning).rejects.toBe(reason) + await expect(queued).resolves.toEqual({ content: 'answered' }) + }) + + it('rejects a queued job on abort while the worker is busy', async () => { + const workerPath = writeFakeWorker('spins-queue.mjs', spinningWorkerSource) + const pool = new XlsxWorkerPool({ workerPath, size: 1 }) + const blocker = new AbortController() + const queuedController = new AbortController() + const reason = new Error('caller gave up') + const fallback = () => Promise.reject(new Error('fell back')) + + const spinning = pool.parse(workbook(), { signal: blocker.signal, maxTextBytes: 1 }, fallback) + const queued = pool.parse(workbook(), { signal: queuedController.signal }, fallback) + queuedController.abort(reason) + + await expect(queued).rejects.toBe(reason) + blocker.abort(new Error('cleanup')) + await expect(spinning).rejects.toThrow('cleanup') + }) +}) diff --git a/apps/sim/lib/file-parsers/xlsx-worker-pool.ts b/apps/sim/lib/file-parsers/xlsx-worker-pool.ts new file mode 100644 index 00000000000..a28cd560f1b --- /dev/null +++ b/apps/sim/lib/file-parsers/xlsx-worker-pool.ts @@ -0,0 +1,303 @@ +import { existsSync } from 'node:fs' +import path from 'node:path' +import { Worker } from 'node:worker_threads' +import { createLogger } from '@sim/logger' +import { omit } from '@sim/utils/object' +import { isInsideTriggerRun } from '@/lib/core/config/trigger-runtime' +import type { FileParseOptions, FileParseResult } from '@/lib/file-parsers/types' +import { + deserializeXlsxWorkerError, + type XlsxWorkerMessage, + type XlsxWorkerParseRequest, +} from '@/lib/file-parsers/xlsx-worker-protocol' + +const logger = createLogger('XlsxWorkerPool') + +/** + * One worker: SheetJS parsing is synchronous, so in-process parses already run + * one at a time and a single worker keeps peak workbook memory where it is today + * while taking the parse off the event loop. Bun ignores `resourceLimits`, so a + * worker's heap counts against the whole process exactly as an in-process parse + * does; the bound here is concurrency, not heap size. + */ +const XLSX_WORKER_POOL_SIZE = 1 + +/** Releases an idle worker's heap (the last workbook's garbage) after a quiet period. */ +const XLSX_WORKER_IDLE_TIMEOUT_MS = 30_000 + +/** Bounds worker startup only; a parse itself is bounded by the caller's signal. */ +const XLSX_WORKER_START_TIMEOUT_MS = 10_000 + +const WORKER_BUNDLE_RELATIVE_PATH = path.join('dist', 'xlsx-worker.mjs') + +/** + * Where `bun run build:xlsx-worker` writes the bundle, as seen from the two + * working directories the app runs in: the repo root (the Docker image runs + * `bun apps/sim/bootstrap.js` from `/app`) and `apps/sim` (`next start`, tests). + * Next bundles this module into server chunks, so `import.meta.url` does not + * point at the source tree. + */ +export function resolveXlsxWorkerPath(): string | null { + const candidates = [ + path.join(process.cwd(), 'apps', 'sim', WORKER_BUNDLE_RELATIVE_PATH), + path.join(process.cwd(), WORKER_BUNDLE_RELATIVE_PATH), + ] + return candidates.find((candidate) => existsSync(candidate)) ?? null +} + +interface XlsxWorkerPoolConfig { + /** Bundle to spawn; `null` parses every job in-process. */ + workerPath: string | null + size: number + idleTimeoutMs?: number + startTimeoutMs?: number +} + +type InProcessParse = () => Promise + +interface Job { + buffer: Buffer + options: FileParseOptions + fallback: InProcessParse + resolve: (result: FileParseResult) => void + reject: (error: unknown) => void + detachAbort: () => void +} + +interface Slot { + worker: Worker + ready: boolean + job: Job | null + idleTimer: ReturnType | null + startTimer: ReturnType | null +} + +/** + * A bounded pool of spreadsheet parse workers with an in-process safety net. + * + * Any worker failure that is not a caller abort — a bundle that fails to load, + * a startup that never reports ready, a crash mid-parse — disables the pool for + * the life of the process (logged once) and runs the affected and queued jobs + * through the caller's in-process parse, so a packaging mistake degrades to + * exactly the pre-worker behavior instead of failing parses. + * + * Each dispatch copies the caller's bytes into a fresh `ArrayBuffer` and + * transfers that copy: the caller's `Buffer` may be a pooled slab or still in + * use (and is what the fallback parses), so it is never detached. Queued jobs + * hold only the caller's reference, so waiting adds no memory. + */ +export class XlsxWorkerPool { + private readonly queue: Job[] = [] + private readonly slots = new Set() + private disabled: boolean + + constructor(private readonly config: XlsxWorkerPoolConfig) { + this.disabled = config.workerPath === null + } + + async parse( + buffer: Buffer, + options: FileParseOptions, + fallback: InProcessParse + ): Promise { + if (this.disabled) return fallback() + const { signal } = options + signal?.throwIfAborted() + + return new Promise((resolve, reject) => { + const job: Job = { buffer, options, fallback, resolve, reject, detachAbort: () => {} } + if (signal) { + const onAbort = () => this.abort(job, signal.reason) + signal.addEventListener('abort', onAbort, { once: true }) + job.detachAbort = () => signal.removeEventListener('abort', onAbort) + } + this.queue.push(job) + this.pump() + }) + } + + private pump(): void { + while (this.queue.length > 0) { + if (this.disabled) { + for (const job of this.queue.splice(0)) this.runInProcess(job) + return + } + const slot = this.idleSlot() ?? this.spawn() + if (!slot) return + const job = this.queue.shift() + if (!job) return + slot.job = job + if (slot.ready) this.dispatch(slot) + } + } + + private idleSlot(): Slot | null { + for (const slot of this.slots) if (!slot.job) return slot + return null + } + + private spawn(): Slot | null { + const { workerPath } = this.config + if (!workerPath || this.slots.size >= this.config.size) return null + + let worker: Worker + try { + worker = new Worker(workerPath) + } catch (error) { + this.disable('XLSX parse worker failed to start; parsing in-process', error) + return null + } + + const slot: Slot = { worker, ready: false, job: null, idleTimer: null, startTimer: null } + this.slots.add(slot) + slot.startTimer = setTimeout(() => { + this.fail(slot, new Error('worker did not report ready')) + }, this.config.startTimeoutMs ?? XLSX_WORKER_START_TIMEOUT_MS) + + worker.on('message', (message: XlsxWorkerMessage) => this.onMessage(slot, message)) + worker.on('error', (error) => this.fail(slot, error)) + worker.on('exit', (code) => this.fail(slot, new Error(`worker exited with code ${code}`))) + return slot + } + + private onMessage(slot: Slot, message: XlsxWorkerMessage): void { + if (message.type === 'ready') { + slot.ready = true + this.clearStartTimer(slot) + if (slot.job) this.dispatch(slot) + else this.markIdle(slot) + return + } + + const job = slot.job + if (!job) return + slot.job = null + job.detachAbort() + if (message.type === 'result') job.resolve(message.result) + else job.reject(deserializeXlsxWorkerError(message.error)) + this.markIdle(slot) + this.pump() + } + + private dispatch(slot: Slot): void { + const job = slot.job + if (!job) return + if (slot.idleTimer) clearTimeout(slot.idleTimer) + slot.idleTimer = null + slot.worker.ref() + + const data = new Uint8Array(job.buffer.byteLength) + data.set(job.buffer) + const request: XlsxWorkerParseRequest = { + type: 'parse', + data, + options: omit(job.options, ['signal']), + } + try { + slot.worker.postMessage(request, [data.buffer]) + } catch (error) { + this.fail(slot, error) + } + } + + private markIdle(slot: Slot): void { + slot.worker.unref() + if (slot.idleTimer) clearTimeout(slot.idleTimer) + slot.idleTimer = setTimeout( + () => this.retire(slot), + this.config.idleTimeoutMs ?? XLSX_WORKER_IDLE_TIMEOUT_MS + ) + slot.idleTimer.unref?.() + } + + private abort(job: Job, reason: unknown): void { + job.detachAbort() + const queuedIndex = this.queue.indexOf(job) + if (queuedIndex >= 0) { + this.queue.splice(queuedIndex, 1) + job.reject(reason) + return + } + for (const slot of this.slots) { + if (slot.job !== job) continue + slot.job = null + this.retire(slot) + job.reject(reason) + this.pump() + return + } + } + + /** Removes a slot this pool chose to stop; its exit event is then ignored. */ + private retire(slot: Slot): void { + if (!this.slots.delete(slot)) return + this.clearStartTimer(slot) + if (slot.idleTimer) clearTimeout(slot.idleTimer) + void slot.worker.terminate().catch(() => {}) + } + + /** An unrequested worker failure: disable the pool and finish its jobs in-process. */ + private fail(slot: Slot, error: unknown): void { + if (!this.slots.has(slot)) return + const job = slot.job + slot.job = null + this.retire(slot) + this.disable('XLSX parse worker failed; parsing in-process for this process', error) + if (job) this.runInProcess(job) + this.pump() + } + + private disable(message: string, error: unknown): void { + if (this.disabled) return + this.disabled = true + logger.warn(message, { error }) + for (const slot of [...this.slots]) { + const job = slot.job + slot.job = null + this.retire(slot) + if (job) this.runInProcess(job) + } + for (const job of this.queue.splice(0)) this.runInProcess(job) + } + + private runInProcess(job: Job): void { + job.detachAbort() + job.fallback().then(job.resolve, job.reject) + } + + private clearStartTimer(slot: Slot): void { + if (slot.startTimer) clearTimeout(slot.startTimer) + slot.startTimer = null + } +} + +let defaultPool: XlsxWorkerPool | undefined + +function getDefaultPool(): XlsxWorkerPool { + if (defaultPool) return defaultPool + /** + * Off outside the production app server: dev and tests parse the live source + * rather than a possibly stale bundle, and Trigger.dev workers (Node, no + * bundle shipped) keep today's in-process path without a warning per process. + */ + const enabled = process.env.NODE_ENV === 'production' && !isInsideTriggerRun() + const workerPath = enabled ? resolveXlsxWorkerPath() : null + if (enabled && !workerPath) { + logger.warn('XLSX parse worker bundle not found; parsing in-process') + } + defaultPool = new XlsxWorkerPool({ workerPath, size: XLSX_WORKER_POOL_SIZE }) + return defaultPool +} + +/** + * Parses a spreadsheet buffer on a worker thread so SheetJS's synchronous + * `XLSX.read` never blocks the event loop, falling back to `inProcess` with + * identical output whenever the worker is unavailable. + */ +export function parseXlsxBufferOffThread( + buffer: Buffer, + options: FileParseOptions, + inProcess: InProcessParse +): Promise { + return getDefaultPool().parse(buffer, options, inProcess) +} diff --git a/apps/sim/lib/file-parsers/xlsx-worker-protocol.ts b/apps/sim/lib/file-parsers/xlsx-worker-protocol.ts new file mode 100644 index 00000000000..a439107ba43 --- /dev/null +++ b/apps/sim/lib/file-parsers/xlsx-worker-protocol.ts @@ -0,0 +1,80 @@ +import { FileParserError, type FileParserErrorCode } from '@/lib/file-parsers/errors' +import { ArchiveIntegrityError, ZipBombError } from '@/lib/file-parsers/ooxml-limits' +import type { FileParseOptions, FileParseResult } from '@/lib/file-parsers/types' + +/** + * Wire format between the XLSX parse worker and the main thread. + * + * Errors cannot cross `postMessage` with their class intact (structured clone + * turns every error into a plain `Error`), and callers branch on the class and + * `code` (`getFileParserErrorCode`), so each error the in-process parser can + * throw is encoded by kind and rebuilt as the same class on the main side. + */ + +type XlsxWorkerParseOptions = Omit + +export interface XlsxWorkerParseRequest { + type: 'parse' + data: Uint8Array + options: XlsxWorkerParseOptions +} + +interface SerializedCause { + name: string + message: string +} + +export type SerializedXlsxWorkerError = + | { kind: 'file-parser'; code: FileParserErrorCode; message: string; cause?: SerializedCause } + | { kind: 'zip-bomb'; message: string } + | { kind: 'archive-integrity'; message: string } + | { kind: 'error'; name: string; message: string } + +export type XlsxWorkerMessage = + | { type: 'ready' } + | { type: 'result'; result: FileParseResult } + | { type: 'error'; error: SerializedXlsxWorkerError } + +function serializeCause(cause: unknown): SerializedCause { + if (cause instanceof Error) return { name: cause.name, message: cause.message } + return { name: 'Error', message: String(cause) } +} + +export function serializeXlsxWorkerError(error: unknown): SerializedXlsxWorkerError { + if (error instanceof FileParserError) { + return { + kind: 'file-parser', + code: error.code, + message: error.message, + ...(error.cause !== undefined && { cause: serializeCause(error.cause) }), + } + } + if (error instanceof ZipBombError) return { kind: 'zip-bomb', message: error.message } + if (error instanceof ArchiveIntegrityError) { + return { kind: 'archive-integrity', message: error.message } + } + if (error instanceof Error) return { kind: 'error', name: error.name, message: error.message } + return { kind: 'error', name: 'Error', message: String(error) } +} + +export function deserializeXlsxWorkerError(error: SerializedXlsxWorkerError): Error { + switch (error.kind) { + case 'file-parser': { + let cause: Error | undefined + if (error.cause) { + cause = new Error(error.cause.message) + cause.name = error.cause.name + } + return new FileParserError(error.code, error.message, cause) + } + case 'zip-bomb': + return new ZipBombError(error.message) + case 'archive-integrity': + return new ArchiveIntegrityError(error.message) + default: { + const rebuilt = new Error(error.message) + rebuilt.name = error.name + return rebuilt + } + } +} diff --git a/apps/sim/lib/integrations/icon-mapping.ts b/apps/sim/lib/integrations/icon-mapping.ts index 27e4ff35a5d..a0356ceb8bd 100644 --- a/apps/sim/lib/integrations/icon-mapping.ts +++ b/apps/sim/lib/integrations/icon-mapping.ts @@ -71,6 +71,7 @@ import { DuckDuckGoIcon, DynamoDBIcon, DynatraceIcon, + EC2Icon, ElasticsearchIcon, ElevenLabsIcon, EmailBisonIcon, @@ -356,6 +357,7 @@ export const blockTypeToIconMap: Record = { duckduckgo: DuckDuckGoIcon, dynamodb: DynamoDBIcon, dynatrace: DynatraceIcon, + ec2: EC2Icon, elasticsearch: ElasticsearchIcon, elevenlabs: ElevenLabsIcon, emailbison: EmailBisonIcon, diff --git a/apps/sim/lib/internal/ec2/client.ts b/apps/sim/lib/internal/ec2/client.ts new file mode 100644 index 00000000000..300bed5922f --- /dev/null +++ b/apps/sim/lib/internal/ec2/client.ts @@ -0,0 +1,37 @@ +import { EC2Client, type Tag } from '@aws-sdk/client-ec2' + +interface Ec2ConnectionConfig { + region: string + accessKeyId: string + secretAccessKey: string +} + +export function createEc2Client( + config: Ec2ConnectionConfig, + options?: { maxAttempts?: number } +): EC2Client { + return new EC2Client({ + region: config.region, + ...(options?.maxAttempts !== undefined && { maxAttempts: options.maxAttempts }), + credentials: { + accessKeyId: config.accessKeyId, + secretAccessKey: config.secretAccessKey, + }, + }) +} + +/** Normalizes an SDK `Date` field to an ISO-8601 string so it survives JSON transport. */ +export function toIsoString(value?: Date): string | null { + return value ? value.toISOString() : null +} + +/** Flattens EC2's `[{ Key, Value }]` tag list into a plain `{ key: value }` record. */ +export function tagsToRecord(tags?: Tag[]): Record { + return Object.fromEntries( + (tags ?? []).flatMap((tag) => (tag.Key ? [[tag.Key, tag.Value ?? '']] : [])) + ) +} + +export function recordToTags(tags: Record): Tag[] { + return Object.entries(tags).map(([Key, Value]) => ({ Key, Value })) +} diff --git a/apps/sim/lib/internal/ec2/execute-tool.ts b/apps/sim/lib/internal/ec2/execute-tool.ts new file mode 100644 index 00000000000..885b1a46a33 --- /dev/null +++ b/apps/sim/lib/internal/ec2/execute-tool.ts @@ -0,0 +1,381 @@ +import { toError } from '@sim/utils/errors' +import type { z } from 'zod' +import { + executeEc2AllocateAddress, + executeEc2AssociateAddress, + executeEc2AuthorizeSecurityGroupIngress, + executeEc2CreateSnapshot, + executeEc2CreateTags, + executeEc2DeleteSnapshot, + executeEc2DeleteTags, + executeEc2DeleteVolume, + executeEc2DescribeAddresses, + executeEc2DescribeAvailabilityZones, + executeEc2DescribeImages, + executeEc2DescribeInstanceStatus, + executeEc2DescribeInstances, + executeEc2DescribeInternetGateways, + executeEc2DescribeKeyPairs, + executeEc2DescribeNatGateways, + executeEc2DescribeNetworkAcls, + executeEc2DescribeNetworkInterfaces, + executeEc2DescribeRegions, + executeEc2DescribeRouteTables, + executeEc2DescribeSecurityGroups, + executeEc2DescribeSnapshots, + executeEc2DescribeSubnets, + executeEc2DescribeVolumes, + executeEc2DescribeVpcEndpoints, + executeEc2DescribeVpcPeeringConnections, + executeEc2DescribeVpcs, + executeEc2DisassociateAddress, + executeEc2RebootInstances, + executeEc2ReleaseAddress, + executeEc2RevokeSecurityGroupIngress, + executeEc2StartInstances, + executeEc2StopInstances, + executeEc2TerminateInstances, +} from '@/lib/internal/ec2/operations' +import { + ec2AllocateAddressInputSchema, + ec2AssociateAddressInputSchema, + ec2AuthorizeSecurityGroupIngressInputSchema, + ec2CreateSnapshotInputSchema, + ec2CreateTagsInputSchema, + ec2DeleteSnapshotInputSchema, + ec2DeleteTagsInputSchema, + ec2DeleteVolumeInputSchema, + ec2DescribeAddressesInputSchema, + ec2DescribeAvailabilityZonesInputSchema, + ec2DescribeImagesInputSchema, + ec2DescribeInstanceStatusInputSchema, + ec2DescribeInstancesInputSchema, + ec2DescribeInternetGatewaysInputSchema, + ec2DescribeKeyPairsInputSchema, + ec2DescribeNatGatewaysInputSchema, + ec2DescribeNetworkAclsInputSchema, + ec2DescribeNetworkInterfacesInputSchema, + ec2DescribeRegionsInputSchema, + ec2DescribeRouteTablesInputSchema, + ec2DescribeSecurityGroupsInputSchema, + ec2DescribeSnapshotsInputSchema, + ec2DescribeSubnetsInputSchema, + ec2DescribeVolumesInputSchema, + ec2DescribeVpcEndpointsInputSchema, + ec2DescribeVpcPeeringConnectionsInputSchema, + ec2DescribeVpcsInputSchema, + ec2DisassociateAddressInputSchema, + ec2InstanceIdsInputSchema, + ec2ReleaseAddressInputSchema, + ec2RevokeSecurityGroupIngressInputSchema, + ec2StopInstancesInputSchema, +} from '@/lib/internal/ec2/schema' +import type { InternalToolOperationHandler } from '@/lib/internal/tool-operations/types' + +async function executeOperation( + schema: z.ZodType, + input: unknown, + execute: (input: TInput, signal?: AbortSignal) => Promise, + errorMessage: string, + signal?: AbortSignal +): Promise { + signal?.throwIfAborted() + const parsed = schema.safeParse(input) + if (!parsed.success) { + const reasons = parsed.error.issues.map((issue) => issue.message).join('; ') + return Response.json( + { error: `Invalid request data: ${reasons}`, details: parsed.error.issues }, + { status: 400 } + ) + } + + try { + const result = await execute(parsed.data, signal) + signal?.throwIfAborted() + return Response.json(result) + } catch (error) { + signal?.throwIfAborted() + return Response.json({ error: `${errorMessage}: ${toError(error).message}` }, { status: 500 }) + } +} + +export const executeEc2Tool: InternalToolOperationHandler = async ({ toolId, input, signal }) => { + signal?.throwIfAborted() + + switch (toolId) { + case 'ec2_describe_instances': + return executeOperation( + ec2DescribeInstancesInputSchema, + input, + executeEc2DescribeInstances, + 'Failed to describe EC2 instances', + signal + ) + case 'ec2_describe_instance_status': + return executeOperation( + ec2DescribeInstanceStatusInputSchema, + input, + executeEc2DescribeInstanceStatus, + 'Failed to describe EC2 instance status', + signal + ) + case 'ec2_start_instances': + return executeOperation( + ec2InstanceIdsInputSchema, + input, + executeEc2StartInstances, + 'Failed to start EC2 instances', + signal + ) + case 'ec2_stop_instances': + return executeOperation( + ec2StopInstancesInputSchema, + input, + executeEc2StopInstances, + 'Failed to stop EC2 instances', + signal + ) + case 'ec2_reboot_instances': + return executeOperation( + ec2InstanceIdsInputSchema, + input, + executeEc2RebootInstances, + 'Failed to reboot EC2 instances', + signal + ) + case 'ec2_terminate_instances': + return executeOperation( + ec2InstanceIdsInputSchema, + input, + executeEc2TerminateInstances, + 'Failed to terminate EC2 instances', + signal + ) + case 'ec2_describe_addresses': + return executeOperation( + ec2DescribeAddressesInputSchema, + input, + executeEc2DescribeAddresses, + 'Failed to describe Elastic IP addresses', + signal + ) + case 'ec2_allocate_address': + return executeOperation( + ec2AllocateAddressInputSchema, + input, + executeEc2AllocateAddress, + 'Failed to allocate Elastic IP address', + signal + ) + case 'ec2_associate_address': + return executeOperation( + ec2AssociateAddressInputSchema, + input, + executeEc2AssociateAddress, + 'Failed to associate Elastic IP address', + signal + ) + case 'ec2_disassociate_address': + return executeOperation( + ec2DisassociateAddressInputSchema, + input, + executeEc2DisassociateAddress, + 'Failed to disassociate Elastic IP address', + signal + ) + case 'ec2_release_address': + return executeOperation( + ec2ReleaseAddressInputSchema, + input, + executeEc2ReleaseAddress, + 'Failed to release Elastic IP address', + signal + ) + case 'ec2_describe_nat_gateways': + return executeOperation( + ec2DescribeNatGatewaysInputSchema, + input, + executeEc2DescribeNatGateways, + 'Failed to describe NAT gateways', + signal + ) + case 'ec2_describe_route_tables': + return executeOperation( + ec2DescribeRouteTablesInputSchema, + input, + executeEc2DescribeRouteTables, + 'Failed to describe route tables', + signal + ) + case 'ec2_describe_vpcs': + return executeOperation( + ec2DescribeVpcsInputSchema, + input, + executeEc2DescribeVpcs, + 'Failed to describe VPCs', + signal + ) + case 'ec2_describe_subnets': + return executeOperation( + ec2DescribeSubnetsInputSchema, + input, + executeEc2DescribeSubnets, + 'Failed to describe subnets', + signal + ) + case 'ec2_describe_security_groups': + return executeOperation( + ec2DescribeSecurityGroupsInputSchema, + input, + executeEc2DescribeSecurityGroups, + 'Failed to describe security groups', + signal + ) + case 'ec2_describe_internet_gateways': + return executeOperation( + ec2DescribeInternetGatewaysInputSchema, + input, + executeEc2DescribeInternetGateways, + 'Failed to describe internet gateways', + signal + ) + case 'ec2_describe_network_interfaces': + return executeOperation( + ec2DescribeNetworkInterfacesInputSchema, + input, + executeEc2DescribeNetworkInterfaces, + 'Failed to describe network interfaces', + signal + ) + case 'ec2_describe_volumes': + return executeOperation( + ec2DescribeVolumesInputSchema, + input, + executeEc2DescribeVolumes, + 'Failed to describe EBS volumes', + signal + ) + case 'ec2_describe_snapshots': + return executeOperation( + ec2DescribeSnapshotsInputSchema, + input, + executeEc2DescribeSnapshots, + 'Failed to describe EBS snapshots', + signal + ) + case 'ec2_create_snapshot': + return executeOperation( + ec2CreateSnapshotInputSchema, + input, + executeEc2CreateSnapshot, + 'Failed to create EBS snapshot', + signal + ) + case 'ec2_create_tags': + return executeOperation( + ec2CreateTagsInputSchema, + input, + executeEc2CreateTags, + 'Failed to create EC2 tags', + signal + ) + case 'ec2_delete_tags': + return executeOperation( + ec2DeleteTagsInputSchema, + input, + executeEc2DeleteTags, + 'Failed to delete EC2 tags', + signal + ) + case 'ec2_describe_regions': + return executeOperation( + ec2DescribeRegionsInputSchema, + input, + executeEc2DescribeRegions, + 'Failed to describe EC2 regions', + signal + ) + case 'ec2_describe_availability_zones': + return executeOperation( + ec2DescribeAvailabilityZonesInputSchema, + input, + executeEc2DescribeAvailabilityZones, + 'Failed to describe availability zones', + signal + ) + case 'ec2_describe_network_acls': + return executeOperation( + ec2DescribeNetworkAclsInputSchema, + input, + executeEc2DescribeNetworkAcls, + 'Failed to describe network ACLs', + signal + ) + case 'ec2_describe_vpc_endpoints': + return executeOperation( + ec2DescribeVpcEndpointsInputSchema, + input, + executeEc2DescribeVpcEndpoints, + 'Failed to describe VPC endpoints', + signal + ) + case 'ec2_describe_vpc_peering_connections': + return executeOperation( + ec2DescribeVpcPeeringConnectionsInputSchema, + input, + executeEc2DescribeVpcPeeringConnections, + 'Failed to describe VPC peering connections', + signal + ) + case 'ec2_describe_images': + return executeOperation( + ec2DescribeImagesInputSchema, + input, + executeEc2DescribeImages, + 'Failed to describe AMIs', + signal + ) + case 'ec2_describe_key_pairs': + return executeOperation( + ec2DescribeKeyPairsInputSchema, + input, + executeEc2DescribeKeyPairs, + 'Failed to describe key pairs', + signal + ) + case 'ec2_authorize_security_group_ingress': + return executeOperation( + ec2AuthorizeSecurityGroupIngressInputSchema, + input, + executeEc2AuthorizeSecurityGroupIngress, + 'Failed to authorize security group ingress', + signal + ) + case 'ec2_revoke_security_group_ingress': + return executeOperation( + ec2RevokeSecurityGroupIngressInputSchema, + input, + executeEc2RevokeSecurityGroupIngress, + 'Failed to revoke security group ingress', + signal + ) + case 'ec2_delete_volume': + return executeOperation( + ec2DeleteVolumeInputSchema, + input, + executeEc2DeleteVolume, + 'Failed to delete EBS volume', + signal + ) + case 'ec2_delete_snapshot': + return executeOperation( + ec2DeleteSnapshotInputSchema, + input, + executeEc2DeleteSnapshot, + 'Failed to delete EBS snapshot', + signal + ) + default: + return Response.json({ error: `Unsupported EC2 tool: ${toolId}` }, { status: 500 }) + } +} diff --git a/apps/sim/lib/internal/ec2/operations.ts b/apps/sim/lib/internal/ec2/operations.ts new file mode 100644 index 00000000000..13e72a1141c --- /dev/null +++ b/apps/sim/lib/internal/ec2/operations.ts @@ -0,0 +1,1097 @@ +import { + AllocateAddressCommand, + AssociateAddressCommand, + AuthorizeSecurityGroupIngressCommand, + CreateSnapshotCommand, + CreateTagsCommand, + DeleteSnapshotCommand, + DeleteTagsCommand, + DeleteVolumeCommand, + DescribeAddressesCommand, + DescribeAvailabilityZonesCommand, + DescribeImagesCommand, + DescribeInstanceStatusCommand, + DescribeInstancesCommand, + DescribeInternetGatewaysCommand, + DescribeKeyPairsCommand, + DescribeNatGatewaysCommand, + DescribeNetworkAclsCommand, + DescribeNetworkInterfacesCommand, + DescribeRegionsCommand, + DescribeRouteTablesCommand, + DescribeSecurityGroupsCommand, + DescribeSnapshotsCommand, + DescribeSubnetsCommand, + DescribeVolumesCommand, + DescribeVpcEndpointsCommand, + DescribeVpcPeeringConnectionsCommand, + DescribeVpcsCommand, + DisassociateAddressCommand, + type EC2Client, + type GroupIdentifier, + type InstanceState, + type InstanceStateChange, + type InstanceStatusSummary, + type IpPermission, + RebootInstancesCommand, + ReleaseAddressCommand, + RevokeSecurityGroupIngressCommand, + StartInstancesCommand, + StopInstancesCommand, + TerminateInstancesCommand, + type VpcPeeringConnectionVpcInfo, +} from '@aws-sdk/client-ec2' +import { createEc2Client, recordToTags, tagsToRecord, toIsoString } from '@/lib/internal/ec2/client' +import type { + Ec2AllocateAddressInput, + Ec2AssociateAddressInput, + Ec2AuthorizeSecurityGroupIngressInput, + Ec2CreateSnapshotInput, + Ec2CreateTagsInput, + Ec2DeleteSnapshotInput, + Ec2DeleteTagsInput, + Ec2DeleteVolumeInput, + Ec2DescribeAddressesInput, + Ec2DescribeAvailabilityZonesInput, + Ec2DescribeImagesInput, + Ec2DescribeInstanceStatusInput, + Ec2DescribeInstancesInput, + Ec2DescribeInternetGatewaysInput, + Ec2DescribeKeyPairsInput, + Ec2DescribeNatGatewaysInput, + Ec2DescribeNetworkAclsInput, + Ec2DescribeNetworkInterfacesInput, + Ec2DescribeRegionsInput, + Ec2DescribeRouteTablesInput, + Ec2DescribeSecurityGroupsInput, + Ec2DescribeSnapshotsInput, + Ec2DescribeSubnetsInput, + Ec2DescribeVolumesInput, + Ec2DescribeVpcEndpointsInput, + Ec2DescribeVpcPeeringConnectionsInput, + Ec2DescribeVpcsInput, + Ec2DisassociateAddressInput, + Ec2InstanceIdsInput, + Ec2ReleaseAddressInput, + Ec2RevokeSecurityGroupIngressInput, + Ec2StopInstancesInput, +} from '@/lib/internal/ec2/schema' + +/** Page size used when the caller lists without IDs and without an explicit `maxResults`. */ +const DEFAULT_PAGE_SIZE = 100 + +/** AllocateAddress and CreateSnapshot take no client token, so an SDK retry could duplicate them. */ +const NON_IDEMPOTENT_MAX_ATTEMPTS = 1 + +interface PaginationInput { + maxResults?: number + nextToken?: string +} + +/** + * EC2 rejects `MaxResults` alongside explicit IDs on several describe calls, and an ID list is + * already bounded, so pagination applies only to filter/list-all requests. + */ +function pageParams(ids: string[] | undefined, input: PaginationInput) { + if (ids && ids.length > 0) return {} + return { + MaxResults: input.maxResults ?? DEFAULT_PAGE_SIZE, + ...(input.nextToken && { NextToken: input.nextToken }), + } +} + +async function withClient( + input: { region: string; accessKeyId: string; secretAccessKey: string }, + run: (client: EC2Client) => Promise, + options?: { maxAttempts?: number } +): Promise { + const client = createEc2Client(input, options) + try { + return await run(client) + } finally { + client.destroy() + } +} + +function mapGroups(groups?: GroupIdentifier[]) { + return (groups ?? []).map((group) => ({ + groupId: group.GroupId ?? null, + groupName: group.GroupName ?? null, + })) +} + +function mapStatusSummary(summary?: InstanceStatusSummary) { + return summary?.Status ?? null +} + +function mapStateName(state?: InstanceState) { + return state?.Name ?? null +} + +function mapStateChanges(changes?: InstanceStateChange[]) { + return (changes ?? []).map((change) => ({ + instanceId: change.InstanceId ?? '', + currentState: mapStateName(change.CurrentState), + previousState: mapStateName(change.PreviousState), + })) +} + +function mapIpPermissions(permissions?: IpPermission[]) { + return (permissions ?? []).map((permission) => ({ + ipProtocol: permission.IpProtocol ?? null, + fromPort: permission.FromPort ?? null, + toPort: permission.ToPort ?? null, + ipv4Ranges: (permission.IpRanges ?? []).map((range) => ({ + cidr: range.CidrIp ?? null, + description: range.Description ?? null, + })), + ipv6Ranges: (permission.Ipv6Ranges ?? []).map((range) => ({ + cidr: range.CidrIpv6 ?? null, + description: range.Description ?? null, + })), + referencedGroups: (permission.UserIdGroupPairs ?? []).map((pair) => ({ + groupId: pair.GroupId ?? null, + userId: pair.UserId ?? null, + description: pair.Description ?? null, + })), + prefixListIds: (permission.PrefixListIds ?? []) + .map((prefixList) => prefixList.PrefixListId) + .filter((id): id is string => Boolean(id)), + })) +} + +export async function executeEc2DescribeInstances( + input: Ec2DescribeInstancesInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeInstancesCommand({ + ...(input.instanceIds && { InstanceIds: input.instanceIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.instanceIds, input), + }), + { abortSignal: signal } + ) + const instances = (response.Reservations ?? []).flatMap((reservation) => + (reservation.Instances ?? []).map((instance) => ({ + instanceId: instance.InstanceId ?? '', + instanceType: instance.InstanceType ?? null, + state: mapStateName(instance.State), + stateReason: instance.StateReason?.Message ?? null, + launchTime: toIsoString(instance.LaunchTime), + availabilityZone: instance.Placement?.AvailabilityZone ?? null, + vpcId: instance.VpcId ?? null, + subnetId: instance.SubnetId ?? null, + privateIpAddress: instance.PrivateIpAddress ?? null, + publicIpAddress: instance.PublicIpAddress ?? null, + privateDnsName: instance.PrivateDnsName || null, + publicDnsName: instance.PublicDnsName || null, + imageId: instance.ImageId ?? null, + keyName: instance.KeyName ?? null, + platformDetails: instance.PlatformDetails ?? null, + architecture: instance.Architecture ?? null, + iamInstanceProfileArn: instance.IamInstanceProfile?.Arn ?? null, + securityGroups: mapGroups(instance.SecurityGroups), + tags: tagsToRecord(instance.Tags), + })) + ) + return { instances, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeInstanceStatus( + input: Ec2DescribeInstanceStatusInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeInstanceStatusCommand({ + ...(input.instanceIds && { InstanceIds: input.instanceIds }), + ...(input.filters && { Filters: input.filters }), + ...(input.includeAllInstances !== undefined && { + IncludeAllInstances: input.includeAllInstances, + }), + ...pageParams(input.instanceIds, input), + }), + { abortSignal: signal } + ) + const instanceStatuses = (response.InstanceStatuses ?? []).map((status) => ({ + instanceId: status.InstanceId ?? '', + availabilityZone: status.AvailabilityZone ?? null, + instanceState: mapStateName(status.InstanceState), + instanceStatus: mapStatusSummary(status.InstanceStatus), + systemStatus: mapStatusSummary(status.SystemStatus), + attachedEbsStatus: status.AttachedEbsStatus?.Status ?? null, + events: (status.Events ?? []).map((event) => ({ + code: event.Code ?? null, + description: event.Description ?? null, + notBefore: toIsoString(event.NotBefore), + notAfter: toIsoString(event.NotAfter), + })), + })) + return { instanceStatuses, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2StartInstances(input: Ec2InstanceIdsInput, signal?: AbortSignal) { + return withClient(input, async (client) => { + const response = await client.send( + new StartInstancesCommand({ InstanceIds: input.instanceIds }), + { abortSignal: signal } + ) + return { instances: mapStateChanges(response.StartingInstances) } + }) +} + +export async function executeEc2StopInstances(input: Ec2StopInstancesInput, signal?: AbortSignal) { + return withClient(input, async (client) => { + const response = await client.send( + new StopInstancesCommand({ + InstanceIds: input.instanceIds, + ...(input.hibernate !== undefined && { Hibernate: input.hibernate }), + ...(input.force !== undefined && { Force: input.force }), + }), + { abortSignal: signal } + ) + return { instances: mapStateChanges(response.StoppingInstances) } + }) +} + +export async function executeEc2RebootInstances(input: Ec2InstanceIdsInput, signal?: AbortSignal) { + return withClient(input, async (client) => { + await client.send(new RebootInstancesCommand({ InstanceIds: input.instanceIds }), { + abortSignal: signal, + }) + return { rebooted: true, instanceIds: input.instanceIds } + }) +} + +export async function executeEc2TerminateInstances( + input: Ec2InstanceIdsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new TerminateInstancesCommand({ InstanceIds: input.instanceIds }), + { abortSignal: signal } + ) + return { instances: mapStateChanges(response.TerminatingInstances) } + }) +} + +export async function executeEc2DescribeAddresses( + input: Ec2DescribeAddressesInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeAddressesCommand({ + ...(input.publicIps && { PublicIps: input.publicIps }), + ...(input.allocationIds && { AllocationIds: input.allocationIds }), + ...(input.filters && { Filters: input.filters }), + }), + { abortSignal: signal } + ) + const addresses = (response.Addresses ?? []).map((address) => ({ + publicIp: address.PublicIp ?? null, + allocationId: address.AllocationId ?? null, + associationId: address.AssociationId ?? null, + domain: address.Domain ?? null, + instanceId: address.InstanceId || null, + networkInterfaceId: address.NetworkInterfaceId ?? null, + networkInterfaceOwnerId: address.NetworkInterfaceOwnerId ?? null, + privateIpAddress: address.PrivateIpAddress ?? null, + publicIpv4Pool: address.PublicIpv4Pool ?? null, + networkBorderGroup: address.NetworkBorderGroup ?? null, + serviceManaged: address.ServiceManaged ?? null, + tags: tagsToRecord(address.Tags), + })) + return { addresses } + }) +} + +export async function executeEc2AllocateAddress( + input: Ec2AllocateAddressInput, + signal?: AbortSignal +) { + return withClient( + input, + async (client) => { + const response = await client.send( + new AllocateAddressCommand({ + Domain: 'vpc', + ...(input.networkBorderGroup && { NetworkBorderGroup: input.networkBorderGroup }), + ...(input.publicIpv4Pool && { PublicIpv4Pool: input.publicIpv4Pool }), + ...(input.tags && + Object.keys(input.tags).length > 0 && { + TagSpecifications: [{ ResourceType: 'elastic-ip', Tags: recordToTags(input.tags) }], + }), + }), + { abortSignal: signal } + ) + return { + allocationId: response.AllocationId ?? '', + publicIp: response.PublicIp ?? '', + domain: response.Domain ?? null, + networkBorderGroup: response.NetworkBorderGroup ?? null, + publicIpv4Pool: response.PublicIpv4Pool ?? null, + } + }, + { maxAttempts: NON_IDEMPOTENT_MAX_ATTEMPTS } + ) +} + +export async function executeEc2AssociateAddress( + input: Ec2AssociateAddressInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new AssociateAddressCommand({ + AllocationId: input.allocationId, + ...(input.instanceId && { InstanceId: input.instanceId }), + ...(input.networkInterfaceId && { NetworkInterfaceId: input.networkInterfaceId }), + ...(input.privateIpAddress && { PrivateIpAddress: input.privateIpAddress }), + ...(input.allowReassociation !== undefined && { + AllowReassociation: input.allowReassociation, + }), + }), + { abortSignal: signal } + ) + return { associationId: response.AssociationId ?? '' } + }) +} + +export async function executeEc2DisassociateAddress( + input: Ec2DisassociateAddressInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + await client.send(new DisassociateAddressCommand({ AssociationId: input.associationId }), { + abortSignal: signal, + }) + return { disassociated: true, associationId: input.associationId } + }) +} + +export async function executeEc2ReleaseAddress( + input: Ec2ReleaseAddressInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + await client.send( + new ReleaseAddressCommand({ + AllocationId: input.allocationId, + ...(input.networkBorderGroup && { NetworkBorderGroup: input.networkBorderGroup }), + }), + { abortSignal: signal } + ) + return { released: true, allocationId: input.allocationId } + }) +} + +export async function executeEc2DescribeNatGateways( + input: Ec2DescribeNatGatewaysInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeNatGatewaysCommand({ + ...(input.natGatewayIds && { NatGatewayIds: input.natGatewayIds }), + ...(input.filters && { Filter: input.filters }), + ...pageParams(input.natGatewayIds, input), + }), + { abortSignal: signal } + ) + const natGateways = (response.NatGateways ?? []).map((gateway) => ({ + natGatewayId: gateway.NatGatewayId ?? '', + state: gateway.State ?? null, + connectivityType: gateway.ConnectivityType ?? null, + vpcId: gateway.VpcId ?? null, + subnetId: gateway.SubnetId ?? null, + createTime: toIsoString(gateway.CreateTime), + deleteTime: toIsoString(gateway.DeleteTime), + failureCode: gateway.FailureCode ?? null, + failureMessage: gateway.FailureMessage ?? null, + addresses: (gateway.NatGatewayAddresses ?? []).map((address) => ({ + allocationId: address.AllocationId ?? null, + networkInterfaceId: address.NetworkInterfaceId ?? null, + privateIp: address.PrivateIp ?? null, + publicIp: address.PublicIp ?? null, + associationId: address.AssociationId ?? null, + isPrimary: address.IsPrimary ?? null, + status: address.Status ?? null, + })), + tags: tagsToRecord(gateway.Tags), + })) + return { natGateways, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeRouteTables( + input: Ec2DescribeRouteTablesInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeRouteTablesCommand({ + ...(input.routeTableIds && { RouteTableIds: input.routeTableIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.routeTableIds, input), + }), + { abortSignal: signal } + ) + const routeTables = (response.RouteTables ?? []).map((table) => ({ + routeTableId: table.RouteTableId ?? '', + vpcId: table.VpcId ?? null, + ownerId: table.OwnerId ?? null, + routes: (table.Routes ?? []).map((route) => ({ + destinationCidrBlock: route.DestinationCidrBlock ?? null, + destinationIpv6CidrBlock: route.DestinationIpv6CidrBlock ?? null, + destinationPrefixListId: route.DestinationPrefixListId ?? null, + gatewayId: route.GatewayId ?? null, + natGatewayId: route.NatGatewayId ?? null, + transitGatewayId: route.TransitGatewayId ?? null, + vpcPeeringConnectionId: route.VpcPeeringConnectionId ?? null, + networkInterfaceId: route.NetworkInterfaceId ?? null, + instanceId: route.InstanceId ?? null, + egressOnlyInternetGatewayId: route.EgressOnlyInternetGatewayId ?? null, + state: route.State ?? null, + origin: route.Origin ?? null, + })), + associations: (table.Associations ?? []).map((association) => ({ + associationId: association.RouteTableAssociationId ?? null, + main: association.Main ?? false, + subnetId: association.SubnetId ?? null, + gatewayId: association.GatewayId ?? null, + state: association.AssociationState?.State ?? null, + })), + tags: tagsToRecord(table.Tags), + })) + return { routeTables, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeVpcs(input: Ec2DescribeVpcsInput, signal?: AbortSignal) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeVpcsCommand({ + ...(input.vpcIds && { VpcIds: input.vpcIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.vpcIds, input), + }), + { abortSignal: signal } + ) + const vpcs = (response.Vpcs ?? []).map((vpc) => ({ + vpcId: vpc.VpcId ?? '', + cidrBlock: vpc.CidrBlock ?? null, + cidrBlocks: (vpc.CidrBlockAssociationSet ?? []) + .map((association) => association.CidrBlock) + .filter((cidr): cidr is string => Boolean(cidr)), + ipv6CidrBlocks: (vpc.Ipv6CidrBlockAssociationSet ?? []) + .map((association) => association.Ipv6CidrBlock) + .filter((cidr): cidr is string => Boolean(cidr)), + state: vpc.State ?? null, + isDefault: vpc.IsDefault ?? false, + instanceTenancy: vpc.InstanceTenancy ?? null, + dhcpOptionsId: vpc.DhcpOptionsId ?? null, + ownerId: vpc.OwnerId ?? null, + tags: tagsToRecord(vpc.Tags), + })) + return { vpcs, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeSubnets( + input: Ec2DescribeSubnetsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeSubnetsCommand({ + ...(input.subnetIds && { SubnetIds: input.subnetIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.subnetIds, input), + }), + { abortSignal: signal } + ) + const subnets = (response.Subnets ?? []).map((subnet) => ({ + subnetId: subnet.SubnetId ?? '', + subnetArn: subnet.SubnetArn ?? null, + vpcId: subnet.VpcId ?? null, + cidrBlock: subnet.CidrBlock ?? null, + ipv6CidrBlocks: (subnet.Ipv6CidrBlockAssociationSet ?? []) + .map((association) => association.Ipv6CidrBlock) + .filter((cidr): cidr is string => Boolean(cidr)), + availabilityZone: subnet.AvailabilityZone ?? null, + availabilityZoneId: subnet.AvailabilityZoneId ?? null, + availableIpAddressCount: subnet.AvailableIpAddressCount ?? null, + state: subnet.State ?? null, + defaultForAz: subnet.DefaultForAz ?? false, + mapPublicIpOnLaunch: subnet.MapPublicIpOnLaunch ?? false, + ownerId: subnet.OwnerId ?? null, + tags: tagsToRecord(subnet.Tags), + })) + return { subnets, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeSecurityGroups( + input: Ec2DescribeSecurityGroupsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeSecurityGroupsCommand({ + ...(input.groupIds && { GroupIds: input.groupIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.groupIds, input), + }), + { abortSignal: signal } + ) + const securityGroups = (response.SecurityGroups ?? []).map((group) => ({ + groupId: group.GroupId ?? '', + groupName: group.GroupName ?? null, + description: group.Description ?? null, + vpcId: group.VpcId ?? null, + ownerId: group.OwnerId ?? null, + ingressRules: mapIpPermissions(group.IpPermissions), + egressRules: mapIpPermissions(group.IpPermissionsEgress), + tags: tagsToRecord(group.Tags), + })) + return { securityGroups, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeInternetGateways( + input: Ec2DescribeInternetGatewaysInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeInternetGatewaysCommand({ + ...(input.internetGatewayIds && { InternetGatewayIds: input.internetGatewayIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.internetGatewayIds, input), + }), + { abortSignal: signal } + ) + const internetGateways = (response.InternetGateways ?? []).map((gateway) => ({ + internetGatewayId: gateway.InternetGatewayId ?? '', + ownerId: gateway.OwnerId ?? null, + attachments: (gateway.Attachments ?? []).map((attachment) => ({ + vpcId: attachment.VpcId ?? null, + state: attachment.State ?? null, + })), + tags: tagsToRecord(gateway.Tags), + })) + return { internetGateways, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeNetworkInterfaces( + input: Ec2DescribeNetworkInterfacesInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeNetworkInterfacesCommand({ + ...(input.networkInterfaceIds && { NetworkInterfaceIds: input.networkInterfaceIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.networkInterfaceIds, input), + }), + { abortSignal: signal } + ) + const networkInterfaces = (response.NetworkInterfaces ?? []).map((eni) => ({ + networkInterfaceId: eni.NetworkInterfaceId ?? '', + interfaceType: eni.InterfaceType ?? null, + status: eni.Status ?? null, + description: eni.Description || null, + vpcId: eni.VpcId ?? null, + subnetId: eni.SubnetId ?? null, + availabilityZone: eni.AvailabilityZone ?? null, + privateIpAddress: eni.PrivateIpAddress ?? null, + privateIpAddresses: (eni.PrivateIpAddresses ?? []) + .map((address) => address.PrivateIpAddress) + .filter((ip): ip is string => Boolean(ip)), + publicIp: eni.Association?.PublicIp ?? null, + macAddress: eni.MacAddress ?? null, + requesterManaged: eni.RequesterManaged ?? false, + attachment: eni.Attachment + ? { + attachmentId: eni.Attachment.AttachmentId ?? null, + instanceId: eni.Attachment.InstanceId ?? null, + deviceIndex: eni.Attachment.DeviceIndex ?? null, + status: eni.Attachment.Status ?? null, + deleteOnTermination: eni.Attachment.DeleteOnTermination ?? null, + } + : null, + securityGroups: mapGroups(eni.Groups), + tags: tagsToRecord(eni.TagSet), + })) + return { networkInterfaces, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeVolumes( + input: Ec2DescribeVolumesInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeVolumesCommand({ + ...(input.volumeIds && { VolumeIds: input.volumeIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.volumeIds, input), + }), + { abortSignal: signal } + ) + const volumes = (response.Volumes ?? []).map((volume) => ({ + volumeId: volume.VolumeId ?? '', + volumeType: volume.VolumeType ?? null, + size: volume.Size ?? null, + state: volume.State ?? null, + availabilityZone: volume.AvailabilityZone ?? null, + iops: volume.Iops ?? null, + throughput: volume.Throughput ?? null, + encrypted: volume.Encrypted ?? false, + kmsKeyId: volume.KmsKeyId ?? null, + snapshotId: volume.SnapshotId || null, + createTime: toIsoString(volume.CreateTime), + multiAttachEnabled: volume.MultiAttachEnabled ?? false, + attachments: (volume.Attachments ?? []).map((attachment) => ({ + instanceId: attachment.InstanceId ?? null, + device: attachment.Device ?? null, + state: attachment.State ?? null, + attachTime: toIsoString(attachment.AttachTime), + deleteOnTermination: attachment.DeleteOnTermination ?? null, + })), + tags: tagsToRecord(volume.Tags), + })) + return { volumes, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeSnapshots( + input: Ec2DescribeSnapshotsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeSnapshotsCommand({ + ...(input.snapshotIds && { SnapshotIds: input.snapshotIds }), + // Without an owner scope a list call also returns every public snapshot in the region; + // explicit snapshot IDs may name snapshots shared from another account. + ...(input.ownerIds + ? { OwnerIds: input.ownerIds } + : !input.snapshotIds && { OwnerIds: ['self'] }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.snapshotIds, input), + }), + { abortSignal: signal } + ) + const snapshots = (response.Snapshots ?? []).map((snapshot) => ({ + snapshotId: snapshot.SnapshotId ?? '', + volumeId: snapshot.VolumeId ?? null, + volumeSize: snapshot.VolumeSize ?? null, + state: snapshot.State ?? null, + progress: snapshot.Progress ?? null, + startTime: toIsoString(snapshot.StartTime), + description: snapshot.Description || null, + ownerId: snapshot.OwnerId ?? null, + encrypted: snapshot.Encrypted ?? false, + kmsKeyId: snapshot.KmsKeyId ?? null, + storageTier: snapshot.StorageTier ?? null, + tags: tagsToRecord(snapshot.Tags), + })) + return { snapshots, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2CreateSnapshot( + input: Ec2CreateSnapshotInput, + signal?: AbortSignal +) { + return withClient( + input, + async (client) => { + const response = await client.send( + new CreateSnapshotCommand({ + VolumeId: input.volumeId, + ...(input.description && { Description: input.description }), + ...(input.tags && + Object.keys(input.tags).length > 0 && { + TagSpecifications: [{ ResourceType: 'snapshot', Tags: recordToTags(input.tags) }], + }), + }), + { abortSignal: signal } + ) + return { + snapshotId: response.SnapshotId ?? '', + volumeId: response.VolumeId ?? input.volumeId, + volumeSize: response.VolumeSize ?? null, + state: response.State ?? null, + startTime: toIsoString(response.StartTime), + description: response.Description || null, + encrypted: response.Encrypted ?? false, + ownerId: response.OwnerId ?? null, + tags: tagsToRecord(response.Tags), + } + }, + { maxAttempts: NON_IDEMPOTENT_MAX_ATTEMPTS } + ) +} + +export async function executeEc2CreateTags(input: Ec2CreateTagsInput, signal?: AbortSignal) { + return withClient(input, async (client) => { + const tags = input.tags ?? {} + await client.send( + new CreateTagsCommand({ Resources: input.resourceIds, Tags: recordToTags(tags) }), + { abortSignal: signal } + ) + return { resourceIds: input.resourceIds, tags } + }) +} + +export async function executeEc2DeleteTags(input: Ec2DeleteTagsInput, signal?: AbortSignal) { + return withClient(input, async (client) => { + await client.send( + new DeleteTagsCommand({ + Resources: input.resourceIds, + Tags: input.tagKeys.map((Key) => ({ Key })), + }), + { abortSignal: signal } + ) + return { resourceIds: input.resourceIds, tagKeys: input.tagKeys } + }) +} + +export async function executeEc2DescribeRegions( + input: Ec2DescribeRegionsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeRegionsCommand({ + ...(input.regionNames && { RegionNames: input.regionNames }), + ...(input.allRegions !== undefined && { AllRegions: input.allRegions }), + ...(input.filters && { Filters: input.filters }), + }), + { abortSignal: signal } + ) + const regions = (response.Regions ?? []).map((region) => ({ + regionName: region.RegionName ?? '', + endpoint: region.Endpoint ?? null, + optInStatus: region.OptInStatus ?? null, + })) + return { regions } + }) +} + +export async function executeEc2DescribeAvailabilityZones( + input: Ec2DescribeAvailabilityZonesInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeAvailabilityZonesCommand({ + ...(input.zoneNames && { ZoneNames: input.zoneNames }), + ...(input.allAvailabilityZones !== undefined && { + AllAvailabilityZones: input.allAvailabilityZones, + }), + ...(input.filters && { Filters: input.filters }), + }), + { abortSignal: signal } + ) + const availabilityZones = (response.AvailabilityZones ?? []).map((zone) => ({ + zoneName: zone.ZoneName ?? '', + zoneId: zone.ZoneId ?? null, + zoneType: zone.ZoneType ?? null, + state: zone.State ?? null, + regionName: zone.RegionName ?? null, + groupName: zone.GroupName ?? null, + networkBorderGroup: zone.NetworkBorderGroup ?? null, + optInStatus: zone.OptInStatus ?? null, + })) + return { availabilityZones } + }) +} + +export async function executeEc2DescribeNetworkAcls( + input: Ec2DescribeNetworkAclsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeNetworkAclsCommand({ + ...(input.networkAclIds && { NetworkAclIds: input.networkAclIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.networkAclIds, input), + }), + { abortSignal: signal } + ) + const networkAcls = (response.NetworkAcls ?? []).map((acl) => ({ + networkAclId: acl.NetworkAclId ?? '', + vpcId: acl.VpcId ?? null, + isDefault: acl.IsDefault ?? false, + ownerId: acl.OwnerId ?? null, + entries: (acl.Entries ?? []).map((entry) => ({ + ruleNumber: entry.RuleNumber ?? null, + egress: entry.Egress ?? false, + ruleAction: entry.RuleAction ?? null, + protocol: entry.Protocol ?? null, + cidrBlock: entry.CidrBlock ?? null, + ipv6CidrBlock: entry.Ipv6CidrBlock ?? null, + fromPort: entry.PortRange?.From ?? null, + toPort: entry.PortRange?.To ?? null, + icmpType: entry.IcmpTypeCode?.Type ?? null, + icmpCode: entry.IcmpTypeCode?.Code ?? null, + })), + associations: (acl.Associations ?? []).map((association) => ({ + associationId: association.NetworkAclAssociationId ?? null, + subnetId: association.SubnetId ?? null, + })), + tags: tagsToRecord(acl.Tags), + })) + return { networkAcls, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeVpcEndpoints( + input: Ec2DescribeVpcEndpointsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeVpcEndpointsCommand({ + ...(input.vpcEndpointIds && { VpcEndpointIds: input.vpcEndpointIds }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.vpcEndpointIds, input), + }), + { abortSignal: signal } + ) + const vpcEndpoints = (response.VpcEndpoints ?? []).map((endpoint) => ({ + vpcEndpointId: endpoint.VpcEndpointId ?? '', + vpcEndpointType: endpoint.VpcEndpointType ?? null, + vpcId: endpoint.VpcId ?? null, + serviceName: endpoint.ServiceName ?? null, + state: endpoint.State ?? null, + privateDnsEnabled: endpoint.PrivateDnsEnabled ?? false, + routeTableIds: endpoint.RouteTableIds ?? [], + subnetIds: endpoint.SubnetIds ?? [], + networkInterfaceIds: endpoint.NetworkInterfaceIds ?? [], + securityGroupIds: (endpoint.Groups ?? []) + .map((group) => group.GroupId) + .filter((id): id is string => Boolean(id)), + dnsNames: (endpoint.DnsEntries ?? []) + .map((entry) => entry.DnsName) + .filter((name): name is string => Boolean(name)), + creationTimestamp: toIsoString(endpoint.CreationTimestamp), + ownerId: endpoint.OwnerId ?? null, + tags: tagsToRecord(endpoint.Tags), + })) + return { vpcEndpoints, nextToken: response.NextToken ?? null } + }) +} + +function mapPeeringVpc(info?: VpcPeeringConnectionVpcInfo) { + return { + vpcId: info?.VpcId ?? null, + ownerId: info?.OwnerId ?? null, + region: info?.Region ?? null, + cidrBlock: info?.CidrBlock ?? null, + } +} + +export async function executeEc2DescribeVpcPeeringConnections( + input: Ec2DescribeVpcPeeringConnectionsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeVpcPeeringConnectionsCommand({ + ...(input.vpcPeeringConnectionIds && { + VpcPeeringConnectionIds: input.vpcPeeringConnectionIds, + }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.vpcPeeringConnectionIds, input), + }), + { abortSignal: signal } + ) + const vpcPeeringConnections = (response.VpcPeeringConnections ?? []).map((connection) => ({ + vpcPeeringConnectionId: connection.VpcPeeringConnectionId ?? '', + status: connection.Status?.Code ?? null, + statusMessage: connection.Status?.Message ?? null, + requesterVpc: mapPeeringVpc(connection.RequesterVpcInfo), + accepterVpc: mapPeeringVpc(connection.AccepterVpcInfo), + expirationTime: toIsoString(connection.ExpirationTime), + tags: tagsToRecord(connection.Tags), + })) + return { vpcPeeringConnections, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeImages( + input: Ec2DescribeImagesInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeImagesCommand({ + ...(input.imageIds && { ImageIds: input.imageIds }), + // Without an owner scope a list call returns every public AMI in the region. + ...(input.owners ? { Owners: input.owners } : !input.imageIds && { Owners: ['self'] }), + ...(input.filters && { Filters: input.filters }), + ...pageParams(input.imageIds, input), + }), + { abortSignal: signal } + ) + const images = (response.Images ?? []).map((image) => ({ + imageId: image.ImageId ?? '', + name: image.Name ?? null, + description: image.Description || null, + state: image.State ?? null, + ownerId: image.OwnerId ?? null, + ownerAlias: image.ImageOwnerAlias ?? null, + public: image.Public ?? false, + architecture: image.Architecture ?? null, + platformDetails: image.PlatformDetails ?? null, + rootDeviceType: image.RootDeviceType ?? null, + virtualizationType: image.VirtualizationType ?? null, + creationDate: image.CreationDate ?? null, + deprecationTime: image.DeprecationTime ?? null, + lastLaunchedTime: image.LastLaunchedTime ?? null, + tags: tagsToRecord(image.Tags), + })) + return { images, nextToken: response.NextToken ?? null } + }) +} + +export async function executeEc2DescribeKeyPairs( + input: Ec2DescribeKeyPairsInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new DescribeKeyPairsCommand({ + ...(input.keyNames && { KeyNames: input.keyNames }), + ...(input.keyPairIds && { KeyPairIds: input.keyPairIds }), + ...(input.filters && { Filters: input.filters }), + }), + { abortSignal: signal } + ) + const keyPairs = (response.KeyPairs ?? []).map((keyPair) => ({ + keyPairId: keyPair.KeyPairId ?? '', + keyName: keyPair.KeyName ?? null, + keyType: keyPair.KeyType ?? null, + keyFingerprint: keyPair.KeyFingerprint ?? null, + createTime: toIsoString(keyPair.CreateTime), + tags: tagsToRecord(keyPair.Tags), + })) + return { keyPairs } + }) +} + +function toIpPermission(input: { + ipProtocol?: string + fromPort?: number + toPort?: number + cidrIp?: string + cidrIpv6?: string + sourceGroupId?: string + description?: string +}): IpPermission { + const description = input.description ? { Description: input.description } : {} + return { + IpProtocol: input.ipProtocol, + ...(input.fromPort !== undefined && { FromPort: input.fromPort }), + ...(input.toPort !== undefined && { ToPort: input.toPort }), + ...(input.cidrIp && { IpRanges: [{ CidrIp: input.cidrIp, ...description }] }), + ...(input.cidrIpv6 && { Ipv6Ranges: [{ CidrIpv6: input.cidrIpv6, ...description }] }), + ...(input.sourceGroupId && { + UserIdGroupPairs: [{ GroupId: input.sourceGroupId, ...description }], + }), + } +} + +export async function executeEc2AuthorizeSecurityGroupIngress( + input: Ec2AuthorizeSecurityGroupIngressInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new AuthorizeSecurityGroupIngressCommand({ + GroupId: input.groupId, + IpPermissions: [toIpPermission(input)], + }), + { abortSignal: signal } + ) + const securityGroupRules = (response.SecurityGroupRules ?? []).map((rule) => ({ + securityGroupRuleId: rule.SecurityGroupRuleId ?? '', + groupId: rule.GroupId ?? input.groupId, + ipProtocol: rule.IpProtocol ?? null, + fromPort: rule.FromPort ?? null, + toPort: rule.ToPort ?? null, + cidrIpv4: rule.CidrIpv4 ?? null, + cidrIpv6: rule.CidrIpv6 ?? null, + referencedGroupId: rule.ReferencedGroupInfo?.GroupId ?? null, + description: rule.Description ?? null, + })) + return { authorized: response.Return ?? true, securityGroupRules } + }) +} + +export async function executeEc2RevokeSecurityGroupIngress( + input: Ec2RevokeSecurityGroupIngressInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + const response = await client.send( + new RevokeSecurityGroupIngressCommand({ + GroupId: input.groupId, + ...(input.securityGroupRuleIds + ? { SecurityGroupRuleIds: input.securityGroupRuleIds } + : { IpPermissions: [toIpPermission(input)] }), + }), + { abortSignal: signal } + ) + const revokedRules = (response.RevokedSecurityGroupRules ?? []).map((rule) => ({ + securityGroupRuleId: rule.SecurityGroupRuleId ?? '', + ipProtocol: rule.IpProtocol ?? null, + fromPort: rule.FromPort ?? null, + toPort: rule.ToPort ?? null, + cidrIpv4: rule.CidrIpv4 ?? null, + cidrIpv6: rule.CidrIpv6 ?? null, + referencedGroupId: rule.ReferencedGroupId ?? null, + description: rule.Description ?? null, + })) + const unmatchedRuleCount = response.UnknownIpPermissions?.length ?? 0 + return { + revoked: (response.Return ?? true) && unmatchedRuleCount === 0, + revokedRules, + unmatchedRuleCount, + } + }) +} + +export async function executeEc2DeleteVolume(input: Ec2DeleteVolumeInput, signal?: AbortSignal) { + return withClient(input, async (client) => { + await client.send(new DeleteVolumeCommand({ VolumeId: input.volumeId }), { + abortSignal: signal, + }) + return { deleted: true, volumeId: input.volumeId } + }) +} + +export async function executeEc2DeleteSnapshot( + input: Ec2DeleteSnapshotInput, + signal?: AbortSignal +) { + return withClient(input, async (client) => { + await client.send(new DeleteSnapshotCommand({ SnapshotId: input.snapshotId }), { + abortSignal: signal, + }) + return { deleted: true, snapshotId: input.snapshotId } + }) +} diff --git a/apps/sim/lib/internal/ec2/schema.ts b/apps/sim/lib/internal/ec2/schema.ts new file mode 100644 index 00000000000..811ff07d345 --- /dev/null +++ b/apps/sim/lib/internal/ec2/schema.ts @@ -0,0 +1,415 @@ +import { isRecordLike } from '@sim/utils/object' +import { z } from 'zod' +import { validateAwsRegion } from '@/lib/core/security/input-validation' + +const regionSchema = z + .string() + .min(1, 'AWS region is required') + .refine((value) => validateAwsRegion(value).isValid, { + message: 'Invalid AWS region format (e.g., us-east-1, eu-west-2)', + }) + +const connectionSchema = z.object({ + region: regionSchema, + accessKeyId: z.string().min(1, 'AWS access key ID is required'), + secretAccessKey: z.string().min(1, 'AWS secret access key is required'), +}) + +function parseJsonString(value: unknown): unknown { + if (typeof value !== 'string') return value + const trimmed = value.trim() + if (trimmed === '') return undefined + try { + return JSON.parse(trimmed) + } catch { + return value + } +} + +/** + * Splits an ID list given as an array, a JSON array string (a stringified upstream output), or a + * comma-separated string into trimmed, non-empty values. + */ +function toIdList(value: unknown): string[] { + if (value === null || value === undefined) return [] + const parsed = + typeof value === 'string' && value.trim().startsWith('[') ? parseJsonString(value) : value + const items = Array.isArray(parsed) ? parsed.map(String) : String(parsed).split(',') + return items.map((item) => item.trim()).filter((item) => item.length > 0) +} + +function idListSchema(label: string, max = 1000) { + return z.preprocess((value) => { + const ids = toIdList(value) + return ids.length > 0 ? ids : undefined + }, z.array(z.string()).max(max, `A maximum of ${max} ${label} can be provided`).optional()) +} + +function requiredIdListSchema(label: string, max = 1000) { + return z.preprocess( + toIdList, + z + .array(z.string()) + .min(1, `At least one ${label.replace(/s$/, '')} is required`) + .max(max, `A maximum of ${max} ${label} can be provided`) + ) +} + +const filterEntrySchema = z.preprocess( + (value) => { + if (!isRecordLike(value)) return value + const values = value.Values ?? value.values + return { + Name: value.Name ?? value.name, + Values: Array.isArray(values) + ? values.map(String) + : typeof values === 'string' + ? [values] + : values, + } + }, + z.object({ + Name: z.string().min(1, 'Each filter needs a Name'), + Values: z.array(z.string()).min(1, 'Each filter needs at least one value'), + }) +) + +/** + * EC2 filters as `[{ "Name": "vpc-id", "Values": ["vpc-123"] }]`, either as an array or its + * JSON string. Lowercase `name`/`values` keys are accepted for model-authored input. + */ +const filtersSchema = z.preprocess( + parseJsonString, + z + .array(filterEntrySchema, { message: 'Filters must be a JSON array of { Name, Values }' }) + .max(200) + .optional() +) + +/** + * Tags as a `{ "Key": "Value" }` object, a `[{ "Key": "k", "Value": "v" }]` array, or tag-table + * rows (`[{ cells: { key, value } }]`), either directly or as a JSON string. + */ +const tagsSchema = z.preprocess( + (value) => { + const parsed = parseJsonString(value) + if (Array.isArray(parsed)) { + const entries: [string, string][] = [] + for (const entry of parsed) { + if (!isRecordLike(entry)) return parsed + const tag = isRecordLike(entry.cells) ? entry.cells : entry + const key = tag.Key ?? tag.key + if (typeof key !== 'string') return parsed + if (key.trim() !== '') entries.push([key.trim(), String(tag.Value ?? tag.value ?? '')]) + } + return Object.fromEntries(entries) + } + if (isRecordLike(parsed)) { + return Object.fromEntries(Object.entries(parsed).map(([key, val]) => [key, String(val)])) + } + return parsed + }, + // z.record rebuilds the object and silently drops a `__proto__` key, so validate entries in place. + z + .custom>( + (value) => + isRecordLike(value) && + Object.entries(value).every( + ([key, tagValue]) => + key.length >= 1 && + key.length <= 128 && + typeof tagValue === 'string' && + tagValue.length <= 256 + ), + { + message: + 'Tags must be a JSON object of key/value pairs (keys up to 128 characters, values up to 256)', + } + ) + .refine((tags) => Object.keys(tags).length <= 50, { + message: 'A maximum of 50 tags can be provided', + }) + .optional() +) + +/** Booleans may arrive as `"true"`/`"false"` from model-authored tool calls. */ +const booleanishSchema = z.preprocess( + (value) => (value === 'true' ? true : value === 'false' ? false : value), + z.boolean().optional() +) + +const paginationSchema = { + maxResults: z.coerce.number().int().min(5).max(1000).optional(), + nextToken: z.string().min(1).optional(), +} + +export const ec2DescribeInstancesInputSchema = connectionSchema.extend({ + instanceIds: idListSchema('instance IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeInstanceStatusInputSchema = connectionSchema.extend({ + instanceIds: idListSchema('instance IDs', 100), + filters: filtersSchema, + includeAllInstances: booleanishSchema, + ...paginationSchema, +}) + +export const ec2InstanceIdsInputSchema = connectionSchema.extend({ + instanceIds: requiredIdListSchema('instance IDs'), +}) + +export const ec2StopInstancesInputSchema = ec2InstanceIdsInputSchema.extend({ + hibernate: booleanishSchema, + force: booleanishSchema, +}) + +export const ec2DescribeAddressesInputSchema = connectionSchema.extend({ + publicIps: idListSchema('public IPs'), + allocationIds: idListSchema('allocation IDs'), + filters: filtersSchema, +}) + +export const ec2AllocateAddressInputSchema = connectionSchema.extend({ + networkBorderGroup: z.string().min(1).optional(), + publicIpv4Pool: z.string().min(1).optional(), + tags: tagsSchema, +}) + +export const ec2AssociateAddressInputSchema = connectionSchema + .extend({ + allocationId: z.string().min(1, 'Allocation ID is required'), + instanceId: z.string().min(1).optional(), + networkInterfaceId: z.string().min(1).optional(), + privateIpAddress: z.string().min(1).optional(), + allowReassociation: booleanishSchema, + }) + .refine((input) => Boolean(input.instanceId) !== Boolean(input.networkInterfaceId), { + message: 'Provide exactly one of instanceId or networkInterfaceId', + }) + +export const ec2DisassociateAddressInputSchema = connectionSchema.extend({ + associationId: z.string().min(1, 'Association ID is required'), +}) + +export const ec2ReleaseAddressInputSchema = connectionSchema.extend({ + allocationId: z.string().min(1, 'Allocation ID is required'), + networkBorderGroup: z.string().min(1).optional(), +}) + +export const ec2DescribeNatGatewaysInputSchema = connectionSchema.extend({ + natGatewayIds: idListSchema('NAT gateway IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeRouteTablesInputSchema = connectionSchema.extend({ + routeTableIds: idListSchema('route table IDs'), + filters: filtersSchema, + maxResults: z.coerce.number().int().min(5).max(100).optional(), + nextToken: paginationSchema.nextToken, +}) + +export const ec2DescribeVpcsInputSchema = connectionSchema.extend({ + vpcIds: idListSchema('VPC IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeSubnetsInputSchema = connectionSchema.extend({ + subnetIds: idListSchema('subnet IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeSecurityGroupsInputSchema = connectionSchema.extend({ + groupIds: idListSchema('security group IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeInternetGatewaysInputSchema = connectionSchema.extend({ + internetGatewayIds: idListSchema('internet gateway IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeNetworkInterfacesInputSchema = connectionSchema.extend({ + networkInterfaceIds: idListSchema('network interface IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeVolumesInputSchema = connectionSchema.extend({ + volumeIds: idListSchema('volume IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeSnapshotsInputSchema = connectionSchema.extend({ + snapshotIds: idListSchema('snapshot IDs'), + ownerIds: idListSchema('owner IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2CreateSnapshotInputSchema = connectionSchema.extend({ + volumeId: z.string().min(1, 'Volume ID is required'), + description: z.string().max(255).optional(), + tags: tagsSchema, +}) + +export const ec2CreateTagsInputSchema = connectionSchema.extend({ + resourceIds: requiredIdListSchema('resource IDs'), + tags: tagsSchema.refine((tags) => tags !== undefined && Object.keys(tags).length > 0, { + message: 'At least one tag is required', + }), +}) + +export const ec2DeleteTagsInputSchema = connectionSchema.extend({ + resourceIds: requiredIdListSchema('resource IDs'), + tagKeys: requiredIdListSchema('tag keys', 50), +}) + +export const ec2DescribeRegionsInputSchema = connectionSchema.extend({ + regionNames: idListSchema('region names'), + allRegions: booleanishSchema, + filters: filtersSchema, +}) + +export const ec2DescribeAvailabilityZonesInputSchema = connectionSchema.extend({ + zoneNames: idListSchema('zone names'), + allAvailabilityZones: booleanishSchema, + filters: filtersSchema, +}) + +export const ec2DescribeNetworkAclsInputSchema = connectionSchema.extend({ + networkAclIds: idListSchema('network ACL IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeVpcEndpointsInputSchema = connectionSchema.extend({ + vpcEndpointIds: idListSchema('VPC endpoint IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeVpcPeeringConnectionsInputSchema = connectionSchema.extend({ + vpcPeeringConnectionIds: idListSchema('VPC peering connection IDs'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeImagesInputSchema = connectionSchema.extend({ + imageIds: idListSchema('image IDs'), + owners: idListSchema('owners'), + filters: filtersSchema, + ...paginationSchema, +}) + +export const ec2DescribeKeyPairsInputSchema = connectionSchema.extend({ + keyNames: idListSchema('key names'), + keyPairIds: idListSchema('key pair IDs'), + filters: filtersSchema, +}) + +const portSchema = z.coerce.number().int().min(-1).max(65535).optional() + +/** One ingress rule: protocol, port range, and exactly one source. */ +const ingressRuleFields = { + groupId: z.string().min(1, 'Security group ID is required'), + ipProtocol: z.string().min(1).optional(), + fromPort: portSchema, + toPort: portSchema, + cidrIp: z.string().min(1).optional(), + cidrIpv6: z.string().min(1).optional(), + sourceGroupId: z.string().min(1).optional(), +} + +function countSources(input: { cidrIp?: string; cidrIpv6?: string; sourceGroupId?: string }) { + return [input.cidrIp, input.cidrIpv6, input.sourceGroupId].filter(Boolean).length +} + +export const ec2AuthorizeSecurityGroupIngressInputSchema = connectionSchema + .extend({ + ...ingressRuleFields, + ipProtocol: z.string().min(1, 'IP protocol is required'), + description: z.string().max(255).optional(), + }) + .refine((input) => countSources(input) === 1, { + message: 'Provide exactly one of cidrIp, cidrIpv6, or sourceGroupId', + }) + +export const ec2RevokeSecurityGroupIngressInputSchema = connectionSchema + .extend({ + ...ingressRuleFields, + securityGroupRuleIds: idListSchema('security group rule IDs'), + }) + .refine( + (input) => !input.securityGroupRuleIds || (countSources(input) === 0 && !input.ipProtocol), + { message: 'Clear the protocol and source fields when revoking by security group rule ID' } + ) + .refine( + (input) => + Boolean(input.securityGroupRuleIds) || + (Boolean(input.ipProtocol) && countSources(input) === 1), + { + message: + 'Provide security group rule IDs, or a protocol with exactly one of cidrIp, cidrIpv6, or sourceGroupId', + } + ) + +export const ec2DeleteVolumeInputSchema = connectionSchema.extend({ + volumeId: z.string().min(1, 'Volume ID is required'), +}) + +export const ec2DeleteSnapshotInputSchema = connectionSchema.extend({ + snapshotId: z.string().min(1, 'Snapshot ID is required'), +}) + +export type Ec2DescribeInstancesInput = z.output +export type Ec2DescribeInstanceStatusInput = z.output +export type Ec2InstanceIdsInput = z.output +export type Ec2StopInstancesInput = z.output +export type Ec2DescribeAddressesInput = z.output +export type Ec2AllocateAddressInput = z.output +export type Ec2AssociateAddressInput = z.output +export type Ec2DisassociateAddressInput = z.output +export type Ec2ReleaseAddressInput = z.output +export type Ec2DescribeNatGatewaysInput = z.output +export type Ec2DescribeRouteTablesInput = z.output +export type Ec2DescribeVpcsInput = z.output +export type Ec2DescribeSubnetsInput = z.output +export type Ec2DescribeSecurityGroupsInput = z.output +export type Ec2DescribeInternetGatewaysInput = z.output< + typeof ec2DescribeInternetGatewaysInputSchema +> +export type Ec2DescribeNetworkInterfacesInput = z.output< + typeof ec2DescribeNetworkInterfacesInputSchema +> +export type Ec2DescribeVolumesInput = z.output +export type Ec2DescribeSnapshotsInput = z.output +export type Ec2CreateSnapshotInput = z.output +export type Ec2CreateTagsInput = z.output +export type Ec2DeleteTagsInput = z.output +export type Ec2DescribeRegionsInput = z.output +export type Ec2DescribeAvailabilityZonesInput = z.output< + typeof ec2DescribeAvailabilityZonesInputSchema +> +export type Ec2DescribeNetworkAclsInput = z.output +export type Ec2DescribeVpcEndpointsInput = z.output +export type Ec2DescribeVpcPeeringConnectionsInput = z.output< + typeof ec2DescribeVpcPeeringConnectionsInputSchema +> +export type Ec2DescribeImagesInput = z.output +export type Ec2DescribeKeyPairsInput = z.output +export type Ec2AuthorizeSecurityGroupIngressInput = z.output< + typeof ec2AuthorizeSecurityGroupIngressInputSchema +> +export type Ec2RevokeSecurityGroupIngressInput = z.output< + typeof ec2RevokeSecurityGroupIngressInputSchema +> +export type Ec2DeleteVolumeInput = z.output +export type Ec2DeleteSnapshotInput = z.output diff --git a/apps/sim/lib/internal/tool-operations/registry.server.ts b/apps/sim/lib/internal/tool-operations/registry.server.ts index b90f0328576..40e3fb88e5c 100644 --- a/apps/sim/lib/internal/tool-operations/registry.server.ts +++ b/apps/sim/lib/internal/tool-operations/registry.server.ts @@ -17,6 +17,43 @@ const STS_TOOL_IDS = [ 'sts_get_access_key_info', ] as const +const EC2_TOOL_IDS = [ + 'ec2_describe_instances', + 'ec2_describe_instance_status', + 'ec2_start_instances', + 'ec2_stop_instances', + 'ec2_reboot_instances', + 'ec2_terminate_instances', + 'ec2_describe_addresses', + 'ec2_allocate_address', + 'ec2_associate_address', + 'ec2_disassociate_address', + 'ec2_release_address', + 'ec2_describe_nat_gateways', + 'ec2_describe_route_tables', + 'ec2_describe_vpcs', + 'ec2_describe_subnets', + 'ec2_describe_security_groups', + 'ec2_describe_internet_gateways', + 'ec2_describe_network_interfaces', + 'ec2_describe_volumes', + 'ec2_describe_snapshots', + 'ec2_create_snapshot', + 'ec2_create_tags', + 'ec2_delete_tags', + 'ec2_describe_regions', + 'ec2_describe_availability_zones', + 'ec2_describe_network_acls', + 'ec2_describe_vpc_endpoints', + 'ec2_describe_vpc_peering_connections', + 'ec2_describe_images', + 'ec2_describe_key_pairs', + 'ec2_authorize_security_group_ingress', + 'ec2_revoke_security_group_ingress', + 'ec2_delete_volume', + 'ec2_delete_snapshot', +] as const + const APPCONFIG_TOOL_IDS = [ 'appconfig_create_application', 'appconfig_create_configuration_profile', @@ -1458,6 +1495,9 @@ registerFamily(handlerLoaders, ASHBY_TOOL_IDS, async () => { registerFamily(handlerLoaders, STS_TOOL_IDS, async () => { return (await import('@/lib/internal/sts/execute-tool')).executeStsTool }) +registerFamily(handlerLoaders, EC2_TOOL_IDS, async () => { + return (await import('@/lib/internal/ec2/execute-tool')).executeEc2Tool +}) registerFamily(handlerLoaders, APPCONFIG_TOOL_IDS, async () => { return (await import('@/lib/internal/appconfig/execute-tool')).executeAppConfigTool }) diff --git a/apps/sim/lib/knowledge/__integration__/bundle-import.integration.ts b/apps/sim/lib/knowledge/__integration__/bundle-import.integration.ts new file mode 100644 index 00000000000..20d62af4932 --- /dev/null +++ b/apps/sim/lib/knowledge/__integration__/bundle-import.integration.ts @@ -0,0 +1,771 @@ +/** A real export, imported back through the runner, against PostgreSQL and local storage. */ +import { mkdtempSync } from 'node:fs' +import { rm } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import path from 'node:path' +import { db } from '@sim/db' +import { + auditLog, + document, + embedding, + knowledgeBase, + knowledgeBaseImport, + knowledgeBaseTagDefinitions, + organization, + outboxEvent, + uploadSession, + user, + workspace, +} from '@sim/db/schema' +import { deleteWorkspaceFixture } from '@sim/db/testing/workspace-fixtures' +import { sha256Hex } from '@sim/security/hash' +import { generateId } from '@sim/utils/id' +import { and, asc, eq, inArray, sql } from 'drizzle-orm' +import JSZip from 'jszip' +import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' + +const fixture = vi.hoisted(() => ({ + root: '', + embedded: 0, + target: { model: 'text-embedding-3-small', dimensions: 1536 as const }, +})) +vi.mock('@/lib/uploads/core/setup.server', () => ({ + get UPLOAD_DIR_SERVER() { + return fixture.root + }, +})) +vi.mock('@/lib/embeddings', async () => ({ + ...(await import('@/lib/embeddings/client')), + assertKnowledgeEmbeddingCapacity: async () => {}, + embedKnowledge: async (texts: string[]) => { + fixture.embedded += texts.length + return { + embeddings: texts.map(() => [0, 0, 1, ...Array(1533).fill(0)]), + totalTokens: texts.length, + billableTokens: 0, + isBYOK: true, + modelName: fixture.target.model, + pricingId: fixture.target.model, + } + }, +})) +vi.mock('@/lib/knowledge/embeddings', async (importOriginal) => ({ + ...(await importOriginal()), + getConfiguredKbEmbedding: async () => fixture.target, +})) + +import { resolveBillingAttribution } from '@/lib/billing/core/attribution' +import { + createKnowledgeAclFixtureIds, + seedKnowledgeAclFixture, +} from '@/lib/knowledge/__integration__/seed-source-access-fixture' +import { exportKnowledgeBase } from '@/lib/knowledge/application/exports' +import { + completeKnowledgeImport, + createKnowledgeImport, + readKnowledgeImport, +} from '@/lib/knowledge/application/imports' +import { KNOWLEDGE_DOCUMENT_PROCESSING_OUTBOX_EVENT } from '@/lib/knowledge/documents/processing-events' +import { KNOWLEDGE_STORAGE_CLEANUP_EVENT } from '@/lib/knowledge/documents/storage-cleanup-event' +import { buildKnowledgeBundleArchive } from '@/lib/knowledge/transfer/export-archive' +import { + findKnowledgeImport, + insertKnowledgeImport, + KNOWLEDGE_IMPORT_STORAGE_CONTEXT, + stopKnowledgeImport, +} from '@/lib/knowledge/transfer/import-jobs' +import { runKnowledgeImport } from '@/lib/knowledge/transfer/import-runner' +import { embeddingVectorColumn, embeddingVectorValues } from '@/lib/knowledge/vector-columns' +import { downloadFile, uploadFile } from '@/lib/uploads/core/storage-service' +import { writeLocalPutObject } from '@/lib/uploads/upload-session/provider' +import { uploadSessionObjectMetadata } from '@/lib/uploads/upload-session/service' +import { runCleanupStaleExecutions } from '@/background/cleanup-stale-executions' + +const ids = createKnowledgeAclFixtureIds() +const session = { kind: 'session' as const, userId: ids.aliceId, sessionId: generateId() } +const FIRST_VECTOR = [1, ...Array(1535).fill(0)] +const SECOND_VECTOR = [0, 1, ...Array(1534).fill(0)] + +async function seedSourceDocument(options: { + filename: string + chunks: { content: string; vector: number[]; enabled: boolean }[] + enabled: boolean + inlineFile: boolean +}) { + const text = options.chunks.map((chunk) => chunk.content).join('\n') + const id = generateId() + await db.insert(document).values({ + id, + knowledgeBaseId: ids.knowledgeBaseId, + filename: options.filename, + fileUrl: options.inlineFile + ? `data:text/plain;base64,${Buffer.from(text).toString('base64')}` + : '', + fileSize: options.inlineFile ? Buffer.byteLength(text) : 0, + mimeType: 'text/plain', + processingStatus: 'completed', + chunkCount: options.chunks.length, + tokenCount: options.chunks.length * 4, + characterCount: text.length, + enabled: options.enabled, + tag1: 'public', + acl: ['ws'], + aclRequirements: [], + aclVerifiedAt: new Date(), + }) + await db.insert(embedding).values( + options.chunks.map((chunk, chunkIndex) => ({ + id: generateId(), + documentId: id, + knowledgeBaseId: ids.knowledgeBaseId, + chunkIndex, + ...embeddingVectorValues(1536, chunk.vector), + chunkHash: sha256Hex(chunk.content), + content: chunk.content, + contentLength: chunk.content.length, + tokenCount: 4, + startOffset: 0, + endOffset: chunk.content.length, + enabled: chunk.enabled, + tag1: 'public', + })) + ) +} + +async function exportedBundleBytes(): Promise { + const bundle = await exportKnowledgeBase.execute({ + principal: session, + input: { + knowledgeBaseId: ids.knowledgeBaseId, + assertedWorkspaceId: ids.workspaceId, + vectors: true, + }, + }) + const buffers: Buffer[] = [] + for await (const chunk of buildKnowledgeBundleArchive(bundle)) buffers.push(Buffer.from(chunk)) + return Buffer.concat(buffers) +} + +/** Exports the fixture base and stages the archive where a completed import upload leaves it. */ +async function stageExportedBundle(importId: string): Promise { + return stageBundleBytes(importId, await exportedBundleBytes()) +} + +async function stageBundleBytes(importId: string, bytes: Buffer): Promise { + const sourceKey = `knowledge-import/${ids.workspaceId}/${importId}/bundle.simkb.zip` + await uploadFile({ + file: bytes, + fileName: 'bundle.simkb.zip', + contentType: 'application/zip', + context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT, + customKey: sourceKey, + preserveKey: true, + persistMetadata: false, + }) + await insertKnowledgeImport({ + id: importId, + workspaceId: ids.workspaceId, + userId: ids.aliceId, + sourceKey, + }) + return sourceKey +} + +async function runImport(importId: string, sourceKey: string, name: string) { + await runKnowledgeImport(await importPayload(importId, sourceKey, name)) + const record = await findKnowledgeImport({ importId, assertedWorkspaceId: ids.workspaceId }) + if (!record) throw new Error('Import record disappeared') + return record +} + +async function importPayload(importId: string, sourceKey: string, name: string) { + return { + importId, + workspaceId: ids.workspaceId, + userId: ids.aliceId, + name, + sourceKey, + billingAttribution: await resolveBillingAttribution({ + actorUserId: ids.aliceId, + workspaceId: ids.workspaceId, + }), + } +} + +async function importedDocuments(knowledgeBaseId: string) { + return db + .select({ + id: document.id, + filename: document.filename, + fileUrl: document.fileUrl, + mimeType: document.mimeType, + enabled: document.enabled, + processingStatus: document.processingStatus, + chunkCount: document.chunkCount, + tag1: document.tag1, + }) + .from(document) + .where(eq(document.knowledgeBaseId, knowledgeBaseId)) + .orderBy(asc(document.filename)) +} + +async function importedChunks(documentId: string) { + return db + .select({ + content: embedding.content, + enabled: embedding.enabled, + tag1: embedding.tag1, + vector: embeddingVectorColumn(1536), + }) + .from(embedding) + .where(eq(embedding.documentId, documentId)) + .orderBy(asc(embedding.chunkIndex)) +} + +beforeAll(async () => { + fixture.root = mkdtempSync(path.join(tmpdir(), 'sim-knowledge-import-')) + await seedKnowledgeAclFixture(ids) + await seedSourceDocument({ + filename: 'handbook.txt', + inlineFile: true, + enabled: true, + chunks: [ + { content: 'Refunds are issued within 14 days.', vector: FIRST_VECTOR, enabled: true }, + { content: 'Archived policy text.', vector: SECOND_VECTOR, enabled: false }, + ], + }) + await seedSourceDocument({ + filename: 'notes.txt', + inlineFile: false, + enabled: false, + chunks: [ + { content: 'Chunk text with no original file.', vector: SECOND_VECTOR, enabled: true }, + ], + }) +}) +afterEach(() => { + fixture.embedded = 0 + fixture.target = { model: 'text-embedding-3-small', dimensions: 1536 } +}) +afterAll(async () => { + const workspaceBases = sql`SELECT ${knowledgeBase.id} FROM ${knowledgeBase} WHERE ${knowledgeBase.workspaceId} = ${ids.workspaceId}` + await db + .delete(outboxEvent) + .where( + sql`${outboxEvent.payload}::jsonb ->> 'knowledgeBaseId' IN (${workspaceBases}) OR ${outboxEvent.payload}::jsonb ->> 'documentId' IN (SELECT ${document.id} FROM ${document} WHERE ${document.knowledgeBaseId} IN (${workspaceBases}))` + ) + await db.delete(auditLog).where(eq(auditLog.workspaceId, ids.workspaceId)) + await db.delete(knowledgeBase).where(eq(knowledgeBase.workspaceId, ids.workspaceId)) + await deleteWorkspaceFixture(db, eq(workspace.id, ids.workspaceId)) + await db.delete(organization).where(eq(organization.id, ids.organizationId)) + await db.delete(user).where(inArray(user.id, [ids.aliceId, ids.bobId])) + await rm(fixture.root, { recursive: true, force: true }) + await db.$client.end() +}) + +describe('knowledge base bundle import', () => { + it('recreates an exported base and indexes it from the bundle when the embedding model matches', async () => { + const importId = generateId() + const sourceKey = await stageExportedBundle(importId) + + const record = await runImport(importId, sourceKey, 'Imported fixture') + + expect(record).toMatchObject({ + status: 'completed', + documentsTotal: 2, + documentsImported: 2, + documentsFailed: 0, + vectorsReused: true, + failures: [], + error: null, + }) + const knowledgeBaseId = record.knowledgeBaseId + if (!knowledgeBaseId) throw new Error('Import did not link its knowledge base') + const [created] = await db + .select() + .from(knowledgeBase) + .where(eq(knowledgeBase.id, knowledgeBaseId)) + expect(created).toMatchObject({ + name: 'Imported fixture', + workspaceId: ids.workspaceId, + userId: ids.aliceId, + embeddingModel: 'text-embedding-3-small', + chunkingConfig: { maxSize: 1024, minSize: 1, overlap: 20 }, + }) + expect( + await db + .select({ + tagSlot: knowledgeBaseTagDefinitions.tagSlot, + displayName: knowledgeBaseTagDefinitions.displayName, + }) + .from(knowledgeBaseTagDefinitions) + .where(eq(knowledgeBaseTagDefinitions.knowledgeBaseId, knowledgeBaseId)) + ).toEqual([{ tagSlot: 'tag1', displayName: 'Fixture' }]) + + const [handbook, notes] = await importedDocuments(knowledgeBaseId) + expect(handbook).toMatchObject({ + filename: 'handbook.txt', + enabled: true, + processingStatus: 'completed', + chunkCount: 2, + tag1: 'public', + }) + expect(handbook.fileUrl).toMatch(/^\/api\/files\/serve\/kb\/.+\?context=knowledge-base$/) + expect( + await db + .select({ status: outboxEvent.status }) + .from(outboxEvent) + .where( + and( + eq(outboxEvent.eventType, KNOWLEDGE_STORAGE_CLEANUP_EVENT), + sql`${outboxEvent.payload}::jsonb ->> 'documentId' = ${handbook.id}` + ) + ) + ).toEqual([{ status: 'completed' }]) + expect(notes).toMatchObject({ + filename: 'notes.txt', + mimeType: 'text/plain', + enabled: false, + processingStatus: 'completed', + chunkCount: 1, + }) + expect( + ( + await downloadFile({ + key: decodeURIComponent(notes.fileUrl.split('?')[0].replace('/api/files/serve/', '')), + context: 'knowledge-base', + }) + ).toString() + ).toBe('Chunk text with no original file.') + expect(await importedChunks(handbook.id)).toEqual([ + { + content: 'Refunds are issued within 14 days.', + enabled: true, + tag1: 'public', + vector: FIRST_VECTOR, + }, + { content: 'Archived policy text.', enabled: false, tag1: 'public', vector: SECOND_VECTOR }, + ]) + expect(fixture.embedded).toBe(0) + await expect( + downloadFile({ key: sourceKey, context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT }) + ).rejects.toThrow() + }) + + it('queues documents with a file for processing and re-embeds chunk-only ones when the model differs', async () => { + fixture.target = { model: 'text-embedding-3-large', dimensions: 1536 } + const importId = generateId() + const sourceKey = await stageExportedBundle(importId) + + const record = await runImport(importId, sourceKey, 'Re-embedded fixture') + + expect(record).toMatchObject({ + status: 'completed', + documentsImported: 2, + documentsFailed: 0, + vectorsReused: false, + }) + const knowledgeBaseId = record.knowledgeBaseId + if (!knowledgeBaseId) throw new Error('Import did not link its knowledge base') + const [handbook, notes] = await importedDocuments(knowledgeBaseId) + expect(handbook.processingStatus).toBe('pending') + expect(await importedChunks(handbook.id)).toEqual([]) + const queued = await db + .select({ id: outboxEvent.id }) + .from(outboxEvent) + .where( + and( + eq(outboxEvent.eventType, KNOWLEDGE_DOCUMENT_PROCESSING_OUTBOX_EVENT), + sql`${outboxEvent.payload}::jsonb ->> 'documentId' = ${handbook.id}` + ) + ) + expect(queued).toHaveLength(1) + expect(notes.processingStatus).toBe('completed') + expect(fixture.embedded).toBe(1) + expect(await importedChunks(notes.id)).toEqual([ + { + content: 'Chunk text with no original file.', + enabled: true, + tag1: 'public', + vector: [0, 0, 1, ...Array(1533).fill(0)], + }, + ]) + }) + + it('fails an archive that is not a bundle without creating a knowledge base', async () => { + const importId = generateId() + const sourceKey = await stageBundleBytes(importId, Buffer.from('not a zip archive')) + + const record = await runImport(importId, sourceKey, 'Never created') + + expect(record).toMatchObject({ + status: 'failed', + knowledgeBaseId: null, + error: 'Invalid knowledge base bundle: not a zip archive', + }) + expect( + await db + .select({ id: knowledgeBase.id }) + .from(knowledgeBase) + .where(eq(knowledgeBase.name, 'Never created')) + ).toEqual([]) + await expect( + downloadFile({ key: sourceKey, context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT }) + ).rejects.toThrow() + }) + + it('fails a bundle with a damaged chunk entry before creating anything', async () => { + const zip = new JSZip() + zip.file('chunks/doc-1.ndjson', '{"index": 0, "content": "half a line"\n') + zip.file( + 'manifest.json', + JSON.stringify({ + version: 1, + exportedAt: '2026-10-01T00:00:00.000Z', + embedding: { model: 'text-embedding-3-small', dimension: 1536, vectorsIncluded: false }, + knowledgeBase: { + name: 'Damaged fixture', + description: null, + chunkingConfig: { maxSize: 1024, minSize: 1, overlap: 20 }, + }, + tags: [], + documents: [ + { + id: 'doc-1', + filename: 'notes.txt', + mimeType: 'text/plain', + fileSize: 0, + enabled: true, + tags: {}, + file: null, + chunks: 'chunks/doc-1.ndjson', + chunkCount: 1, + tokenCount: 1, + characterCount: 11, + }, + ], + }) + ) + const importId = generateId() + const sourceKey = await stageBundleBytes( + importId, + await zip.generateAsync({ type: 'nodebuffer' }) + ) + + const record = await runImport(importId, sourceKey, 'Damaged fixture') + + expect(record).toMatchObject({ status: 'failed', knowledgeBaseId: null, documentsTotal: 0 }) + expect(record.error).toContain('chunks/doc-1.ndjson line 1 is not valid JSON') + expect( + await db + .select({ id: knowledgeBase.id }) + .from(knowledgeBase) + .where(eq(knowledgeBase.name, 'Damaged fixture')) + ).toEqual([]) + }) + + it('creates no base for an import canceled before its worker reached it', async () => { + const importId = generateId() + const sourceKey = await stageExportedBundle(importId) + const staged = await findKnowledgeImport({ importId }) + if (!staged) throw new Error('Import was not staged') + await stopKnowledgeImport(staged) + + const record = await runImport(importId, sourceKey, 'Canceled fixture') + + expect(record).toMatchObject({ status: 'canceled', knowledgeBaseId: null }) + expect( + await db + .select({ id: knowledgeBase.id }) + .from(knowledgeBase) + .where(eq(knowledgeBase.name, 'Canceled fixture')) + ).toEqual([]) + await expect( + downloadFile({ key: sourceKey, context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT }) + ).rejects.toThrow() + }) + + it('lets exactly one of two concurrent workers run an import', async () => { + const importId = generateId() + const sourceKey = await stageExportedBundle(importId) + const payload = await importPayload(importId, sourceKey, 'Claimed fixture') + + await Promise.all([runKnowledgeImport(payload), runKnowledgeImport(payload)]) + + expect(await findKnowledgeImport({ importId })).toMatchObject({ + status: 'completed', + knowledgeBaseId: importId, + documentsImported: 2, + documentsFailed: 0, + }) + expect( + await db + .select({ id: knowledgeBase.id }) + .from(knowledgeBase) + .where(eq(knowledgeBase.name, 'Claimed fixture')) + ).toEqual([{ id: importId }]) + }) + + it('fails without a partial base when the name is already taken', async () => { + const importId = generateId() + const sourceKey = await stageExportedBundle(importId) + + const record = await runImport(importId, sourceKey, 'Search fixture') + + expect(record.status).toBe('failed') + expect(record.knowledgeBaseId).toBeNull() + expect(record.error).toContain('A knowledge base named "Search fixture" already exists') + expect( + await db + .select({ id: knowledgeBase.id }) + .from(knowledgeBase) + .where( + and( + eq(knowledgeBase.workspaceId, ids.workspaceId), + eq(knowledgeBase.name, 'Search fixture') + ) + ) + ).toEqual([{ id: ids.knowledgeBaseId }]) + await expect( + downloadFile({ key: sourceKey, context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT }) + ).rejects.toThrow() + }) +}) + +describe('knowledge base import requests', () => { + const request = { headers: new Headers({ origin: 'http://localhost:3000' }) } + + it('creates an import, completes its upload once, and runs it to a new base', async () => { + const bytes = await exportedBundleBytes() + const created = await createKnowledgeImport.execute({ + principal: session, + input: { + body: { + workspaceId: ids.workspaceId, + name: 'Requested import', + source: { + type: 'upload', + name: 'fixture.simkb.zip', + contentType: 'application/zip', + size: bytes.length, + }, + }, + }, + request, + }) + expect(created.import).toMatchObject({ status: 'uploading', knowledgeBaseId: null }) + await writeLocalPutObject({ + uploadId: created.upload.id, + key: created.upload.finalKey, + body: new Blob([new Uint8Array(bytes)]).stream(), + expectedSize: bytes.length, + contentType: created.upload.contentType, + metadata: uploadSessionObjectMetadata(created.upload), + }) + const input = { + importId: created.import.id, + workspaceId: ids.workspaceId, + uploadToken: created.upload.uploadToken, + } + + const completed = await completeKnowledgeImport.execute({ principal: session, input, request }) + const repeated = await completeKnowledgeImport.execute({ principal: session, input, request }) + + expect(completed.import.id).toBe(created.import.id) + expect(repeated.import.id).toBe(created.import.id) + await expect + .poll( + async () => + (await readKnowledgeImport.execute({ principal: session, input })).import.status, + { interval: 50, timeout: 10_000 } + ) + .toBe('completed') + const { import: finished } = await readKnowledgeImport.execute({ principal: session, input }) + expect(finished).toMatchObject({ + documentsImported: 2, + documentsFailed: 0, + vectorsReused: true, + }) + expect( + await db + .select({ id: knowledgeBase.id }) + .from(knowledgeBase) + .where(eq(knowledgeBase.name, 'Requested import')) + ).toEqual([{ id: finished.knowledgeBaseId }]) + await expect + .poll(async () => + db + .select({ resourceId: auditLog.resourceId }) + .from(auditLog) + .where( + and( + eq(auditLog.workspaceId, ids.workspaceId), + eq(auditLog.action, 'knowledge_base.import_started') + ) + ) + ) + .toEqual([{ resourceId: finished.knowledgeBaseId }]) + }) + + it('starts an import whose first dispatch was lost when its completion is retried', async () => { + const bytes = await exportedBundleBytes() + const created = await createKnowledgeImport.execute({ + principal: session, + input: { + body: { + workspaceId: ids.workspaceId, + name: 'Redispatched import', + source: { + type: 'upload', + name: 'fixture.simkb.zip', + contentType: 'application/zip', + size: bytes.length, + }, + }, + }, + request, + }) + await writeLocalPutObject({ + uploadId: created.upload.id, + key: created.upload.finalKey, + body: new Blob([new Uint8Array(bytes)]).stream(), + expectedSize: bytes.length, + contentType: created.upload.contentType, + metadata: uploadSessionObjectMetadata(created.upload), + }) + // The record a completion wrote before the request died, with no worker behind it. + await insertKnowledgeImport({ + id: created.upload.id, + workspaceId: ids.workspaceId, + userId: ids.aliceId, + sourceKey: created.upload.storageKey, + }) + const input = { + importId: created.import.id, + workspaceId: ids.workspaceId, + uploadToken: created.upload.uploadToken, + } + + await completeKnowledgeImport.execute({ principal: session, input, request }) + + await expect + .poll( + async () => + (await readKnowledgeImport.execute({ principal: session, input })).import.status, + { interval: 50, timeout: 10_000 } + ) + .toBe('completed') + expect( + await db + .select({ id: knowledgeBase.id }) + .from(knowledgeBase) + .where(eq(knowledgeBase.name, 'Redispatched import')) + ).toEqual([{ id: created.import.id }]) + await expect + .poll(async () => + db + .select({ resourceId: auditLog.resourceId }) + .from(auditLog) + .where( + and( + eq(auditLog.workspaceId, ids.workspaceId), + eq(auditLog.resourceId, created.import.id) + ) + ) + ) + .toEqual([{ resourceId: created.import.id }]) + }) + + it('refuses a bundle that is not a zip archive before creating an upload', async () => { + const importUploads = () => + db + .select({ id: uploadSession.id }) + .from(uploadSession) + .where( + and( + eq(uploadSession.workspaceId, ids.workspaceId), + eq(uploadSession.purpose, 'knowledge_import') + ) + ) + const before = await importUploads() + await expect( + createKnowledgeImport.execute({ + principal: session, + input: { + body: { + workspaceId: ids.workspaceId, + source: { + type: 'upload', + name: 'fixture.tar', + contentType: 'application/x-tar', + size: 10, + }, + }, + }, + request, + }) + ).rejects.toThrow('A knowledge base bundle must be a .zip archive') + expect(await importUploads()).toEqual(before) + }) +}) + +describe('stale knowledge import cleanup', () => { + async function seedProcessingDocument(processingQueueToken: string | null) { + const id = generateId() + await db.insert(document).values({ + id, + knowledgeBaseId: ids.knowledgeBaseId, + filename: 'stranded.txt', + fileUrl: '', + fileSize: 0, + mimeType: 'text/plain', + processingStatus: 'processing', + processingStartedAt: new Date(Date.now() - 2 * 60 * 60 * 1000), + processingQueueToken, + }) + return id + } + + async function processingStatus(documentId: string) { + const [row] = await db + .select({ status: document.processingStatus }) + .from(document) + .where(eq(document.id, documentId)) + return row?.status + } + + it('fails an import whose worker went silent, its stranded documents, and its bundle, and prunes settled imports with theirs', async () => { + const staleId = generateId() + const staleBundle = await stageBundleBytes(staleId, Buffer.from('bundle bytes')) + const settledId = generateId() + const settledBundle = await stageBundleBytes(settledId, Buffer.from('bundle bytes')) + const stranded = await seedProcessingDocument(null) + const queued = await seedProcessingDocument('queue-token') + const longAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) + await db + .update(knowledgeBaseImport) + .set({ + knowledgeBaseId: ids.knowledgeBaseId, + updatedAt: new Date(Date.now() - 2 * 60 * 60 * 1000), + }) + .where(eq(knowledgeBaseImport.id, staleId)) + await db + .update(knowledgeBaseImport) + .set({ status: 'canceled', updatedAt: longAgo, completedAt: longAgo }) + .where(eq(knowledgeBaseImport.id, settledId)) + + await runCleanupStaleExecutions() + + const stale = await findKnowledgeImport({ importId: staleId }) + expect(stale).toMatchObject({ status: 'failed' }) + expect(stale?.error).toContain('no progress') + expect(await processingStatus(stranded)).toBe('failed') + expect(await processingStatus(queued)).toBe('processing') + expect(await findKnowledgeImport({ importId: settledId })).toBeNull() + for (const key of [staleBundle, settledBundle]) { + await expect( + downloadFile({ key, context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT }) + ).rejects.toThrow() + } + }) +}) diff --git a/apps/sim/lib/knowledge/__integration__/connector-lease-pages.integration.ts b/apps/sim/lib/knowledge/__integration__/connector-lease-pages.integration.ts index d2941b9a71d..cdb3f24b60c 100644 --- a/apps/sim/lib/knowledge/__integration__/connector-lease-pages.integration.ts +++ b/apps/sim/lib/knowledge/__integration__/connector-lease-pages.integration.ts @@ -379,6 +379,21 @@ describe('connector lease ACL pages in PostgreSQL', () => { }) }) + async function waitForDocumentLock(): Promise { + return vi.waitFor( + async () => { + const [row] = await db.execute<{ pid: number }>(sql` + SELECT pid FROM pg_stat_activity + WHERE wait_event_type = 'Lock' AND datname = current_database() + AND (query ILIKE 'update "document" set "acl"%' + OR query ILIKE 'select "id", "chunk_count" from "document"%for update')`) + if (!row) throw new Error('Document ACL writer has not reached the held row') + return row.pid + }, + { timeout: 5_000, interval: 10 } + ) + } + describe('fence-last pages', () => { /** * A processing commit holds a document row for its whole write. A page waiting on it must not @@ -409,17 +424,7 @@ describe('connector lease ACL pages in PostgreSQL', () => { leaseTransaction(ids.connectorId, adminLease()) ) try { - let waiter: number | undefined - for (let attempt = 0; attempt < 100 && waiter === undefined; attempt++) { - const [row] = await db.execute<{ pid: number }>(sql` - SELECT pid FROM pg_stat_activity - WHERE wait_event_type = 'Lock' AND datname = current_database() - AND (query ILIKE 'update "document" set "acl"%' - OR query ILIKE 'select "id", "chunk_count" from "document"%for update')`) - waiter = row?.pid - if (waiter === undefined) await new Promise((resolve) => setImmediate(resolve)) - } - expect(waiter).toBeDefined() + const waiter = await waitForDocumentLock() const connectorLocks = await db.execute<{ mode: string }>(sql` SELECT mode FROM pg_locks WHERE pid = ${waiter} AND relation = 'knowledge_connector'::regclass`) @@ -522,17 +527,7 @@ describe('connector lease ACL pages in PostgreSQL', () => { lease: createMemberSyncLease(members.connectorId, members.runId), }) try { - let waiter: number | undefined - for (let attempt = 0; attempt < 200 && waiter === undefined; attempt++) { - const [row] = await db.execute<{ pid: number }>(sql` - SELECT pid FROM pg_stat_activity - WHERE wait_event_type = 'Lock' AND datname = current_database() - AND (query ILIKE 'update "document" set "acl"%' - OR query ILIKE 'select "id", "chunk_count" from "document"%for update')`) - waiter = row?.pid - if (waiter === undefined) await new Promise((resolve) => setImmediate(resolve)) - } - expect(waiter).toBeDefined() + const waiter = await waitForDocumentLock() const connectorLocks = await db.execute<{ mode: string }>(sql` SELECT mode FROM pg_locks WHERE pid = ${waiter} AND relation = 'knowledge_connector'::regclass`) diff --git a/apps/sim/lib/knowledge/api/route-policies.ts b/apps/sim/lib/knowledge/api/route-policies.ts index 80102c19bec..858d1c9076c 100644 --- a/apps/sim/lib/knowledge/api/route-policies.ts +++ b/apps/sim/lib/knowledge/api/route-policies.ts @@ -208,4 +208,8 @@ export const v2KnowledgeErrorPolicies = { notFoundMessage: 'Knowledge base not found', render: v2KnowledgeDocumentUploadErrorPolicy.render, }), + concealImportAuthorization: createV2ResourceConcealmentPolicy({ + notFoundMessage: 'Knowledge base import not found', + render: v2KnowledgeUsageErrorPolicy.render, + }), } as const diff --git a/apps/sim/lib/knowledge/application/billing.ts b/apps/sim/lib/knowledge/application/billing.ts index 3feb40b0ca4..cf4597ba712 100644 --- a/apps/sim/lib/knowledge/application/billing.ts +++ b/apps/sim/lib/knowledge/application/billing.ts @@ -71,3 +71,20 @@ export async function resolveKnowledgeUsageAdmission( const usage = await checkAttributedUsageLimits(billingAttribution) return { billingAttribution, usage, userId } } + +/** {@link resolveKnowledgeUsageAdmission}, refusing once the caller's usage limit is reached. */ +export async function assertKnowledgeUsageAdmitted( + principal: Principal, + context: KnowledgeResourceContext +) { + const { billingAttribution, usage, userId } = await resolveKnowledgeUsageAdmission( + principal, + context + ) + if (usage.isExceeded) { + throw new KnowledgeUsageLimitExceededError( + usage.message || 'Usage limit exceeded. Please upgrade your plan to continue.' + ) + } + return { billingAttribution, userId } +} diff --git a/apps/sim/lib/knowledge/application/imports.ts b/apps/sim/lib/knowledge/application/imports.ts new file mode 100644 index 00000000000..10c0c954925 --- /dev/null +++ b/apps/sim/lib/knowledge/application/imports.ts @@ -0,0 +1,459 @@ +import { AuditAction, AuditResourceType } from '@sim/audit' +import type { Principal } from '@sim/auth/principal' +import { createLogger } from '@sim/logger' +import { getErrorMessage } from '@sim/utils/errors' +import { generateId } from '@sim/utils/id' +import { isRecordLike } from '@sim/utils/object' +import type { + V2CreateKnowledgeImportBody, + V2KnowledgeImportStatus, +} from '@/lib/api/contracts/v2/knowledge' +import { + authorizeWorkspaceOperation, + capabilityGovernedPrincipalUserId, +} from '@/lib/core/application' +import { dispatchBackgroundTask } from '@/lib/core/async-jobs/background-task' +import { asOrchestrationError, OrchestrationError } from '@/lib/core/orchestration/types' +import { knowledgeDelegationPolicy } from '@/lib/knowledge/application/authorization' +import { defineAuthorizedKnowledgeUseCase } from '@/lib/knowledge/application/authorized-knowledge-use-case' +import { assertKnowledgeUsageAdmitted } from '@/lib/knowledge/application/billing' +import { + type KnowledgeWorkspaceContext, + resolveKnowledgeWorkspaceContext, +} from '@/lib/knowledge/application/contexts' +import { knowledgeOperations } from '@/lib/knowledge/application/operations' +import { + findKnowledgeImport, + getKnowledgeImport, + insertKnowledgeImport, + KNOWLEDGE_IMPORT_STORAGE_CONTEXT, + type KnowledgeImportFailure, + type KnowledgeImportRecord, + stopKnowledgeImport, +} from '@/lib/knowledge/transfer/import-jobs' +import { + type KnowledgeImportPayload, + runKnowledgeImport, +} from '@/lib/knowledge/transfer/import-runner' +import { assertWorkspaceCapability } from '@/lib/permission-groups/capability-assertions' +import { requestOrigin } from '@/lib/uploads/upload-session/application' +import { + abortUploadSession, + assertUploadSessionAuthBinding, + type CreatedUploadSession, + completeUploadSession, + createUploadPartUrls, + createUploadSession, + getOwnedUploadSession, + importStatusForUploadSession, + type UploadSessionRecord, +} from '@/lib/uploads/upload-session/service' +import type { knowledgeImportTask } from '@/background/knowledge-import' + +const logger = createLogger('KnowledgeImportApplication') + +/** Upload-session metadata key holding what the import was created with. */ +const IMPORT_METADATA_KEY = 'knowledgeImport' + +/** An import in either half of its life: its upload, then its durable record. */ +export interface KnowledgeImportResource { + id: string + workspaceId: string + status: V2KnowledgeImportStatus + knowledgeBaseId: string | null + documentsTotal: number + documentsImported: number + documentsFailed: number + vectorsReused: boolean + failures: KnowledgeImportFailure[] + error: string | null + createdAt: Date + updatedAt: Date + completedAt: Date | null +} + +interface CreateKnowledgeImportInput { + body: V2CreateKnowledgeImportBody +} + +interface KnowledgeImportInput { + importId: string + workspaceId: string + uploadToken?: string +} + +interface KnowledgeImportUploadInput extends KnowledgeImportInput { + uploadToken: string +} + +interface CreateKnowledgeImportPartsInput extends KnowledgeImportUploadInput { + partNumbers: number[] +} + +export interface CreateKnowledgeImportResult { + import: KnowledgeImportResource + upload: CreatedUploadSession +} + +interface KnowledgeImportResult { + import: KnowledgeImportResource +} + +interface KnowledgeImportRecordContext extends KnowledgeWorkspaceContext { + record: KnowledgeImportRecord +} + +interface KnowledgeImportUploadContext extends KnowledgeWorkspaceContext { + upload: UploadSessionRecord +} + +type KnowledgeImportContext = KnowledgeImportRecordContext | KnowledgeImportUploadContext + +function fromRecord(record: KnowledgeImportRecord): KnowledgeImportResource { + return { + id: record.id, + workspaceId: record.workspaceId, + status: record.status === 'running' ? 'processing' : record.status, + knowledgeBaseId: record.knowledgeBaseId, + documentsTotal: record.documentsTotal, + documentsImported: record.documentsImported, + documentsFailed: record.documentsFailed, + vectorsReused: record.vectorsReused, + failures: record.failures, + error: record.error, + createdAt: record.createdAt, + updatedAt: record.updatedAt, + completedAt: record.completedAt, + } +} + +function fromUpload(upload: UploadSessionRecord, workspaceId: string): KnowledgeImportResource { + return { + id: upload.id, + workspaceId, + status: importStatusForUploadSession(upload.status), + knowledgeBaseId: null, + documentsTotal: 0, + documentsImported: 0, + documentsFailed: 0, + vectorsReused: false, + failures: [], + error: null, + createdAt: upload.createdAt, + updatedAt: upload.updatedAt, + completedAt: upload.completedAt, + } +} + +/** The name override the import was created with, read back from its upload session. */ +function importedName(upload: UploadSessionRecord): string | undefined { + const stored = upload.metadata[IMPORT_METADATA_KEY] + if (!isRecordLike(stored) || typeof stored.name !== 'string') return undefined + return stored.name +} + +/** + * permission-group-enforced: knowledge.upload — an import creates a base, which + * the operations' `knowledge.create` governs, but it also fills that base with + * caller-supplied documents, which `knowledge.upload` governs everywhere else. + * An operation names one capability, so the second is asserted here. Keyed to + * the governed subject, which names nobody for an actorless run or an executor + * delegation; a copilot delegation stays governed. + */ +async function assertImportedDocumentsAllowed( + principal: Principal, + workspaceId: string +): Promise { + const actingUserId = capabilityGovernedPrincipalUserId(principal) + if (actingUserId) await assertWorkspaceCapability(actingUserId, workspaceId, 'knowledge.upload') +} + +async function resolveUploadContext( + principal: Principal, + input: KnowledgeImportUploadInput +): Promise { + const upload = await getOwnedUploadSession({ + uploadId: input.importId, + workspaceId: input.workspaceId, + purpose: 'knowledge_import', + uploadToken: input.uploadToken, + principal, + }) + if (upload.storageContext !== KNOWLEDGE_IMPORT_STORAGE_CONTEXT || !upload.workspaceId) { + throw new OrchestrationError('not_found', 'Knowledge base import not found') + } + return { + ...(await resolveKnowledgeWorkspaceContext({ workspaceId: upload.workspaceId })), + upload, + } +} + +async function resolveImportContext( + principal: Principal, + input: KnowledgeImportInput +): Promise { + if (input.uploadToken) { + return resolveUploadContext(principal, { ...input, uploadToken: input.uploadToken }) + } + const record = await getKnowledgeImport({ + importId: input.importId, + assertedWorkspaceId: input.workspaceId, + }) + return { + ...(await resolveKnowledgeWorkspaceContext({ workspaceId: record.workspaceId })), + record, + } +} + +/** + * The durable record once the runner has been dispatched, which a caller still + * holding the upload token must see in place of its finished upload. + */ +function findStartedImport(context: KnowledgeImportUploadContext) { + return findKnowledgeImport({ + importId: context.upload.id, + assertedWorkspaceId: context.workspaceId, + }) +} + +/** What the runner needs, with usage admitted for the caller completing the upload. */ +async function importPayload( + principal: Principal, + context: KnowledgeImportUploadContext +): Promise { + const { billingAttribution, userId } = await assertKnowledgeUsageAdmitted(principal, context) + const { upload } = context + const name = importedName(upload) + return { + importId: upload.id, + workspaceId: context.workspaceId, + userId, + ...(name ? { name } : {}), + sourceKey: upload.storageKey, + billingAttribution, + } +} + +/** + * Writes the durable record while the upload is being completed, before it + * counts as complete. From then on the stale-import janitor owns the bundle, so + * neither a crash nor a refusal after this point can strand it; a refusal + * before it leaves the session unfinished, which its abort and expiry discard. + * Returns the runner's payload, or `null` when a repeated completion finds the + * record already written. + */ +async function recordKnowledgeImport( + principal: Principal, + context: KnowledgeImportUploadContext +): Promise { + const payload = await importPayload(principal, context) + const inserted = await insertKnowledgeImport({ + id: payload.importId, + workspaceId: payload.workspaceId, + userId: payload.userId, + sourceKey: payload.sourceKey, + }) + return inserted ? payload : null +} + +function startKnowledgeImport(payload: KnowledgeImportPayload): Promise { + return dispatchBackgroundTask('knowledge-import', payload, { + runInProcess: runKnowledgeImport, + trigger: { tags: [`workspaceId:${payload.workspaceId}`, `importId:${payload.importId}`] }, + }) +} + +/** + * Dispatches again an import whose record no worker has claimed: its first + * dispatch failed or was lost with the request that wrote the record, or is + * still queued. Either way a second run is safe, since only one worker can + * claim it. A dispatch never settles the import itself, since another one may + * already be on its way; one that never runs is failed by the stale-import + * janitor, which also deletes its bundle. + */ +async function redispatchUnclaimedImport( + principal: Principal, + context: KnowledgeImportUploadContext, + record: KnowledgeImportRecord +): Promise { + if (record.status !== 'running' || record.startedAt) return + // A group that withdrew uploads since the record was written stops it here too. + await assertImportedDocumentsAllowed(principal, context.workspaceId) + try { + await startKnowledgeImport(await importPayload(principal, context)) + } catch (error) { + logger.warn('Could not dispatch an unclaimed knowledge import again', { + importId: record.id, + error: getErrorMessage(error, 'Unknown error'), + }) + } +} + +export const createKnowledgeImport = defineAuthorizedKnowledgeUseCase({ + operation: knowledgeOperations.importCreate, + resolveContext: ({ input }: { input: CreateKnowledgeImportInput }) => + resolveKnowledgeWorkspaceContext({ workspaceId: input.body.workspaceId }), + async execute({ principal, input, context, request }): Promise { + if (!request) throw new Error('Knowledge import creation requires a request context') + await assertImportedDocumentsAllowed(principal, context.workspaceId) + const { source, name } = input.body + if (!source.name.toLowerCase().endsWith('.zip')) { + throw new OrchestrationError('validation', 'A knowledge base bundle must be a .zip archive') + } + // Refused before the bundle moves, so a full plan never uploads gigabytes to be turned away. + const { userId } = await assertKnowledgeUsageAdmitted(principal, context) + const upload = await createUploadSession({ + id: generateId(), + workspaceId: context.workspaceId, + userId, + principal, + purpose: 'knowledge_import', + fileName: source.name, + contentType: source.contentType, + fileSize: source.size, + metadata: { [IMPORT_METADATA_KEY]: name ? { name } : {} }, + localOrigin: requestOrigin(request), + }) + logger.info('Created knowledge import', { + importId: upload.id, + workspaceId: context.workspaceId, + principalKind: principal.kind, + }) + return { import: fromUpload(upload, context.workspaceId), upload } + }, +}) + +/** + * Reads an import in any state. A caller holding the upload token is resolved + * against the session, but the durable record wins once it exists: the session + * stays `completed` after the runner starts, and reporting `uploading` for an + * import that is already processing would strand a poller. + */ +export const readKnowledgeImport = defineAuthorizedKnowledgeUseCase({ + operation: knowledgeOperations.importRead, + resolveContext: ({ principal, input }: { principal: Principal; input: KnowledgeImportInput }) => + resolveImportContext(principal, input), + async execute({ context }): Promise { + if ('record' in context) return { import: fromRecord(context.record) } + const started = await findStartedImport(context) + return { + import: started ? fromRecord(started) : fromUpload(context.upload, context.workspaceId), + } + }, +}) + +export const createKnowledgeImportParts = defineAuthorizedKnowledgeUseCase({ + operation: knowledgeOperations.importParts, + resolveContext: ({ + principal, + input, + }: { + principal: Principal + input: CreateKnowledgeImportPartsInput + }) => resolveUploadContext(principal, input), + async execute({ principal, input, context, request }) { + if (!request) throw new Error('Knowledge import part issuance requires a request context') + // Repeated so a group that withdraws uploads mid-transfer stops the bytes, not just the import. + await assertImportedDocumentsAllowed(principal, context.workspaceId) + return { + parts: await createUploadPartUrls({ + session: context.upload, + partNumbers: input.partNumbers, + localOrigin: requestOrigin(request), + }), + } + }, +}) + +export const completeKnowledgeImport = defineAuthorizedKnowledgeUseCase({ + operation: knowledgeOperations.importComplete, + resolveContext: ({ + principal, + input, + }: { + principal: Principal + input: KnowledgeImportUploadInput + }) => resolveUploadContext(principal, input), + async execute({ principal, context }): Promise { + const existing = await findStartedImport(context) + if (existing) { + await redispatchUnclaimedImport(principal, context, existing) + return { import: fromRecord(existing) } + } + let started: KnowledgeImportPayload | null + try { + const completed = await completeUploadSession({ + session: context.upload, + finalize: async (claimed) => { + assertUploadSessionAuthBinding(claimed, principal) + await authorizeWorkspaceOperation( + principal, + knowledgeOperations.importComplete, + context, + { delegation: knowledgeDelegationPolicy } + ) + // Repeated because creation and completion are separate requests; see the helper. + await assertImportedDocumentsAllowed(principal, context.workspaceId) + return { value: await recordKnowledgeImport(principal, { ...context, upload: claimed }) } + }, + }) + started = completed.value + } catch (error) { + // A concurrent completion holds the session; report the import it started, if any. + const raced = + asOrchestrationError(error)?.code === 'conflict' ? await findStartedImport(context) : null + if (raced) return { import: fromRecord(raced) } + throw error + } + if (started) { + await startKnowledgeImport(started) + logger.info('Started knowledge import', { + importId: started.importId, + workspaceId: context.workspaceId, + principalKind: principal.kind, + }) + } + const record = await getKnowledgeImport({ + importId: context.upload.id, + assertedWorkspaceId: context.workspaceId, + }) + return { import: fromRecord(record) } + }, + /** + * What the caller did is start the import: the base exists only once the + * runner creates it, under the import's id. Keyed by the import, so the + * completion that started it and any retry of it record one event between them. + */ + projectAudit: ({ context, result }) => ({ + action: AuditAction.KNOWLEDGE_BASE_IMPORT_STARTED, + resourceType: AuditResourceType.KNOWLEDGE_BASE, + resourceId: result.import.id, + resourceName: importedName(context.upload) ?? context.upload.fileName, + description: `Started importing a knowledge base from bundle "${context.upload.fileName}"`, + metadata: { workspaceId: context.workspaceId, importId: result.import.id }, + idempotencyKey: `knowledge-import:${result.import.id}`, + }), +}) + +/** + * Stops an import. During its upload that aborts the transfer; once the + * runner is going it stops after the document in flight, and the documents + * already imported stay in the new base. + */ +export const cancelKnowledgeImport = defineAuthorizedKnowledgeUseCase({ + operation: knowledgeOperations.importCancel, + resolveContext: ({ principal, input }: { principal: Principal; input: KnowledgeImportInput }) => + resolveImportContext(principal, input), + async execute({ principal, context }): Promise { + if ('record' in context) + return { import: fromRecord(await stopKnowledgeImport(context.record)) } + const started = await findStartedImport(context) + if (started) return { import: fromRecord(await stopKnowledgeImport(started)) } + assertUploadSessionAuthBinding(context.upload, principal) + const aborted = await abortUploadSession(context.upload) + // A completion finalizing alongside this abort may have written the record first. + const late = await findStartedImport(context) + if (late) return { import: fromRecord(await stopKnowledgeImport(late)) } + return { import: fromUpload(aborted, context.workspaceId) } + }, +}) diff --git a/apps/sim/lib/knowledge/application/operations.ts b/apps/sim/lib/knowledge/application/operations.ts index b3f3cc58ad6..d15f9f60fca 100644 --- a/apps/sim/lib/knowledge/application/operations.ts +++ b/apps/sim/lib/knowledge/application/operations.ts @@ -309,8 +309,8 @@ export const knowledgeOperations = { }) ), /** - * The only operation that brings a knowledge base into existence, so it is the - * only one `knowledge.create` governs — a group may be allowed to query, + * Brings a knowledge base into existence, which `knowledge.create` governs here + * and on the bundle-import steps alone — a group may be allowed to query, * populate and organize the bases it already has without opening new ones. */ create: defineKnowledgeOperation( @@ -953,6 +953,67 @@ export const knowledgeOperations = { ...ALL_PRINCIPAL_POLICY, }) ), + /** + * A bundle import is one new knowledge base, split across requests because + * the archive is uploaded before it is read. Every step carries + * `knowledge.create` for the reason the upload steps share `knowledge.upload`: + * a group denied new bases must find no open step, cancel included. + */ + importCreate: defineKnowledgeOperation( + defineWorkspaceOperation({ + id: 'knowledge.imports.create', + oauthScope: 'api:write', + minimumRole: 'write', + workspaceApiKey: 'allow', + capability: 'knowledge.create', + contentDelivery: 'none', + ...ALL_PRINCIPAL_POLICY, + }) + ), + importParts: defineKnowledgeOperation( + defineWorkspaceOperation({ + id: 'knowledge.imports.parts', + oauthScope: 'api:write', + minimumRole: 'write', + workspaceApiKey: 'allow', + capability: 'knowledge.create', + contentDelivery: 'none', + ...ALL_PRINCIPAL_POLICY, + }) + ), + importComplete: defineKnowledgeOperation( + defineWorkspaceOperation({ + id: 'knowledge.imports.complete', + oauthScope: 'api:write', + minimumRole: 'write', + workspaceApiKey: 'allow', + capability: 'knowledge.create', + contentDelivery: 'none', + ...ALL_PRINCIPAL_POLICY, + }) + ), + importCancel: defineKnowledgeOperation( + defineWorkspaceOperation({ + id: 'knowledge.imports.cancel', + oauthScope: 'api:write', + minimumRole: 'write', + workspaceApiKey: 'allow', + capability: 'knowledge.create', + contentDelivery: 'none', + ...ALL_PRINCIPAL_POLICY, + }) + ), + importRead: defineKnowledgeOperation( + defineWorkspaceOperation({ + id: 'knowledge.imports.read', + oauthScope: 'api:read', + minimumRole: 'read', + workspaceApiKey: 'allow', + capability: 'knowledge.use', + contentDelivery: 'none', + ...ALL_PRINCIPAL_POLICY, + }) + ), } as const /** diff --git a/apps/sim/lib/knowledge/constants.ts b/apps/sim/lib/knowledge/constants.ts index 08444d02a23..dea484f1f76 100644 --- a/apps/sim/lib/knowledge/constants.ts +++ b/apps/sim/lib/knowledge/constants.ts @@ -211,3 +211,10 @@ export const MAX_KNOWLEDGE_BUNDLE_DOCUMENTS = 2_000 * because the processor's largest chunking config emits chunks past 10k. */ export const MAX_KNOWLEDGE_BUNDLE_CHUNK_CONTENT_LENGTH = 100_000 +/** Bytes an imported `manifest.json` may hold before it is read into memory. */ +export const MAX_KNOWLEDGE_BUNDLE_MANIFEST_BYTES = 64 * 1024 * 1024 +/** + * Bytes one imported document's chunk entry may hold, vectors included. The + * entry is read whole, as a parsed file's chunks are held whole while indexing. + */ +export const MAX_KNOWLEDGE_BUNDLE_CHUNKS_ENTRY_BYTES = 256 * 1024 * 1024 diff --git a/apps/sim/lib/knowledge/documents/service.ts b/apps/sim/lib/knowledge/documents/service.ts index a60e2b43d94..e67cef63585 100644 --- a/apps/sim/lib/knowledge/documents/service.ts +++ b/apps/sim/lib/knowledge/documents/service.ts @@ -1442,6 +1442,44 @@ export interface DocumentProcessingExecutionContext { readonly deadlineAt?: number } +/** + * Chunks a knowledge-base bundle already holds for a document. A pass given one + * indexes these chunks instead of parsing the document's file, and stores + * `vectors` instead of calling the embedding provider when the bundle was + * embedded with this base's model. + */ +export interface PreparedDocumentIndex { + readonly chunks: readonly { + readonly text: string + readonly startOffset: number + readonly endOffset: number + readonly enabled: boolean + }[] + /** One per chunk, in this base's embedding dimension. */ + readonly vectors?: readonly number[][] + /** Characters in the document's source text; chunks overlap, so their lengths do not sum to it. */ + readonly characterCount: number +} + +/** + * The processor's result shape for chunks that were never parsed here. Token + * counts are left to the pass, which estimates every chunk against this + * base's model whichever way the chunks arrived. + */ +function preparedProcessingResult(prepared: PreparedDocumentIndex) { + return { + chunks: prepared.chunks.map((chunk) => ({ + text: chunk.text, + metadata: { startIndex: chunk.startOffset, endIndex: chunk.endOffset }, + })), + metadata: { + chunkCount: prepared.chunks.length, + tokenCount: null, + characterCount: prepared.characterCount, + }, + } +} + export interface DocumentProcessingAttemptContext extends DocumentProcessingExecutionContext { /** True only when this invocation follows a successful queue-budget charge. */ readonly chargedAtDispatch: boolean @@ -1468,6 +1506,8 @@ export interface DocumentProcessingAttemptContext extends DocumentProcessingExec readonly scheduleDatabaseRetry?: (error: unknown) => Date | null /** Signals that this invocation owns the persisted processing generation. */ readonly onClaimed?: () => void + /** Index these chunks instead of parsing the document's file. */ + readonly preparedIndex?: PreparedDocumentIndex } /** @@ -1957,34 +1997,39 @@ export async function processDocumentAsync( (processing = runWithKnowledgeModelInputProvenance( documentSecretContext.registry, async () => { - await assertKnowledgeEmbeddingCapacity({ - ...kbEmbedding, - workspaceId: ctx.workspaceId, - signal, - }) - const processed = await processDocument( - persistedDocData.fileUrl, - persistedDocData.filename, - persistedDocData.mimeType, - kbConfig.maxSize, - kbConfig.overlap, - kbConfig.minSize, - { - ...sourceFileAccessFor(ctx.connectorId, documentActorUserId), + const prepared = attemptContext?.preparedIndex + if (!prepared?.vectors) { + await assertKnowledgeEmbeddingCapacity({ + ...kbEmbedding, + workspaceId: ctx.workspaceId, signal, - processingDeadlineAt, - imageExtraction: imageExtractionPolicyFor(ctx.connectorType), - onVisionUsage: (usage) => { - visionCharges.push(recordVisionUsage(usage)) - }, - ...(indexingPassId - ? { ocrCheckpoint: { knowledgeBaseId, documentId, indexingPassId } } - : {}), - }, - ctx.workspaceId, - rawConfig?.strategy, - rawConfig?.strategyOptions - ) + }) + } + const processed = prepared + ? preparedProcessingResult(prepared) + : await processDocument( + persistedDocData.fileUrl, + persistedDocData.filename, + persistedDocData.mimeType, + kbConfig.maxSize, + kbConfig.overlap, + kbConfig.minSize, + { + ...sourceFileAccessFor(ctx.connectorId, documentActorUserId), + signal, + processingDeadlineAt, + imageExtraction: imageExtractionPolicyFor(ctx.connectorType), + onVisionUsage: (usage) => { + visionCharges.push(recordVisionUsage(usage)) + }, + ...(indexingPassId + ? { ocrCheckpoint: { knowledgeBaseId, documentId, indexingPassId } } + : {}), + }, + ctx.workspaceId, + rawConfig?.strategy, + rawConfig?.strategyOptions + ) signal.throwIfAborted() assertDocumentChunkCountWithinLimit(processed.chunks.length) @@ -2016,7 +2061,9 @@ export async function processDocumentAsync( ? sha256Hex(JSON.stringify(chunkTexts.map((text) => sha256Hex(text)))) : undefined - if (chunkTexts.length > 0) { + if (prepared?.vectors) { + embeddings.push(...prepared.vectors) + } else if (chunkTexts.length > 0) { const batchSize = LARGE_DOC_CONFIG.MAX_EMBEDDING_BATCH const totalBatches = Math.ceil(chunkTexts.length / batchSize) @@ -2169,6 +2216,7 @@ export async function processDocumentAsync( embeddingModel: kbEmbeddingModel, startOffset: chunk.metadata.startIndex, endOffset: chunk.metadata.endIndex, + enabled: prepared?.chunks[chunkIndex].enabled ?? true, tag1: documentTags.tag1, tag2: documentTags.tag2, tag3: documentTags.tag3, @@ -2249,7 +2297,9 @@ export async function processDocumentAsync( .update(document) .set({ chunkCount: processed.metadata.chunkCount, - tokenCount: processed.metadata.tokenCount, + tokenCount: + processed.metadata.tokenCount ?? + chunkTokenCounts.reduce((sum, count) => sum + count, 0), characterCount: processed.metadata.characterCount, processingStatus: 'completed', processingCompletedAt: now, @@ -3237,6 +3287,8 @@ export async function createSingleDocument( options?: { expectedWorkspaceId?: string uploadedArtifact?: { cleanupEventId: string; metadataId: string; contentUpdatedAt: Date } + /** Whether the document starts out searchable; defaults to `true`. */ + enabled?: boolean processing?: { processingOptions: ProcessingOptions billingAttribution: BillingAttributionSnapshot @@ -3318,7 +3370,7 @@ export async function createSingleDocument( tokenCount: 0, characterCount: 0, processingStatus: 'pending' as const, - enabled: true, + enabled: options?.enabled ?? true, uploadedAt: now, uploadedBy, ...processedTags, diff --git a/apps/sim/lib/knowledge/service.ts b/apps/sim/lib/knowledge/service.ts index 1d15fd27556..37e86ebf637 100644 --- a/apps/sim/lib/knowledge/service.ts +++ b/apps/sim/lib/knowledge/service.ts @@ -430,16 +430,17 @@ export async function createKnowledgeBase( } /** - * Persists a knowledge base for an already-authorized application use case. - * Callers outside the application layer must use {@link createKnowledgeBase}. + * Persists a knowledge base for an already-authorized application use case, or + * for the background runner one dispatches. Other callers must use + * {@link createKnowledgeBase}. `id` is for a caller that minted the id earlier. */ export async function createAuthorizedKnowledgeBase( - data: Omit & ResourceOwner, + data: Omit & ResourceOwner & { id?: string }, requestId: string ): Promise { const scope = resourceScopeFromOwner(data) const owner = resourceScopeColumns(scope) - const kbId = generateId() + const kbId = data.id ?? generateId() const now = new Date() await assertKnowledgeBaseFolder(data.folderId, owner.workspaceId) diff --git a/apps/sim/lib/knowledge/transfer/bundle.ts b/apps/sim/lib/knowledge/transfer/bundle.ts index cbe66b9d61d..33a8faff334 100644 --- a/apps/sim/lib/knowledge/transfer/bundle.ts +++ b/apps/sim/lib/knowledge/transfer/bundle.ts @@ -280,3 +280,22 @@ export function toManifestDocument( export function encodeVectorBase64(vector: readonly number[]): string { return Buffer.from(Float32Array.from(vector).buffer).toString('base64') } + +/** + * Reads a vector written by {@link encodeVectorBase64}, or `null` when it does not + * hold exactly `dimension` finite coordinates. + */ +export function decodeVectorBase64(encoded: string, dimension: number): number[] | null { + const byteLength = dimension * Float32Array.BYTES_PER_ELEMENT + // Checked before decoding, so an oversized field is refused without allocating it. + if (encoded.length !== Math.ceil(byteLength / 3) * 4) return null + const bytes = Buffer.from(encoded, 'base64') + if (bytes.byteLength !== byteLength) return null + const vector = new Array(dimension) + for (let index = 0; index < dimension; index++) { + const value = bytes.readFloatLE(index * Float32Array.BYTES_PER_ELEMENT) + if (!Number.isFinite(value)) return null + vector[index] = value + } + return vector +} diff --git a/apps/sim/lib/knowledge/transfer/import-archive.test.ts b/apps/sim/lib/knowledge/transfer/import-archive.test.ts new file mode 100644 index 00000000000..373a391f79c --- /dev/null +++ b/apps/sim/lib/knowledge/transfer/import-archive.test.ts @@ -0,0 +1,220 @@ +import { createWriteStream } from 'node:fs' +import { mkdtemp, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { pipeline } from 'node:stream/promises' +import { ZipArchive } from 'archiver' +import { afterEach, beforeEach, describe, expect, it } from 'vitest' +import { encodeVectorBase64 } from '@/lib/knowledge/transfer/bundle' +import { openKnowledgeBundle } from '@/lib/knowledge/transfer/import-archive' + +const DOCUMENT_ID = 'doc-1' +const VECTOR = [0.25, -0.5, ...Array(1534).fill(0)] + +let directory: string + +beforeEach(async () => { + directory = await mkdtemp(join(tmpdir(), 'knowledge-import-archive-')) +}) +afterEach(async () => { + await rm(directory, { recursive: true, force: true }) +}) + +function manifest(overrides: Record = {}, document: Record = {}) { + return { + version: 1, + exportedAt: '2026-10-01T00:00:00.000Z', + embedding: { model: 'text-embedding-3-small', dimension: 1536, vectorsIncluded: true }, + knowledgeBase: { + name: 'Support docs', + description: null, + chunkingConfig: { maxSize: 1024, minSize: 100, overlap: 200 }, + }, + tags: [], + documents: [ + { + id: DOCUMENT_ID, + filename: 'handbook.txt', + mimeType: 'text/plain', + fileSize: 5, + enabled: true, + tags: {}, + file: `files/${DOCUMENT_ID}/handbook.txt`, + chunks: `chunks/${DOCUMENT_ID}.ndjson`, + chunkCount: 2, + tokenCount: 4, + characterCount: 10, + ...document, + }, + ], + ...overrides, + } +} + +const CHUNKS = { chunks: `chunks/${DOCUMENT_ID}.ndjson`, chunkCount: 2, characterCount: 10 } + +function chunkLine(index: number, extra: Record = {}): string { + return JSON.stringify({ + index, + content: `chunk ${index}`, + tokenCount: 2, + startOffset: index * 10, + endOffset: index * 10 + 7, + enabled: index === 0, + vector: encodeVectorBase64(VECTOR), + ...extra, + }) +} + +/** Writes entries in order with archiver, which, unlike a map, can repeat a name. */ +async function zipOf(entries: [string, string][]): Promise { + const path = join(directory, 'bundle.zip') + const archive = new ZipArchive() + const written = pipeline(archive, createWriteStream(path)) + for (const [name, content] of entries) archive.append(content, { name }) + await archive.finalize() + await written + return path +} + +function validEntries( + lines = [chunkLine(0), chunkLine(1)], + bundleManifest = manifest() +): [string, string][] { + return [ + [`files/${DOCUMENT_ID}/handbook.txt`, 'hello'], + [`chunks/${DOCUMENT_ID}.ndjson`, `${lines.join('\n')}\n`], + ['manifest.json', JSON.stringify(bundleManifest)], + ] +} + +describe('openKnowledgeBundle', () => { + it('reads the manifest, original file, chunks, and vectors of a well-formed bundle', async () => { + const reader = await openKnowledgeBundle(await zipOf(validEntries())) + try { + expect(reader.manifest.knowledgeBase.name).toBe('Support docs') + expect((await reader.readFile(`files/${DOCUMENT_ID}/handbook.txt`)).toString()).toBe('hello') + const withVectors = await reader.readChunks(CHUNKS, true) + expect(withVectors.chunks).toEqual([ + { text: 'chunk 0', startOffset: 0, endOffset: 7, enabled: true }, + { text: 'chunk 1', startOffset: 10, endOffset: 17, enabled: false }, + ]) + expect(withVectors.vectors).toEqual([VECTOR, VECTOR]) + expect((await reader.readChunks(CHUNKS, false)).vectors).toBeUndefined() + } finally { + reader.close() + } + }) + + it.each<[string, () => Promise, string]>([ + [ + 'a file that is not a zip archive', + async () => { + const path = join(directory, 'bundle.zip') + await writeFile(path, 'not a zip') + return path + }, + 'not a zip archive', + ], + [ + 'an archive without a manifest', + () => zipOf(validEntries().slice(0, 2)), + 'missing entry manifest.json', + ], + [ + 'a manifest that is not JSON', + () => zipOf([...validEntries().slice(0, 2), ['manifest.json', '{']]), + 'manifest.json is not valid JSON', + ], + [ + 'an unsupported bundle version', + () => zipOf(validEntries(undefined, manifest({ version: 2 }))), + 'manifest version', + ], + [ + 'a document listed twice', + () => { + const [listed] = manifest().documents + return zipOf(validEntries(undefined, manifest({ documents: [listed, listed] }))) + }, + 'duplicate document id doc-1', + ], + [ + 'a manifest naming an entry the archive lacks', + () => { + const [file, , manifestEntry] = validEntries() + return zipOf([file, manifestEntry]) + }, + 'missing entry chunks/doc-1.ndjson', + ], + [ + 'an archive with more entries than any bundle holds', + () => + zipOf(Array.from({ length: 4002 }, (_, index): [string, string] => [`extra/${index}`, ''])), + 'more than 4001 entries', + ], + [ + 'an archive that repeats an entry name', + () => zipOf([...validEntries(), ['manifest.json', JSON.stringify(manifest())]]), + 'duplicate entry manifest.json', + ], + ])('refuses %s before reading any document', async (_fixture, build, message) => { + await expect(openKnowledgeBundle(await build())).rejects.toThrow( + expect.objectContaining({ code: 'validation', message: expect.stringContaining(message) }) + ) + }) + + it.each([ + ['a line that is not JSON', [chunkLine(0), '{'], 'line 2 is not valid JSON'], + ['a line outside the chunk schema', [chunkLine(0), chunkLine(1, { content: '' })], 'line 2'], + ['chunks out of index order', [chunkLine(1), chunkLine(0)], 'chunks are out of order'], + [ + 'a chunk that ends before it starts', + [chunkLine(0), chunkLine(1, { startOffset: 20, endOffset: 10 })], + 'chunk 1 ends before it starts', + ], + ['fewer chunks than the manifest lists', [chunkLine(0)], 'holds 1 chunks'], + [ + 'a chunk without a vector', + [chunkLine(0), chunkLine(1, { vector: undefined })], + 'chunk 1 has no valid vector', + ], + [ + 'a vector of the wrong dimension', + [chunkLine(0), chunkLine(1, { vector: encodeVectorBase64([1, 2, 3]) })], + 'chunk 1 has no valid vector', + ], + ])('refuses a chunk entry with %s', async (_fixture, lines, message) => { + const reader = await openKnowledgeBundle(await zipOf(validEntries(lines))) + try { + await expect(reader.readChunks(CHUNKS, true)).rejects.toThrow( + expect.objectContaining({ code: 'validation', message: expect.stringContaining(message) }) + ) + } finally { + reader.close() + } + }) + + it('refuses a damaged chunk entry when validated, before any document is read', async () => { + const reader = await openKnowledgeBundle(await zipOf(validEntries([chunkLine(0), '{']))) + try { + await expect(reader.validateChunks(false)).rejects.toThrow( + expect.objectContaining({ code: 'validation', message: expect.stringContaining('line 2') }) + ) + } finally { + reader.close() + } + }) + + it('accepts chunks without vectors when they will be re-embedded', async () => { + const lines = [chunkLine(0, { vector: undefined }), chunkLine(1, { vector: undefined })] + const reader = await openKnowledgeBundle(await zipOf(validEntries(lines))) + try { + const { chunks, vectors } = await reader.readChunks(CHUNKS, false) + expect(chunks).toHaveLength(2) + expect(vectors).toBeUndefined() + } finally { + reader.close() + } + }) +}) diff --git a/apps/sim/lib/knowledge/transfer/import-archive.ts b/apps/sim/lib/knowledge/transfer/import-archive.ts new file mode 100644 index 00000000000..2a3900edbf7 --- /dev/null +++ b/apps/sim/lib/knowledge/transfer/import-archive.ts @@ -0,0 +1,243 @@ +/** + * Read side of a knowledge-base bundle import. The archive is opened from a + * local file so each entry is inflated on demand rather than the whole bundle + * held in memory, and nothing in it is trusted: the manifest is validated + * against the format, every entry it names must exist within its ceiling, and + * each chunk line is validated as it is read. yauzl enforces each entry's + * declared size while inflating, so a forged header cannot expand past the + * ceiling it was checked against. + */ + +import { createInterface } from 'node:readline' +import { type Entry, openPromise, type ZipFile } from 'yauzl' +import { OrchestrationError } from '@/lib/core/orchestration/types' +import { + MAX_KNOWLEDGE_BUNDLE_CHUNKS_ENTRY_BYTES, + MAX_KNOWLEDGE_BUNDLE_DOCUMENTS, + MAX_KNOWLEDGE_BUNDLE_MANIFEST_BYTES, +} from '@/lib/knowledge/constants' +import type { PreparedDocumentIndex } from '@/lib/knowledge/documents/service' +import { + decodeVectorBase64, + KNOWLEDGE_BUNDLE_MANIFEST_ENTRY, + type KnowledgeBundleDocument, + type KnowledgeBundleManifest, + knowledgeBundleChunkLineSchema, + knowledgeBundleManifestSchema, +} from '@/lib/knowledge/transfer/bundle' +import { MAX_KNOWLEDGE_DOCUMENT_FILE_SIZE } from '@/lib/uploads/shared/types' + +/** A file and a chunk entry per document, plus the manifest. */ +const MAX_BUNDLE_ENTRIES = 2 * MAX_KNOWLEDGE_BUNDLE_DOCUMENTS + 1 + +export interface KnowledgeBundleReader { + readonly manifest: KnowledgeBundleManifest + /** A document's original file, by the entry its manifest names. */ + readFile(entry: string): Promise + /** + * Reads every chunk entry through once, so a damaged entry refuses the whole + * bundle before the import writes anything. `vectors` as for {@link readChunks}. + */ + validateChunks(vectors: boolean): Promise + /** + * A document's chunks in index order, ready to index. With `vectors`, every + * line must carry a vector of the manifest's dimension; without, none is decoded. + */ + readChunks( + document: Pick & { chunks: string }, + vectors: boolean + ): Promise + close(): void +} + +function bundleError(message: string): OrchestrationError { + return new OrchestrationError('validation', `Invalid knowledge base bundle: ${message}`) +} + +async function indexEntries(zip: ZipFile): Promise> { + if (zip.entryCount > MAX_BUNDLE_ENTRIES) { + throw bundleError(`more than ${MAX_BUNDLE_ENTRIES} entries`) + } + const entries = new Map() + await new Promise((resolve, reject) => { + zip.on('entry', (entry: Entry) => { + if (entries.has(entry.fileName)) { + reject(bundleError(`duplicate entry ${entry.fileName}`)) + return + } + entries.set(entry.fileName, entry) + zip.readEntry() + }) + zip.once('end', resolve) + zip.once('error', reject) + zip.readEntry() + }) + return entries +} + +/** Inflates an entry into a buffer of its declared size, so a large file is held once. */ +async function readEntry(zip: ZipFile, entry: Entry): Promise { + const bytes = Buffer.allocUnsafe(entry.uncompressedSize) + let offset = 0 + for await (const chunk of await zip.openReadStreamPromise(entry)) { + if (offset + chunk.length > bytes.length) { + throw bundleError(`entry ${entry.fileName} is larger than it declares`) + } + offset += (chunk as Buffer).copy(bytes, offset) + } + return bytes +} + +function requireEntry(entries: Map, name: string, maxBytes: number): Entry { + const entry = entries.get(name) + if (!entry) throw bundleError(`missing entry ${name}`) + if (entry.isEncrypted()) throw bundleError(`entry ${name} is encrypted`) + if (entry.uncompressedSize > maxBytes) { + throw bundleError(`entry ${name} exceeds ${maxBytes} bytes`) + } + return entry +} + +function parseManifest(bytes: Buffer): KnowledgeBundleManifest { + let raw: unknown + try { + raw = JSON.parse(bytes.toString('utf8')) + } catch { + throw bundleError('manifest.json is not valid JSON') + } + const result = knowledgeBundleManifestSchema.safeParse(raw) + if (!result.success) { + const [issue] = result.error.issues + throw bundleError(`manifest ${issue.path.join('.')} ${issue.message}`) + } + const ids = new Set() + for (const document of result.data.documents) { + if (ids.has(document.id)) throw bundleError(`duplicate document id ${document.id}`) + ids.add(document.id) + } + return result.data +} + +/** + * Opens a bundle archive and validates its manifest and the entries it names + * before any document is read, so a malformed bundle is refused before the + * import writes anything. + */ +export async function openKnowledgeBundle(path: string): Promise { + let zip: ZipFile + try { + zip = await openPromise(path, { lazyEntries: true, autoClose: false }) + } catch { + throw bundleError('not a zip archive') + } + try { + const entries = await indexEntries(zip) + const manifest = parseManifest( + await readEntry( + zip, + requireEntry(entries, KNOWLEDGE_BUNDLE_MANIFEST_ENTRY, MAX_KNOWLEDGE_BUNDLE_MANIFEST_BYTES) + ) + ) + const validated = new Map() + for (const document of manifest.documents) { + if (document.file) { + validated.set( + document.file, + requireEntry(entries, document.file, MAX_KNOWLEDGE_DOCUMENT_FILE_SIZE) + ) + } + if (document.chunks) { + validated.set( + document.chunks, + requireEntry(entries, document.chunks, MAX_KNOWLEDGE_BUNDLE_CHUNKS_ENTRY_BYTES) + ) + } + } + const entryFor = (name: string) => { + const entry = validated.get(name) + if (!entry) throw new Error(`Bundle entry ${name} is not named by its manifest`) + return entry + } + + /** Streams one chunk entry, validating each line and handing it on in index order. */ + const scanChunks = async ( + name: string, + chunkCount: number, + vectors: boolean, + onChunk: (chunk: PreparedDocumentIndex['chunks'][number], vector: number[] | null) => void + ) => { + const stream = await zip.openReadStreamPromise(entryFor(name)) + let lines = 0 + let previousIndex = -1 + for await (const line of createInterface({ + input: stream, + crlfDelay: Number.POSITIVE_INFINITY, + })) { + if (line.length === 0) continue + lines++ + let raw: unknown + try { + raw = JSON.parse(line) + } catch { + throw bundleError(`${name} line ${lines} is not valid JSON`) + } + const parsed = knowledgeBundleChunkLineSchema.safeParse(raw) + if (!parsed.success) { + const [issue] = parsed.error.issues + throw bundleError(`${name} line ${lines} ${issue.path.join('.')} ${issue.message}`) + } + const chunk = parsed.data + if (chunk.index <= previousIndex) throw bundleError(`${name} chunks are out of order`) + if (chunk.endOffset < chunk.startOffset) { + throw bundleError(`${name} chunk ${chunk.index} ends before it starts`) + } + previousIndex = chunk.index + let vector: number[] | null = null + if (vectors) { + vector = chunk.vector + ? decodeVectorBase64(chunk.vector, manifest.embedding.dimension) + : null + if (!vector) throw bundleError(`${name} chunk ${chunk.index} has no valid vector`) + } + onChunk( + { + text: chunk.content, + startOffset: chunk.startOffset, + endOffset: chunk.endOffset, + enabled: chunk.enabled, + }, + vector + ) + } + if (lines !== chunkCount) { + throw bundleError(`${name} holds ${lines} chunks, but the manifest lists ${chunkCount}`) + } + } + + return { + manifest, + readFile: (name) => readEntry(zip, entryFor(name)), + async validateChunks(vectors) { + for (const document of manifest.documents) { + if (document.chunks) { + await scanChunks(document.chunks, document.chunkCount, vectors, () => {}) + } + } + }, + async readChunks(document, vectors) { + const chunks: PreparedDocumentIndex['chunks'][number][] = [] + const decoded: number[][] = [] + await scanChunks(document.chunks, document.chunkCount, vectors, (chunk, vector) => { + chunks.push(chunk) + if (vector) decoded.push(vector) + }) + const { characterCount } = document + return vectors ? { chunks, vectors: decoded, characterCount } : { chunks, characterCount } + }, + close: () => zip.close(), + } + } catch (error) { + zip.close() + throw error + } +} diff --git a/apps/sim/lib/knowledge/transfer/import-jobs.ts b/apps/sim/lib/knowledge/transfer/import-jobs.ts new file mode 100644 index 00000000000..232c3dc1612 --- /dev/null +++ b/apps/sim/lib/knowledge/transfer/import-jobs.ts @@ -0,0 +1,157 @@ +/** + * The `knowledge_base_import` state machine: `running` → `completed` | `failed` + * | `canceled`. Every write after creation is guarded on `running`, so a cancel + * or the stale-job janitor always wins over a runner that is still finishing a + * document: the runner's next write matches nothing, and it stops. + */ + +import { db } from '@sim/db' +import { knowledgeBaseImport } from '@sim/db/schema' +import { truncate } from '@sim/utils/string' +import { and, eq, isNull } from 'drizzle-orm' +import { OrchestrationError } from '@/lib/core/orchestration/types' + +/** Where an import's uploaded bundle is stored until the import settles. */ +export const KNOWLEDGE_IMPORT_STORAGE_CONTEXT = 'knowledge-import' + +export type KnowledgeImportRecord = typeof knowledgeBaseImport.$inferSelect + +/** A document the import could not bring over, and why. */ +export type KnowledgeImportFailure = KnowledgeImportRecord['failures'][number] + +/** How many document failures an import keeps; the count beyond it is still exact. */ +export const MAX_KNOWLEDGE_IMPORT_FAILURE_SAMPLES = 10 +const MAX_ERROR_LENGTH = 2000 + +function whileRunning(importId: string) { + return and(eq(knowledgeBaseImport.id, importId), eq(knowledgeBaseImport.status, 'running')) +} + +/** + * Records an import whose archive has finished uploading. Returns `null` when + * the id is already recorded, so a repeated completion never dispatches twice. + */ +export async function insertKnowledgeImport(values: { + id: string + workspaceId: string + userId: string + sourceKey: string +}): Promise { + const [inserted] = await db + .insert(knowledgeBaseImport) + .values(values) + .onConflictDoNothing({ target: knowledgeBaseImport.id }) + .returning() + return inserted ?? null +} + +export async function findKnowledgeImport(params: { + importId: string + assertedWorkspaceId?: string +}): Promise { + const [row] = await db + .select() + .from(knowledgeBaseImport) + .where( + and( + eq(knowledgeBaseImport.id, params.importId), + params.assertedWorkspaceId === undefined + ? undefined + : eq(knowledgeBaseImport.workspaceId, params.assertedWorkspaceId) + ) + ) + .limit(1) + return row ?? null +} + +export async function getKnowledgeImport(params: { + importId: string + assertedWorkspaceId?: string +}): Promise { + const record = await findKnowledgeImport(params) + if (!record) throw new OrchestrationError('not_found', 'Knowledge base import not found') + return record +} + +/** + * Claims a running import for one worker. Returns `false` when another worker + * already claimed it, or it settled, so a duplicate dispatch exits untouched. + */ +export async function claimKnowledgeImport(importId: string): Promise { + const now = new Date() + const claimed = await db + .update(knowledgeBaseImport) + .set({ startedAt: now, updatedAt: now }) + .where(and(whileRunning(importId), isNull(knowledgeBaseImport.startedAt))) + .returning({ id: knowledgeBaseImport.id }) + return claimed.length > 0 +} + +/** + * Records the runner's progress, which doubles as its heartbeat. Returns + * `false` once the import is no longer running, which tells the runner to stop. + */ +export async function updateRunningKnowledgeImport( + importId: string, + values: Partial< + Pick< + KnowledgeImportRecord, + | 'knowledgeBaseId' + | 'documentsTotal' + | 'documentsImported' + | 'documentsFailed' + | 'vectorsReused' + | 'failures' + > + > +): Promise { + const updated = await db + .update(knowledgeBaseImport) + .set({ ...values, updatedAt: new Date() }) + .where(whileRunning(importId)) + .returning({ id: knowledgeBaseImport.id }) + return updated.length > 0 +} + +/** Settles a running import. A no-op once it has already settled. */ +export async function finishKnowledgeImport( + importId: string, + outcome: { status: 'completed' } | { status: 'failed'; error: string } +): Promise { + const now = new Date() + await db + .update(knowledgeBaseImport) + .set({ + status: outcome.status, + error: outcome.status === 'failed' ? truncate(outcome.error, MAX_ERROR_LENGTH) : null, + completedAt: now, + updatedAt: now, + }) + .where(whileRunning(importId)) +} + +/** + * Stops a running import. The runner sees the change at its next progress + * write; the documents it already brought over stay in the base. + */ +export async function stopKnowledgeImport( + record: KnowledgeImportRecord +): Promise { + if (record.status === 'canceled') return record + if (record.status !== 'running') { + throw new OrchestrationError('conflict', `Knowledge base import is ${record.status}`) + } + const now = new Date() + const [canceled] = await db + .update(knowledgeBaseImport) + .set({ status: 'canceled', completedAt: now, updatedAt: now }) + .where(and(whileRunning(record.id), eq(knowledgeBaseImport.workspaceId, record.workspaceId))) + .returning() + if (canceled) return canceled + const current = await getKnowledgeImport({ + importId: record.id, + assertedWorkspaceId: record.workspaceId, + }) + if (current.status === 'canceled') return current + throw new OrchestrationError('conflict', `Knowledge base import is ${current.status}`) +} diff --git a/apps/sim/lib/knowledge/transfer/import-runner.ts b/apps/sim/lib/knowledge/transfer/import-runner.ts new file mode 100644 index 00000000000..6c8e707a108 --- /dev/null +++ b/apps/sim/lib/knowledge/transfer/import-runner.ts @@ -0,0 +1,405 @@ +import { createWriteStream } from 'node:fs' +import { mkdtemp, rm } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { pipeline } from 'node:stream/promises' +import { createLogger } from '@sim/logger' +import { getErrorMessage } from '@sim/utils/errors' +import { generateId } from '@sim/utils/id' +import type { BillingAttributionSnapshot } from '@/lib/billing/core/attribution' +import { asOrchestrationError, OrchestrationError } from '@/lib/core/orchestration/types' +import { mapWithConcurrency } from '@/lib/core/utils/concurrency' +import { generateRequestId } from '@/lib/core/utils/request' +import { createWorkspaceDocumentProcessingBillingContext } from '@/lib/knowledge/documents/processing-payload' +import { + createSingleDocument, + type PreparedDocumentIndex, + processDocumentAsync, +} from '@/lib/knowledge/documents/service' +import { uploadKnowledgeArtifact } from '@/lib/knowledge/documents/storage-upload' +import { getConfiguredKbEmbedding, type KbEmbeddingTarget } from '@/lib/knowledge/embeddings' +import { createAuthorizedKnowledgeBase, deleteKnowledgeBase } from '@/lib/knowledge/service' +import { createTagDefinition } from '@/lib/knowledge/tags/service' +import { validateTagValue, validateTagValueLength } from '@/lib/knowledge/tags/utils' +import type { + KnowledgeBundleDocument, + KnowledgeBundleManifest, +} from '@/lib/knowledge/transfer/bundle' +import { + type KnowledgeBundleReader, + openKnowledgeBundle, +} from '@/lib/knowledge/transfer/import-archive' +import { + claimKnowledgeImport, + findKnowledgeImport, + finishKnowledgeImport, + KNOWLEDGE_IMPORT_STORAGE_CONTEXT, + type KnowledgeImportFailure, + MAX_KNOWLEDGE_IMPORT_FAILURE_SAMPLES, + updateRunningKnowledgeImport, +} from '@/lib/knowledge/transfer/import-jobs' +import { generateKnowledgeBaseFileKey } from '@/lib/uploads/contexts/knowledge-base/file-manager' +import { deleteFile, downloadFileStream } from '@/lib/uploads/core/storage-service' +import { + EMPTY_KNOWLEDGE_DOCUMENT_MESSAGE, + MAX_KNOWLEDGE_DOCUMENT_FILE_SIZE, +} from '@/lib/uploads/shared/types' +import { getFileExtension } from '@/lib/uploads/utils/file' +import { isSupportedExtension, validateFileType } from '@/lib/uploads/utils/validation' + +const logger = createLogger('KnowledgeImportRunner') + +/** + * Documents imported at once, so one document's storage upload and indexing + * overlap another's while at most two 100 MB originals are held in memory. + */ +const DOCUMENT_CONCURRENCY = 2 + +/** + * What a worker needs to run an import. The base it creates takes the import's + * id, so every dispatch of one import names the same base, and the import's + * audit names it before it exists. + */ +export interface KnowledgeImportPayload { + importId: string + workspaceId: string + /** The person the base and its documents are attributed to. */ + userId: string + /** Overrides the bundle's own knowledge base name. */ + name?: string + /** Storage key of the uploaded bundle, deleted once the import settles. */ + sourceKey: string + billingAttribution: BillingAttributionSnapshot +} + +/** + * Whether the bundle's vectors can be stored as they are. A vector is only + * meaningful to the model that produced it, so anything else is re-embedded. + */ +function canReuseVectors(manifest: KnowledgeBundleManifest, target: KbEmbeddingTarget): boolean { + return ( + manifest.embedding.vectorsIncluded && + manifest.embedding.model === target.model && + manifest.embedding.dimension === target.dimensions + ) +} + +/** + * The bundle's tag values in the shape document creation reads, refused here + * with a caller-facing reason when one would not be accepted. Dates travel as + * ISO timestamps but are stored as calendar days. + */ +function documentTagsData( + document: KnowledgeBundleDocument, + manifest: KnowledgeBundleManifest +): string | undefined { + const tags = manifest.tags.flatMap((tag) => { + const wire = document.tags[tag.slot] + if (wire === undefined) return [] + const value = tag.fieldType === 'date' ? wire.slice(0, 10) : wire + const invalid = + validateTagValueLength(tag.displayName, value) ?? + validateTagValue(tag.displayName, value, tag.fieldType) + if (invalid) throw new OrchestrationError('validation', invalid) + return [{ tagName: tag.displayName, fieldType: tag.fieldType, value }] + }) + return tags.length > 0 ? JSON.stringify(tags) : undefined +} + +/** A failure's own message when it is caller-fixable, or `null` when its text is internal. */ +function callerMessage(error: unknown): string | null { + const classified = asOrchestrationError(error) + return classified && classified.code !== 'internal' ? classified.message : null +} + +/** + * The name a document rebuilt from its chunk text is stored under. Parsing + * goes by extension first, so a name claiming another format gains `.txt` + * and a reprocess reads the text it holds. + */ +function textFilename(filename: string): string { + const extension = getFileExtension(filename) + return isSupportedExtension(extension) && extension !== 'txt' ? `${filename}.txt` : filename +} + +interface ImportDocumentContext { + payload: KnowledgeImportPayload + reader: KnowledgeBundleReader + knowledgeBaseId: string + reuseVectors: boolean +} + +/** + * Brings one document over. Its original file is stored the way an upload + * stores one; a document the bundle carries only as chunks is stored as the + * plain text those chunks hold, so it can still be reprocessed later. Chunks + * are indexed in place when their vectors can be reused or there is no + * original to parse; otherwise the file is queued for ordinary processing, + * exactly as an upload is. + */ +async function importDocument( + context: ImportDocumentContext, + document: KnowledgeBundleDocument +): Promise { + const { payload, reader, knowledgeBaseId, reuseVectors } = context + const requestId = generateRequestId() + const documentId = generateId() + const documentTags = documentTagsData(document, reader.manifest) + + const prepared: PreparedDocumentIndex | null = + document.chunks !== null && (reuseVectors || !document.file) + ? await reader.readChunks( + { + chunks: document.chunks, + chunkCount: document.chunkCount, + characterCount: document.characterCount, + }, + reuseVectors + ) + : null + + let source: { bytes: Buffer; filename: string; mimeType: string } + if (document.file) { + const fileTypeError = validateFileType(document.filename, document.mimeType) + if (fileTypeError) throw new OrchestrationError('validation', fileTypeError.message) + source = { + bytes: await reader.readFile(document.file), + filename: document.filename, + mimeType: document.mimeType, + } + } else if (prepared) { + const bytes = Buffer.from(prepared.chunks.map((chunk) => chunk.text).join('\n\n')) + if (bytes.byteLength === 0) { + throw new OrchestrationError('validation', EMPTY_KNOWLEDGE_DOCUMENT_MESSAGE) + } + if (bytes.byteLength > MAX_KNOWLEDGE_DOCUMENT_FILE_SIZE) { + throw new OrchestrationError( + 'payload_too_large', + 'Document text exceeds the 100MB knowledge document limit' + ) + } + source = { bytes, filename: textFilename(document.filename), mimeType: 'text/plain' } + } else { + throw new Error(`Bundle document ${document.id} has neither a file nor chunks`) + } + + const uploadedArtifact = await uploadKnowledgeArtifact({ + documentId, + key: generateKnowledgeBaseFileKey(source.filename), + owner: { workspaceId: payload.workspaceId, userId: payload.userId }, + artifact: { bytes: source.bytes, fileName: source.filename, mimeType: source.mimeType }, + }) + const docData = { + filename: source.filename, + fileUrl: `${uploadedArtifact.path}?context=knowledge-base`, + fileSize: source.bytes.byteLength, + mimeType: source.mimeType, + } + await createSingleDocument( + { ...docData, documentTagsData: documentTags }, + knowledgeBaseId, + requestId, + payload.userId, + documentId, + undefined, + { + expectedWorkspaceId: payload.workspaceId, + enabled: document.enabled, + uploadedArtifact, + ...(prepared + ? {} + : { + processing: { + processingOptions: {}, + billingAttribution: payload.billingAttribution, + }, + }), + } + ) + + if (prepared) { + await processDocumentAsync( + knowledgeBaseId, + documentId, + docData, + {}, + createWorkspaceDocumentProcessingBillingContext(payload.billingAttribution), + undefined, + { chargedAtDispatch: false, preparedIndex: prepared } + ) + } +} + +/** + * Creates the base the bundle describes, with its tag definitions, and + * imports every document in manifest order. A document that cannot be + * imported is recorded and skipped; anything that stops the base itself from + * being created fails the whole import. + */ +async function importBundle( + payload: KnowledgeImportPayload, + reader: KnowledgeBundleReader +): Promise { + const { manifest } = reader + const target = await getConfiguredKbEmbedding() + const reuseVectors = canReuseVectors(manifest, target) + const requestId = generateRequestId() + await reader.validateChunks(reuseVectors) + + // A cancel that landed while the bundle was downloading or being validated stops it here. + if (!(await updateRunningKnowledgeImport(payload.importId, {}))) return + const knowledgeBase = await createAuthorizedKnowledgeBase( + { + id: payload.importId, + name: payload.name ?? manifest.knowledgeBase.name, + description: manifest.knowledgeBase.description ?? undefined, + workspaceId: payload.workspaceId, + folderId: null, + userId: payload.userId, + embeddingModel: target.model, + embeddingDimension: target.dimensions, + chunkingConfig: manifest.knowledgeBase.chunkingConfig, + }, + requestId + ) + const attached = await updateRunningKnowledgeImport(payload.importId, { + knowledgeBaseId: knowledgeBase.id, + documentsTotal: manifest.documents.length, + vectorsReused: reuseVectors, + }) + if (!attached) { + // Canceled between the check above and now: the base is still empty, so it goes too. + await deleteKnowledgeBase(knowledgeBase.id, requestId) + return + } + + try { + for (const tag of manifest.tags) { + await createTagDefinition( + { + knowledgeBaseId: knowledgeBase.id, + tagSlot: tag.slot, + displayName: tag.displayName, + fieldType: tag.fieldType, + }, + requestId + ) + } + } catch (error) { + // No document has landed yet, so a base without its tags is removed rather than kept half-built. + await deleteKnowledgeBase(knowledgeBase.id, requestId) + throw error + } + + const context: ImportDocumentContext = { + payload, + reader, + knowledgeBaseId: knowledgeBase.id, + reuseVectors, + } + let documentsImported = 0 + let documentsFailed = 0 + const failures: KnowledgeImportFailure[] = [] + // Chained so concurrent documents report in order; each write reads the counts as they stand. + let reported = Promise.resolve(true) + const report = () => { + reported = reported.then( + (running) => + running && + updateRunningKnowledgeImport(payload.importId, { + documentsImported, + documentsFailed, + failures: [...failures], + }) + ) + return reported + } + let stopped = false + await mapWithConcurrency(manifest.documents, DOCUMENT_CONCURRENCY, async (document) => { + if (stopped) return + try { + await importDocument(context, document) + documentsImported++ + } catch (error) { + documentsFailed++ + if (failures.length < MAX_KNOWLEDGE_IMPORT_FAILURE_SAMPLES) { + failures.push({ + filename: document.filename, + message: callerMessage(error) ?? 'This document could not be imported', + }) + } + logger.warn('Knowledge import skipped a document', { + importId: payload.importId, + knowledgeBaseId: knowledgeBase.id, + bundleDocumentId: document.id, + error: getErrorMessage(error, 'Unknown error'), + }) + } + if (!(await report())) stopped = true + }) + if (stopped || !(await reported)) return + await finishKnowledgeImport(payload.importId, { status: 'completed' }) + logger.info('Knowledge import completed', { + importId: payload.importId, + knowledgeBaseId: knowledgeBase.id, + documentsImported, + documentsFailed, + vectorsReused: reuseVectors, + }) +} + +/** + * Runs one import to a settled state. The worker claims the import first, so a + * second dispatch of it leaves the first worker's bundle alone. The bundle is + * copied to local disk so its entries can be read by offset, and both copies + * are removed however the import ends. + */ +export async function runKnowledgeImport(payload: KnowledgeImportPayload): Promise { + if (!(await claimKnowledgeImport(payload.importId))) { + // Settled before any worker claimed it, so no worker is reading the bundle. + const record = await findKnowledgeImport({ importId: payload.importId }) + if (record && !record.startedAt) await deleteBundle(payload) + return + } + const directory = await mkdtemp(join(tmpdir(), 'knowledge-import-')) + let reader: KnowledgeBundleReader | undefined + try { + const path = join(directory, 'bundle.zip') + await pipeline( + await downloadFileStream({ + key: payload.sourceKey, + context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT, + }), + createWriteStream(path) + ) + reader = await openKnowledgeBundle(path) + await importBundle(payload, reader) + } catch (error) { + const message = callerMessage(error) + if (!message) logger.error('Knowledge import failed', { importId: payload.importId, error }) + await finishKnowledgeImport(payload.importId, { + status: 'failed', + error: message ?? 'Knowledge base import failed', + }).catch((finishError: unknown) => { + logger.error('Failed to record a knowledge import failure', { + importId: payload.importId, + error: getErrorMessage(finishError, 'Unknown error'), + }) + }) + } finally { + reader?.close() + await rm(directory, { recursive: true, force: true }) + await deleteBundle(payload) + } +} + +async function deleteBundle(payload: KnowledgeImportPayload): Promise { + await deleteFile({ key: payload.sourceKey, context: KNOWLEDGE_IMPORT_STORAGE_CONTEXT }).catch( + (error: unknown) => { + logger.warn('Failed to delete an imported knowledge bundle', { + importId: payload.importId, + error: getErrorMessage(error, 'Unknown error'), + }) + } + ) +} diff --git a/apps/sim/lib/logs/execution/trace-secret-projection.test.ts b/apps/sim/lib/logs/execution/trace-secret-projection.test.ts index 10ad61b18b0..84b214b1e55 100644 --- a/apps/sim/lib/logs/execution/trace-secret-projection.test.ts +++ b/apps/sim/lib/logs/execution/trace-secret-projection.test.ts @@ -340,6 +340,63 @@ describe('projectTraceSpansForSecrets', () => { expect(result[0].output).toEqual({ value: 'prefix {{LONG}} suffix' }) }) + /** Never moves backwards across tests: the slice deadline it sets outlives each one. */ + let fakeClockMs = 0 + + /** + * Counts event-loop turns that complete while the projection is in flight, on a clock that + * advances 1ms per read so the slice expires at a fixed rate on any machine. A single yield + * before any work allows one turn — the pending immediate runs, and its successor cannot until + * the projection parks again — so two or more prove it keeps yielding mid-projection. + */ + async function countTurnsDuringProjection(spans: TraceSpan[]) { + fakeClockMs = Math.max(fakeClockMs, performance.now()) + const now = vi.spyOn(performance, 'now').mockImplementation(() => { + fakeClockMs += 1 + return fakeClockMs + }) + let settled = false + let turns = 0 + const tick = () => { + if (settled) return + turns += 1 + setImmediate(tick) + } + setImmediate(tick) + try { + const projected = await projectTraceSpansForSecrets(spans, { + registry: createRegistry([{ plaintext: 'secretval', replacement: '{{SECRET}}' }]), + store: STORE, + }) + return { turns, projected } + } finally { + settled = true + now.mockRestore() + } + } + + it('keeps yielding to the event loop throughout a content projection', async () => { + const spans = Array.from({ length: 30 }, (_, index) => + createSpan({ id: `span-${index}`, output: { note: `span ${index} holds secretval` } }) + ) + + const { turns, projected } = await countTurnsDuringProjection(spans) + + expect(turns).toBeGreaterThanOrEqual(2) + expect(projected[29].output).toEqual({ note: 'span 29 holds {{SECRET}}' }) + }) + + it('keeps yielding to the event loop throughout a structure-only projection', async () => { + const children = Array.from({ length: 50 }, (_, index) => createSpan({ id: `child-${index}` })) + + const { turns, projected } = await countTurnsDuringProjection([ + createSpan({ id: 'root', type: 'workflow', children }), + ]) + + expect(turns).toBeGreaterThanOrEqual(2) + expect(projected[0].children).toHaveLength(50) + }) + it('projects a successfully resolved numeric Function result without mutating runtime output', async () => { const runtimeOutput = { result: 12345678, unchanged: 5678 } const source = createSpan({ output: runtimeOutput }) @@ -445,6 +502,85 @@ describe('projectTraceSpansForSecrets', () => { expect(span.children?.[0]).not.toHaveProperty('output') }) + it('marks every span of a structural-only fallback as content-withheld', async () => { + const source = [ + createSpan({ + output: { secret: 'raw' }, + children: [createSpan({ id: 'child-1', output: { secret: 'raw' } })], + }), + ] + + const incomplete = await projectTraceSpansForSecrets(source, { + registry: createRegistry([], false), + store: STORE, + }) + const failedMatcher = await projectTraceSpansForSecrets(source, { + registry: createRegistry([ + { plaintext: 's'.repeat(64 * 1024 + 1), replacement: '{{TOO_LARGE}}' }, + ]), + store: STORE, + }) + const failedInvariant = await enforceTraceSpanSecretInvariant( + [createSpan({ output: { apiKey: '[REDACTED]' } })], + { + registry: createRegistry([{ plaintext: 'REDACTED', replacement: '{{X}}' }]), + store: STORE, + } + ) + + for (const [span] of [incomplete, failedMatcher]) { + expect(span.contentWithheld).toBe(true) + expect(span.children?.[0].contentWithheld).toBe(true) + } + expect(failedInvariant[0].contentWithheld).toBe(true) + }) + + it('marks a span whose content field was omitted and leaves fully projected spans unmarked', async () => { + const [omitted, intact] = await projectTraceSpansForSecrets( + [ + createSpan({ input: { safe: 'keep' }, output: { secretval: 1, '{{TOKEN}}': 2 } }), + createSpan({ id: 'span-2', output: { value: 'secretval' } }), + ], + { + registry: createRegistry([{ plaintext: 'secretval', replacement: '{{TOKEN}}' }]), + store: STORE, + } + ) + + expect(omitted.input).toEqual({ safe: 'keep' }) + expect(omitted.contentWithheld).toBe(true) + expect(intact.output).toEqual({ value: '{{TOKEN}}' }) + expect(intact).not.toHaveProperty('contentWithheld') + }) + + it('marks a span whose tool-call content was omitted', async () => { + const [span] = await projectTraceSpansForSecrets( + [ + createSpan({ + output: { safe: 'keep' }, + toolCalls: [ + { + name: 'legacy', + duration: 1, + startTime: '2026-07-01T00:00:00.000Z', + endTime: '2026-07-01T00:00:00.001Z', + status: 'success', + output: { secretval: 1, '{{TOKEN}}': 2 }, + }, + ], + }), + ], + { + registry: createRegistry([{ plaintext: 'secretval', replacement: '{{TOKEN}}' }]), + store: STORE, + } + ) + + expect(span.output).toEqual({ safe: 'keep' }) + expect(span.toolCalls?.[0]).not.toHaveProperty('output') + expect(span.contentWithheld).toBe(true) + }) + it('fails closed when a later log transform reintroduces an active literal', async () => { const source = [createSpan({ output: { apiKey: '[REDACTED]' } })] diff --git a/apps/sim/lib/logs/execution/trace-secret-projection.ts b/apps/sim/lib/logs/execution/trace-secret-projection.ts index 7ff7501739a..9b3a1110476 100644 --- a/apps/sim/lib/logs/execution/trace-secret-projection.ts +++ b/apps/sim/lib/logs/execution/trace-secret-projection.ts @@ -1,6 +1,7 @@ import { createLogger } from '@sim/logger' import { toError } from '@sim/utils/errors' import { isPlainRecord, omit } from '@sim/utils/object' +import { yieldWhenSliceExpires } from '@/lib/core/utils/event-loop' import { isLargeArrayManifest, LARGE_ARRAY_MANIFEST_MARKER, @@ -81,6 +82,8 @@ interface ProjectionContext { sourceLargeValueBytes: number storedLargeValueBytes: number storedLargeValueCount: number + /** Content fields omitted so far; a span compares it across its own fields to set `contentWithheld`. */ + omittedContentFields: number } interface OversizedHydrationGate { @@ -161,6 +164,7 @@ function createProjectionContext( manifestIds: new WeakMap(), nextManifestId: 0, largeValueCount: 0, + omittedContentFields: 0, sourceLargeValueBytes: 0, storedLargeValueBytes: 0, storedLargeValueCount: 0, @@ -800,12 +804,14 @@ async function sanitizeContentField( value: unknown, context: ProjectionContext ): Promise { + await yieldWhenSliceExpires() try { return await sanitizeMaterializedValue(value, context) } catch (error) { logger.warn('Omitting trace content that could not be sanitized', { failure: describeProjectionFailure(error), }) + context.omittedContentFields += 1 return OMIT } } @@ -829,6 +835,7 @@ async function sanitizeIterationToolCalls( assertTraceStructureArrayFits(calls, state) const sanitized: IterationToolCall[] = [] for (const call of calls) { + await yieldWhenSliceExpires() if (!takeTraceStructureNode(state, depth)) { throw new TraceSecretProjectionError('Trace tool-call structure limit exceeded') } @@ -851,6 +858,7 @@ async function sanitizeLegacyToolCalls( assertTraceStructureArrayFits(calls, state) const sanitized: ToolCall[] = [] for (const call of calls) { + await yieldWhenSliceExpires() if (!takeTraceStructureNode(state, depth)) { throw new TraceSecretProjectionError('Trace tool-call structure limit exceeded') } @@ -881,6 +889,7 @@ async function sanitizeProviderSegment( state: BoundedTraceStructureState, depth: number ): Promise { + await yieldWhenSliceExpires() if (!takeTraceStructureNode(state, depth)) { throw new TraceSecretProjectionError('Trace provider structure limit exceeded') } @@ -913,13 +922,16 @@ async function sanitizeTraceSpan( span: TraceSpan, context: ProjectionContext, depth: number, - state: BoundedTraceStructureState + state: BoundedTraceStructureState, + assertContentIsSafe: SpanContentAssertion ): Promise { + await yieldWhenSliceExpires() if (!takeTraceStructureNode(state, depth)) { throw new TraceSecretProjectionError('Trace span structure limit exceeded') } let projected = omit(span, ['displayResolvedSecretTraceProvenance']) as TraceSpan + const omittedBefore = context.omittedContentFields for (const key of ['input', 'output', 'thinking', 'errorMessage'] as const) { const value = span[key] @@ -954,11 +966,15 @@ async function sanitizeTraceSpan( projected.providerTiming = { ...span.providerTiming, segments } } + if (context.omittedContentFields > omittedBefore) projected.contentWithheld = true + + assertContentIsSafe(projected, depth) + if (span.children !== undefined) { assertTraceStructureArrayFits(span.children, state) const children: TraceSpan[] = [] for (const child of span.children) { - children.push(await sanitizeTraceSpan(child, context, depth + 1, state)) + children.push(await sanitizeTraceSpan(child, context, depth + 1, state, assertContentIsSafe)) } projected.children = children } @@ -1065,6 +1081,7 @@ function structuralOnlySpan( return { ...structural, + contentWithheld: true, ...(modelToolCalls ? { modelToolCalls: projectBoundedArray(modelToolCalls, (call) => @@ -1278,11 +1295,12 @@ function assertNoPlaintext( type TraceContentVisitor = (value: unknown) => void -function visitTraceSpanContent( +/** Visits one span's content, not its children's; `visitTraceSpanContent` descends from here. */ +function visitTraceSpanOwnContent( span: TraceSpan, visit: TraceContentVisitor, structureState: BoundedTraceStructureState, - depth = 0 + depth: number ): void { if (!takeTraceStructureNode(structureState, depth)) { throw new TraceSecretProjectionError('Trace invariant structure limit exceeded') @@ -1335,6 +1353,15 @@ function visitTraceSpanContent( } } assertTraceStructureArrayFits(span.children ?? [], structureState) +} + +function visitTraceSpanContent( + span: TraceSpan, + visit: TraceContentVisitor, + structureState: BoundedTraceStructureState, + depth = 0 +): void { + visitTraceSpanOwnContent(span, visit, structureState, depth) for (const child of span.children ?? []) { visitTraceSpanContent(child, visit, structureState, depth + 1) } @@ -1348,12 +1375,23 @@ function visitTraceSpansContent(traceSpans: TraceSpan[], visit: TraceContentVisi } } -function assertTraceSpansContentIsSafe( - traceSpans: TraceSpan[], +type SpanContentAssertion = (span: TraceSpan, depth: number) => void + +/** + * The whole-trace content check, applied to each projected span as soon as its own content is + * final. Called in projection order (pre-order, a parent before its children), it walks exactly + * what one walk of the finished trace would, so an over-budget trace fails at the span that + * crosses the budget instead of after the whole trace was projected and then discarded. + */ +function createSpanContentAssertion( + traceSpans: readonly TraceSpan[], context: PlaintextInvariantContext -): void { +): SpanContentAssertion { + const structureState: BoundedTraceStructureState = { nodes: 0, truncated: false } const contentState: TraversalState = { nodes: 0, ancestors: new WeakSet() } - visitTraceSpansContent(traceSpans, (value) => assertNoPlaintext(value, context, contentState)) + assertTraceStructureArrayFits(traceSpans, structureState) + const visit = (value: unknown) => assertNoPlaintext(value, context, contentState) + return (span, depth) => visitTraceSpanOwnContent(span, visit, structureState, depth) } function collectPostTransformLargeValues( @@ -1577,10 +1615,10 @@ export async function projectTraceSpansForSecrets( const projected: TraceSpan[] = [] const state: BoundedTraceStructureState = { nodes: 0, truncated: false } assertTraceStructureArrayFits(traceSpans, state) + const assertContentIsSafe = createSpanContentAssertion(traceSpans, context) for (const span of traceSpans) { - projected.push(await sanitizeTraceSpan(span, context, 0, state)) + projected.push(await sanitizeTraceSpan(span, context, 0, state, assertContentIsSafe)) } - assertTraceSpansContentIsSafe(projected, context) return projected } catch (error) { logger.warn('Trace secret projection failed; retaining structural spans only', { diff --git a/apps/sim/lib/logs/execution/trace-store.ts b/apps/sim/lib/logs/execution/trace-store.ts index 78ae6fae575..d2334e83800 100644 --- a/apps/sim/lib/logs/execution/trace-store.ts +++ b/apps/sim/lib/logs/execution/trace-store.ts @@ -28,6 +28,17 @@ export const SECRET_PROJECTION_VERSION = 1 as const */ export const TRACE_STORE_REF_KEY = 'traceStoreRef' +/** + * Bytes of the stored archive a slim `execution_data` row points at, or 0 when + * the row carries its execution data inline. Read before materializing, so a + * caller can budget a page by what it is about to load. + */ +export function executionDataArchiveBytes(executionData: unknown): number { + if (!isRecordLike(executionData)) return 0 + const ref = executionData[TRACE_STORE_REF_KEY] + return isLargeValueRef(ref) ? ref.size : 0 +} + /** * The only metadata kept inline on the slim row (everything else lives in the * externalized object). Trace presence/count survives object expiry for log diff --git a/apps/sim/lib/logs/public-queries.test.ts b/apps/sim/lib/logs/public-queries.test.ts index 6a4c415516a..97a2586ccf0 100644 --- a/apps/sim/lib/logs/public-queries.test.ts +++ b/apps/sim/lib/logs/public-queries.test.ts @@ -325,3 +325,135 @@ describe('sortable public log query', () => { expect(dbChainMockFns.limit).toHaveBeenLastCalledWith(51) }) }) + +/** + * A page that carries execution data is materialized, projected, validated, and + * serialized whole, so the caller's `limit` cannot be what sizes it. The read + * narrows the page instead, and the narrowed page has to mint its cursor from + * its own last row or the walk skips every row past the cut. + */ +describe('public log page carrying execution data', () => { + const MB = 1024 * 1024 + + beforeEach(() => { + resetDbChainMock() + }) + + /** Rows in descending start order, each pointing at an archive of `archiveBytes`. */ + function archivedRows(count: number, archiveBytes: number, idPrefix = 'w', parity = 0) { + return Array.from({ length: count }, (_, index) => { + const slot = index * 2 + parity + const second = String(59 - (slot % 60)).padStart(2, '0') + const minute = String(59 - Math.floor(slot / 60)).padStart(2, '0') + return { + id: `${idPrefix}-${index}`, + startedAtCursor: `2026-08-06T00:${minute}:${second}.000000Z`, + executionData: { + traceStoreRef: { + __simLargeValueRef: true, + version: 1, + id: 'lv_bbbbbbbbbbbb', + kind: 'object', + size: archiveBytes, + key: `execution/workspace-1/workflow-1/execution-${index}/large-value-lv_bbbbbbbbbbbb.json`, + executionId: `execution-${index}`, + }, + }, + } + }) + } + + function readPage(input: { includeExecutionData: boolean; cursorKeys?: string[] }) { + return readPublicLogPage({ + filters: { workspaceId: 'workspace-1' }, + includeExecutionData: input.includeExecutionData, + sortBy: 'startedAt', + sortOrder: 'desc', + cursorKeys: input.cursorKeys, + limit: 100, + }) + } + + /** + * Follows `nextCursorKeys` to the end, serving each page the rows strictly + * after the cursor the way the keyset predicate would, and returns every + * page's ids. + */ + async function walk(rows: ReturnType) { + const pages: string[][] = [] + let cursorKeys: string[] | undefined + while (pages.length <= rows.length) { + const after = cursorKeys ? rows.findIndex((row) => row.id === cursorKeys?.[1]) + 1 : 0 + queueTableRows(schemaMock.workflowExecutionLogs, rows.slice(after)) + const page = await readPage({ includeExecutionData: true, cursorKeys }) + pages.push(page.data.map((row) => row.id)) + if (!page.nextCursorKeys) return pages + cursorKeys = page.nextCursorKeys as string[] + } + throw new Error('walk did not terminate') + } + + it('reads at most one materialization wave of rows when execution data is requested', async () => { + const rows = archivedRows(30, MB) + + const pages = await walk(rows) + + expect(dbChainMockFns.limit).toHaveBeenCalledWith(21) + expect(dbChainMockFns.limit).not.toHaveBeenCalledWith(101) + expect(pages.map((page) => page.length)).toEqual([20, 10]) + expect(pages.flat()).toEqual(rows.map((row) => row.id)) + }) + + it('cuts a page at its archive byte budget and resumes right after the cut', async () => { + const rows = archivedRows(30, 10 * MB) + + const pages = await walk(rows) + + expect(pages.map((page) => page.length)).toEqual([6, 6, 6, 6, 6]) + expect(pages.flat()).toEqual(rows.map((row) => row.id)) + }) + + it('keeps the requested page size when no execution data is read', async () => { + const rows = archivedRows(30, MB) + queueTableRows(schemaMock.workflowExecutionLogs, rows) + + const page = await readPage({ includeExecutionData: false }) + + expect(dbChainMockFns.limit).toHaveBeenLastCalledWith(101) + expect(page.data).toHaveLength(rows.length) + expect(page.nextCursorKeys).toBeNull() + }) + + it('admits one run whose archive alone exceeds the budget, so the walk still advances', async () => { + const rows = archivedRows(3, 100 * MB) + queueTableRows(schemaMock.workflowExecutionLogs, rows) + + const page = await readPage({ includeExecutionData: true }) + + expect(page.data.map((row) => row.id)).toEqual(['w-0']) + expect(page.nextCursorKeys).toEqual([rows[0].startedAtCursor, 'w-0']) + }) + + it('budgets the merged page when job runs are interleaved with materialized runs', async () => { + const workflowRows = archivedRows(10, 40 * MB, 'w', 0) + const jobRows = archivedRows(10, 0, 'j', 1).map(({ id, startedAtCursor }) => ({ + id, + startedAtCursor, + })) + queueTableRows(schemaMock.workflowExecutionLogs, workflowRows) + queueTableRows(schemaMock.jobExecutionLogs, jobRows) + + const page = await readPublicLogPage({ + filters: { workspaceId: 'workspace-1' }, + includeExecutionData: true, + includeJobRuns: true, + sortBy: 'startedAt', + sortOrder: 'desc', + cursorKeys: undefined, + limit: 100, + }) + + expect(page.data.map((row) => row.id)).toEqual(['w-0', 'j-0']) + expect(page.nextCursorKeys).toEqual([jobRows[0].startedAtCursor, 'j-0']) + }) +}) diff --git a/apps/sim/lib/logs/public-queries.ts b/apps/sim/lib/logs/public-queries.ts index 644c50b1fab..3649b1176be 100644 --- a/apps/sim/lib/logs/public-queries.ts +++ b/apps/sim/lib/logs/public-queries.ts @@ -29,6 +29,9 @@ import { textKey, timestampKey, } from '@/lib/api/list-query' +import { MATERIALIZE_CONCURRENCY } from '@/lib/core/utils/concurrency' +import { MAX_DURABLE_LARGE_VALUE_BYTES } from '@/lib/execution/payloads/limits' +import { executionDataArchiveBytes } from '@/lib/logs/execution/trace-store' import { workflowExecutionOriginSql } from '@/lib/logs/execution-origin' import { folderScopeCondition, type LogFolderScope } from '@/lib/logs/folder-scope' import { handledErrorSpanCondition } from '@/lib/logs/handled-errors' @@ -354,6 +357,44 @@ function readJobLogRows( .limit(input.limit + 1) } +/** + * Rows a page that carries execution data may hold: one + * {@link MATERIALIZE_CONCURRENCY} wave. Each row is materialized from its + * archive and secret-projected before the page is validated and serialized in + * one synchronous pass, so the caller's `limit` alone would let one request hold + * a process's heap and event loop for as many traces as it asks for. + */ +const MATERIALIZED_LOG_PAGE_MAX = MATERIALIZE_CONCURRENCY + +/** + * Stored archive bytes a page that carries execution data may load. The row + * count alone does not bound a page: archives vary by orders of magnitude, and a + * page of the largest serializes past what one string can hold. The first row is + * always admitted, so a page of one oversized run still advances the walk. + */ +const MATERIALIZED_LOG_PAGE_BYTES = MAX_DURABLE_LARGE_VALUE_BYTES + +/** + * The page size a read may return: the caller's `limit`, narrowed when the page + * carries execution data. The narrowed page still mints its cursor from its own + * last row, so a walk resumes immediately after it — the caller follows + * `nextCursor` and sees every row once. + */ +function executionDataPageLimit( + rows: readonly (PublicWorkflowLogListRow | PublicLogListRow)[], + input: ReadPublicLogPageInput +): number { + if (!input.includeExecutionData) return input.limit + let bytes = 0 + let admitted = 0 + for (const row of rows.slice(0, input.limit)) { + if ('executionData' in row) bytes += executionDataArchiveBytes(row.executionData) + if (admitted > 0 && bytes > MATERIALIZED_LOG_PAGE_BYTES) break + admitted += 1 + } + return admitted +} + /** * Reads one page of the public log sequence, ordered by any of * {@link PUBLIC_LOG_SORT_FIELDS} and resumed from a shared keyset cursor. @@ -368,8 +409,11 @@ function readJobLogRows( * another page" without a count. */ export async function readPublicLogPage( - input: ReadPublicLogPageInput + pageInput: ReadPublicLogPageInput ): Promise> { + const input = pageInput.includeExecutionData + ? { ...pageInput, limit: Math.min(pageInput.limit, MATERIALIZED_LOG_PAGE_MAX) } + : pageInput const keys = publicLogKeyset(input.sortBy, input.cursorKeys) // `folderScope` is checked separately from `jobLogsSelectable`, which reads @@ -399,7 +443,7 @@ export async function readPublicLogPage( ]) if (!includeJobRuns) { - const page = keysetPage(keys, workflowRows, input.limit) + const page = keysetPage(keys, workflowRows, executionDataPageLimit(workflowRows, input)) return { data: page.data.map((row): PublicLogListRow => ({ kind: 'workflow', ...row })), nextCursorKeys: page.nextCursorKeys, @@ -419,7 +463,7 @@ export async function readPublicLogPage( mergedKeys, input.sortOrder ) - return keysetPage(mergedKeys, merged, input.limit) + return keysetPage(mergedKeys, merged, executionDataPageLimit(merged, input)) } /** diff --git a/apps/sim/lib/logs/types.ts b/apps/sim/lib/logs/types.ts index d284bb333d9..6c0bba8bd3c 100644 --- a/apps/sim/lib/logs/types.ts +++ b/apps/sim/lib/logs/types.ts @@ -308,6 +308,15 @@ export interface TraceSpan { * one read, not the run. */ childTraceAccess?: 'granted' | 'disabled' | 'missing' | 'truncated' + /** + * Set by secret projection when it omitted content it could not prove safe from + * this span (`input`, `output`, `thinking`, `errorMessage`, or its tool-call and + * provider-segment content), or reduced the span to structure only. Status, timing, + * and usage remain. Without it a withheld field is + * indistinguishable from one the block never produced. A content field is omitted + * whole, so a key missing inside a field that is present is genuinely absent. + */ + contentWithheld?: true model?: string cost?: { input?: number diff --git a/apps/sim/lib/monitoring/event-loop-telemetry.ts b/apps/sim/lib/monitoring/event-loop-telemetry.ts new file mode 100644 index 00000000000..4e7ccef7a43 --- /dev/null +++ b/apps/sim/lib/monitoring/event-loop-telemetry.ts @@ -0,0 +1,134 @@ +/** + * Event-loop health telemetry. One event loop serves every request in the + * process, so a synchronous CPU burst in one request stalls all of them; this + * makes that visible from the process itself. + * + * - Every {@link SNAPSHOT_INTERVAL_MS}, one INFO `Event loop snapshot` line with + * delay percentiles from `monitorEventLoopDelay`, process CPU share, and the + * in-flight route handler count. + * - Whenever a {@link STALL_PROBE_MS} probe timer fires at least + * {@link STALL_WARN_MS} late, one WARN `Event loop stalled` line (at most + * {@link MAX_STALL_WARNINGS_PER_SNAPSHOT} per window) listing the route + * handlers in flight during the stall as concurrency context; see + * `in-flight-requests.ts` for what that list cannot attribute. + * + * Both lines are emitted after the loop recovers, since nothing on a blocked + * loop can run; a stall that never ends shows up as a missing snapshot instead. + * + * Reading the numbers: + * - On Bun the delay histogram records only the excess delay beyond the + * sampling timer, so an idle loop reads near 0 ms. On Node each sample + * includes the {@link HISTOGRAM_RESOLUTION_MS} resolution, so an idle loop + * reads about 20 ms. Compare values only within one runtime. + * - A block is counted as a stall only once the probe is a full + * {@link STALL_WARN_MS} late, which takes a block of 1.0–1.25 s depending on + * where in the probe interval it starts. Shorter blocks show only in + * `lagMaxMs`. + * - `performance.eventLoopUtilization()` is a stub of zeros on Bun, so `elu` is + * emitted only where it reports real values. `cpuPct` (process CPU share, + * which also counts GC and other threads) is the signal on both runtimes. + */ + +import { monitorEventLoopDelay, performance } from 'node:perf_hooks' +import { createLogger } from '@sim/logger' +import { + findRequestsSpanningStall, + getInFlightCount, + takeInFlightWindow, +} from '@/lib/monitoring/in-flight-requests' + +const logger = createLogger('EventLoopTelemetry', { logLevel: 'INFO' }) + +const SNAPSHOT_INTERVAL_MS = 60_000 +const HISTOGRAM_RESOLUTION_MS = 20 +const STALL_PROBE_MS = 250 +const STALL_WARN_MS = 1_000 +/** Caps WARN volume when the loop is stalling continuously; the snapshot still counts every stall. */ +const MAX_STALL_WARNINGS_PER_SNAPSHOT = 10 + +const NS_PER_MS = 1e6 + +/** On `globalThis` so a second module instance (dev reloads, a second bundle graph) cannot start a second set of timers. */ +const g = globalThis as typeof globalThis & { _simEventLoopTelemetryStarted?: boolean } + +const round = (value: number, digits = 1) => { + const factor = 10 ** digits + return Math.round(value * factor) / factor +} + +/** + * Starts the snapshot and stall-probe timers once per process. Both timers are + * unref'd, so they never keep the process alive. Called from instrumentation + * at server start. + */ +export function startEventLoopTelemetry() { + if (g._simEventLoopTelemetryStarted) return + g._simEventLoopTelemetryStarted = true + + const histogram = monitorEventLoopDelay({ resolution: HISTOGRAM_RESOLUTION_MS }) + histogram.enable() + + let stallCount = 0 + let stallMaxMs = 0 + let stallTotalMs = 0 + let warningsThisWindow = 0 + + let lastProbe = performance.now() + const probe = setInterval(() => { + const now = performance.now() + const lateMs = now - lastProbe - STALL_PROBE_MS + lastProbe = now + if (lateMs < STALL_WARN_MS) return + + stallCount++ + stallTotalMs += lateMs + if (lateMs > stallMaxMs) stallMaxMs = lateMs + if (warningsThisWindow >= MAX_STALL_WARNINGS_PER_SNAPSHOT) return + warningsThisWindow++ + + logger.warn('Event loop stalled', { + stallMs: Math.round(lateMs), + inFlight: getInFlightCount(), + inFlightDuringStall: findRequestsSpanningStall(now - lateMs, now), + }) + }, STALL_PROBE_MS) + probe.unref() + + let lastWall = performance.now() + let lastCpu = process.cpuUsage() + let lastElu = performance.eventLoopUtilization() + + const snapshot = setInterval(() => { + const wallMs = performance.now() - lastWall + const cpu = process.cpuUsage(lastCpu) + const elu = performance.eventLoopUtilization(lastElu) + const count = histogram.count + const inFlightWindow = takeInFlightWindow() + + logger.info('Event loop snapshot', { + lagP50Ms: count ? round(histogram.percentile(50) / NS_PER_MS) : 0, + lagP99Ms: count ? round(histogram.percentile(99) / NS_PER_MS) : 0, + lagMaxMs: count ? round(histogram.max / NS_PER_MS) : 0, + lagMeanMs: count ? round(histogram.mean / NS_PER_MS) : 0, + stalls: stallCount, + stallMaxMs: Math.round(stallMaxMs), + stallTotalMs: Math.round(stallTotalMs), + cpuPct: wallMs > 0 ? round(((cpu.user + cpu.system) / 1000 / wallMs) * 100) : 0, + ...(elu.idle + elu.active > 0 ? { elu: round(elu.utilization, 3) } : {}), + inFlight: getInFlightCount(), + inFlightPeak: inFlightWindow.peak, + ...(inFlightWindow.dropped > 0 ? { inFlightDropped: inFlightWindow.dropped } : {}), + windowMs: Math.round(wallMs), + }) + + histogram.reset() + stallCount = 0 + stallMaxMs = 0 + stallTotalMs = 0 + warningsThisWindow = 0 + lastWall = performance.now() + lastCpu = process.cpuUsage() + lastElu = performance.eventLoopUtilization() + }, SNAPSHOT_INTERVAL_MS) + snapshot.unref() +} diff --git a/apps/sim/lib/monitoring/in-flight-requests.test.ts b/apps/sim/lib/monitoring/in-flight-requests.test.ts new file mode 100644 index 00000000000..b1774f237c8 --- /dev/null +++ b/apps/sim/lib/monitoring/in-flight-requests.test.ts @@ -0,0 +1,102 @@ +/** + * Failure modes guarded here: + * - Next instantiates this file once per bundle graph (instrumentation vs each + * route), so per-module state would leave the telemetry reader seeing an + * empty registry while routes write to their own copy. + * - Request ids repeat when route wrappers nest, so keying entries by request id + * lets the inner settle erase the outer entry. + * - A handler that never settles must not grow the registry without bound. + * - A synchronous burst settles its own request a few milliseconds before the + * stall probe runs, so a near-zero tolerance never reports it. + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +type InFlightModule = typeof import('@/lib/monitoring/in-flight-requests') + +async function loadFreshModuleInstance(): Promise { + vi.resetModules() + return import('@/lib/monitoring/in-flight-requests') +} + +describe('in-flight request registry', () => { + beforeEach(() => { + for (const key of Object.keys(globalThis)) { + if (key.startsWith('_simInFlight')) Reflect.deleteProperty(globalThis, key) + } + }) + + it('shares state between separately instantiated copies of the module', async () => { + const routeInstance = await loadFreshModuleInstance() + const telemetryInstance = await loadFreshModuleInstance() + expect(routeInstance).not.toBe(telemetryInstance) + + const settle = routeInstance.trackInFlightRequest('req-1', 'POST', '/api/a') + expect(telemetryInstance.getInFlightCount()).toBe(1) + + settle() + expect(telemetryInstance.getInFlightCount()).toBe(0) + }) + + it('keeps an outer entry when a nested wrapper reuses the same request id', async () => { + const registry = await loadFreshModuleInstance() + const settleOuter = registry.trackInFlightRequest('req-1', 'POST', '/api/a') + const settleInner = registry.trackInFlightRequest('req-1', 'POST', '/api/a') + + settleInner() + expect(registry.getInFlightCount()).toBe(1) + + settleOuter() + expect(registry.getInFlightCount()).toBe(0) + }) + + it('bounds the registry when handlers never settle', async () => { + const registry = await loadFreshModuleInstance() + for (let i = 0; i < 10_000; i++) registry.trackInFlightRequest(`req-${i}`, 'GET', '/api/hang') + + const tracked = registry.getInFlightCount() + expect(tracked).toBeLessThan(10_000) + expect(registry.takeInFlightWindow().dropped).toBe(10_000 - tracked) + }) + + it('reports a request that settled shortly before the stall was observed', async () => { + const registry = await loadFreshModuleInstance() + const settle = registry.trackInFlightRequest('req-burst', 'POST', '/api/burst') + const stallStart = performance.now() + settle() + const stallEnd = performance.now() + 20 + + const spanning = registry.findRequestsSpanningStall(stallStart, stallEnd) + expect(spanning.map((entry) => entry.requestId)).toEqual(['req-burst']) + expect(spanning[0].finished).toBe(true) + }) + + it('reports a request that started just after the probe was due, but not one queued behind the stall', async () => { + vi.useFakeTimers({ toFake: ['performance'] }) + try { + const registry = await loadFreshModuleInstance() + const probeDue = performance.now() + vi.advanceTimersByTime(20) + const settleBlocker = registry.trackInFlightRequest('req-blocker', 'POST', '/api/blocker') + vi.advanceTimersByTime(1_500) + settleBlocker() + const settleQueued = registry.trackInFlightRequest('req-queued', 'GET', '/api/queued') + vi.advanceTimersByTime(5) + settleQueued() + vi.advanceTimersByTime(5) + + const spanning = registry.findRequestsSpanningStall(probeDue, performance.now()) + expect(spanning.map((entry) => entry.requestId)).toEqual(['req-blocker']) + } finally { + vi.useRealTimers() + } + }) + + it('does not report a request that finished well before the stall ended', async () => { + const registry = await loadFreshModuleInstance() + const settle = registry.trackInFlightRequest('req-early', 'GET', '/api/early') + const stallStart = performance.now() + settle() + + expect(registry.findRequestsSpanningStall(stallStart, performance.now() + 500)).toEqual([]) + }) +}) diff --git a/apps/sim/lib/monitoring/in-flight-requests.ts b/apps/sim/lib/monitoring/in-flight-requests.ts new file mode 100644 index 00000000000..85131a946d6 --- /dev/null +++ b/apps/sim/lib/monitoring/in-flight-requests.ts @@ -0,0 +1,152 @@ +/** + * Process-wide registry of route handlers currently running, plus a short ring + * of recently settled ones, so an event-loop stall can list the requests that + * were in flight while it happened. + * + * State lives on `globalThis`: Next instantiates this file once in the + * instrumentation graph and again in each app-route graph, and module-level + * state would leave the telemetry reader looking at an empty copy. + * + * What it can and cannot see: + * - An entry settles when the handler returns its `Response` (headers), not + * when a streamed body finishes, so work done while streaming is never + * attributed. Page renders, server actions, and background loops are not + * tracked at all. + * - The list is concurrency context, not a culprit: a long-poll or SSE handshake + * that merely waited through a stall appears alongside the request that + * caused it. + * - Entries are keyed by a per-call token, so nested wrappers that share a + * request id each keep their own entry (and each count toward `inFlight`). + * - A handler that never settles keeps its entry until the registry holds + * {@link MAX_TRACKED_IN_FLIGHT} entries; the oldest are then dropped and + * counted in {@link InFlightWindow.dropped}. + * + * Paths are already present on every route log line, so naming them here + * widens no exposure. + */ + +interface TrackedRequest { + requestId: string + method: string + path: string + startedAt: number + endedAt?: number +} + +/** A request that was in flight for the whole of a stall window. */ +interface RequestSpanningStall { + requestId: string + method: string + path: string + /** How long the request had been running when the stall ended. */ + ageMs: number + /** True when it settled at (or within the tolerance before) the end of the stall. */ + finished: boolean +} + +/** Per-snapshot-window counters, reset by {@link takeInFlightWindow}. */ +interface InFlightWindow { + /** Highest concurrent in-flight count during the window. */ + peak: number + /** Entries evicted because the registry was full (handlers that never settled). */ + dropped: number +} + +interface InFlightState { + live: Map + recent: (TrackedRequest | undefined)[] + recentNext: number + nextToken: number + peak: number + dropped: number +} + +const MAX_TRACKED_IN_FLIGHT = 4_096 +const RECENT_CAPACITY = 64 +const MAX_SPANNING_RESULTS = 5 +/** + * Slack applied at both edges of a stall window. The probe timer runs some + * milliseconds after the burst that freed the loop settled its own request, and + * a request can start a few milliseconds after the probe was due (other + * callbacks ran first) and then block. Requests queued behind the stall start + * at its end, a full second or more later, so they stay out. + */ +const STALL_EDGE_TOLERANCE_MS = 50 + +const g = globalThis as typeof globalThis & { _simInFlightRequestState?: InFlightState } +if (!g._simInFlightRequestState) { + g._simInFlightRequestState = { + live: new Map(), + recent: new Array(RECENT_CAPACITY), + recentNext: 0, + nextToken: 0, + peak: 0, + dropped: 0, + } +} +const state = g._simInFlightRequestState + +/** + * Registers a running route handler. Call the returned function once when the + * handler settles; later calls are no-ops. + */ +export function trackInFlightRequest(requestId: string, method: string, path: string): () => void { + const token = state.nextToken++ + const entry: TrackedRequest = { requestId, method, path, startedAt: performance.now() } + state.live.set(token, entry) + if (state.live.size > MAX_TRACKED_IN_FLIGHT) { + const oldest = state.live.keys().next().value + if (oldest !== undefined) state.live.delete(oldest) + state.dropped++ + } + if (state.live.size > state.peak) state.peak = state.live.size + return () => { + if (!state.live.delete(token)) return + entry.endedAt = performance.now() + state.recent[state.recentNext] = entry + state.recentNext = (state.recentNext + 1) % RECENT_CAPACITY + } +} + +/** Number of route handlers currently registered as running. */ +export function getInFlightCount(): number { + return state.live.size +} + +/** Returns the window's counters and starts a new window (peak restarts at the current count). */ +export function takeInFlightWindow(): InFlightWindow { + const window = { peak: state.peak, dropped: state.dropped } + state.peak = state.live.size + state.dropped = 0 + return window +} + +/** + * Requests in flight for the whole stall window: started before it began and + * still running, or settled by its end, each edge widened by + * {@link STALL_EDGE_TOLERANCE_MS}. `stallStart` is when the probe was due. + * Settled ones come first (the likeliest source of a synchronous burst), then + * longest-running first. Concurrency context only; see the module TSDoc. + */ +export function findRequestsSpanningStall( + stallStart: number, + stallEnd: number +): RequestSpanningStall[] { + const spansStall = (entry: TrackedRequest) => + entry.startedAt <= stallStart + STALL_EDGE_TOLERANCE_MS && + (entry.endedAt ?? stallEnd) >= stallEnd - STALL_EDGE_TOLERANCE_MS + const matches: TrackedRequest[] = [] + for (const entry of state.live.values()) if (spansStall(entry)) matches.push(entry) + for (const entry of state.recent) if (entry && spansStall(entry)) matches.push(entry) + matches.sort( + (a, b) => + Number(b.endedAt !== undefined) - Number(a.endedAt !== undefined) || a.startedAt - b.startedAt + ) + return matches.slice(0, MAX_SPANNING_RESULTS).map((entry) => ({ + requestId: entry.requestId, + method: entry.method, + path: entry.path, + ageMs: Math.round(stallEnd - entry.startedAt), + finished: entry.endedAt !== undefined, + })) +} diff --git a/apps/sim/lib/monitoring/otlp.ts b/apps/sim/lib/monitoring/otlp.ts index bb21c0d4aab..3878fa0d53b 100644 --- a/apps/sim/lib/monitoring/otlp.ts +++ b/apps/sim/lib/monitoring/otlp.ts @@ -25,3 +25,62 @@ export function parseOtlpHeaders(raw: string): Record { } return out } + +/** + * Sim's anonymous telemetry collector, used when no collector is configured. It receives traces + * only: logs and metrics carry an instance's own operational detail and go only to a collector + * its operator chose. + */ +export const ANONYMOUS_TELEMETRY_ENDPOINT = 'https://telemetry.simstudio.ai/v1/traces' + +/** True when the operator turned telemetry off (`NEXT_TELEMETRY_DISABLED=1`). */ +export function isTelemetryDisabled(): boolean { + return process.env.NEXT_TELEMETRY_DISABLED === '1' +} + +/** True when `endpoint` names the anonymous collector's host, however the URL is spelled. */ +function isAnonymousCollector(endpoint: string): boolean { + try { + return new URL(endpoint).host === new URL(ANONYMOUS_TELEMETRY_ENDPOINT).host + } catch { + return false + } +} + +/** + * The collector this process sends telemetry to: `OTEL_EXPORTER_OTLP_ENDPOINT`, then the legacy + * `TELEMETRY_ENDPOINT`, then `fallback` (a fork's `telemetry.config.ts` endpoint, or the anonymous + * collector). `OTEL_EXPORTER_OTLP_HEADERS` belong to the operator's own collector, so they are + * never sent to the anonymous one. + */ +export function resolveOtlpTarget(fallback: string = ANONYMOUS_TELEMETRY_ENDPOINT): { + endpoint: string + headers: Record + anonymous: boolean +} { + const endpoint = + process.env.OTEL_EXPORTER_OTLP_ENDPOINT || process.env.TELEMETRY_ENDPOINT || fallback + const anonymous = isAnonymousCollector(endpoint) + return { + endpoint, + headers: anonymous ? {} : parseOtlpHeaders(process.env.OTEL_EXPORTER_OTLP_HEADERS || ''), + anonymous, + } +} + +/** + * Appends `/v1/traces` to an OTLP base URL's path unless it already ends there (with or without a + * trailing slash), keeping any query string. The HTTP exporter doesn't auto-suffix the signal path + * even though the spec says the env var is a base URL. + */ +export function normalizeOtlpTracesUrl(url: string): string { + if (!url) return url + try { + const u = new URL(url) + const path = u.pathname.replace(/\/+$/, '') + u.pathname = path.endsWith('/v1/traces') ? path : `${path}/v1/traces` + return u.toString() + } catch { + return url + } +} diff --git a/apps/sim/lib/mothership/agent-cli/engines.test.ts b/apps/sim/lib/mothership/agent-cli/engines.test.ts index a8d5bf2a8d2..dc5b575313d 100644 --- a/apps/sim/lib/mothership/agent-cli/engines.test.ts +++ b/apps/sim/lib/mothership/agent-cli/engines.test.ts @@ -101,6 +101,159 @@ describe('logs query', () => { }) }) +const WITHHELD_RUNS = { + [RUNS_PATH]: { + data: [ + { runId: 'run-1', status: 'completed' }, + { runId: 'run-2', status: 'completed' }, + ], + }, + '/api/v2/logs/run-1': { + data: { + traceSpans: [{ name: 'Count rows', status: 'success', output: { result: { count: 6 } } }], + }, + }, + // The log projection withheld this span's content; its structure survived. + '/api/v2/logs/run-2': { + data: { + traceSpans: [{ name: 'Count rows', status: 'success', duration: 12, contentWithheld: true }], + }, + }, +} + +async function logsQueryWithheld(flags: Record) { + const result = await runEngine('logs query', ['wf-1'], runtimeWith(WITHHELD_RUNS), { + block: 'Count rows', + ...flags, + }) + expect(result.exitCode).toBe(0) + return JSON.parse(result.stdout) +} + +describe('logs query on a span whose content was withheld', () => { + it('reports withheld content instead of a missing path, and counts it', async () => { + const report = await logsQueryWithheld({ field: 'result.count' }) + expect(report.rows[0]).toMatchObject({ runId: 'run-1', value: 6 }) + expect(report.rows[1]).toMatchObject({ runId: 'run-2', hits: 1, value: null }) + expect(report.rows[1].note).not.toBe('path not found on span') + expect(report.rows[1].note).toMatch(/withheld/) + expect(report.contentWithheld).toBe(1) + }) + + it('still answers structural paths on a withheld span', async () => { + const report = await logsQueryWithheld({ field: 'duration' }) + expect(report.rows[1]).toMatchObject({ runId: 'run-2', value: 12 }) + expect(report.rows[1].note).toBeUndefined() + expect(report.contentWithheld).toBeUndefined() + }) + + it('keeps a withheld run under --where as unchecked, not as a match or filtered out', async () => { + const report = await logsQueryWithheld({ where: 'result.count=6' }) + expect(report.filteredOut).toBe(0) + expect(report.rows.map((row: { runId: string }) => row.runId)).toEqual(['run-1', 'run-2']) + expect(report.rows[0].whereUnchecked).toBeUndefined() + expect(report.rows[1].whereUnchecked).toBe(true) + expect(report.whereUnchecked).toBe(1) + }) + + it('counts an unchecked --where apart from a withheld --field', async () => { + const readableField = await logsQueryWithheld({ field: 'duration', where: 'result.count=6' }) + expect(readableField.rows[1]).toMatchObject({ runId: 'run-2', value: 12 }) + expect(readableField.rows[1].note).toMatch(/--where/) + expect(readableField.whereUnchecked).toBe(1) + expect(readableField.contentWithheld).toBeUndefined() + + const withheldField = await logsQueryWithheld({ where: 'result.count=6' }) + expect(withheldField.rows[1].note).toMatch(/value unknown/) + expect(withheldField.whereUnchecked).toBe(1) + expect(withheldField.contentWithheld).toBe(1) + }) +}) + +// The projection omits a content field whole, so a span marked for its `thinking` +// still carries an intact `output` whose missing keys are genuinely absent. +const PARTLY_WITHHELD_RUNS = { + [RUNS_PATH]: { + data: [ + { runId: 'run-1', status: 'completed' }, + { runId: 'run-2', status: 'completed' }, + ], + }, + '/api/v2/logs/run-1': { + data: { + traceSpans: [ + { + name: 'Router', + status: 'success', + output: { route: 'priority', thinking: 'not the omitted span thinking' }, + contentWithheld: true, + }, + ], + }, + }, + '/api/v2/logs/run-2': { + data: { + traceSpans: [ + { + name: 'Router', + status: 'success', + output: { content: 'no route chosen' }, + toolCalls: [{ name: 'lookup' }], + contentWithheld: true, + }, + ], + }, + }, +} + +async function logsQueryPartlyWithheld(flags: Record) { + const result = await runEngine('logs query', ['wf-1'], runtimeWith(PARTLY_WITHHELD_RUNS), { + block: 'Router', + ...flags, + }) + expect(result.exitCode).toBe(0) + return JSON.parse(result.stdout) +} + +describe('logs query on a marked span whose read field is intact', () => { + it('filters out a run whose intact output lacks the --where key', async () => { + const report = await logsQueryPartlyWithheld({ where: 'output.route=priority' }) + expect(report.rows.map((row: { runId: string }) => row.runId)).toEqual(['run-1']) + expect(report.filteredOut).toBe(1) + expect(report.whereUnchecked).toBeUndefined() + + const viaFallback = await logsQueryPartlyWithheld({ where: 'route=priority' }) + expect(viaFallback.rows.map((row: { runId: string }) => row.runId)).toEqual(['run-1']) + expect(viaFallback.filteredOut).toBe(1) + }) + + it('reports a key missing from intact output as not found, not withheld', async () => { + const report = await logsQueryPartlyWithheld({ field: 'output.route' }) + expect(report.rows[1]).toMatchObject({ + runId: 'run-2', + value: null, + note: 'path not found on span', + }) + expect(report.contentWithheld).toBeUndefined() + }) + + it('reports a path through an omitted field as withheld', async () => { + const thinking = await logsQueryPartlyWithheld({ field: 'thinking' }) + expect(thinking.rows[0].note).toMatch(/value unknown/) + expect(thinking.contentWithheld).toBe(2) + + const shadowed = await logsQueryPartlyWithheld({ field: 'thinking', where: 'route=priority' }) + expect(shadowed.rows[0]).toMatchObject({ runId: 'run-1', value: null }) + expect(shadowed.rows[0].note).toMatch(/value unknown/) + expect(shadowed.fieldResolvedUnder).toBeUndefined() + + const toolInput = await logsQueryPartlyWithheld({ field: 'toolCalls.0.input.query' }) + expect(toolInput.rows[1].note).toMatch(/value unknown/) + const toolMissing = await logsQueryPartlyWithheld({ field: 'toolCalls.3.input.query' }) + expect(toolMissing.rows[1].note).toBe('path not found on span') + }) +}) + const DEPS_STATE = { blocks: { 'trigger-1': { type: 'starter', name: 'Start' }, diff --git a/apps/sim/lib/mothership/agent-cli/engines/query.ts b/apps/sim/lib/mothership/agent-cli/engines/query.ts index 31958a7f402..724d73431ad 100644 --- a/apps/sim/lib/mothership/agent-cli/engines/query.ts +++ b/apps/sim/lib/mothership/agent-cli/engines/query.ts @@ -1,3 +1,4 @@ +import { mapWithConcurrency } from '@/lib/core/utils/concurrency' import { type AgentCliEngine, type AgentCliFlags, @@ -22,6 +23,34 @@ const MAX_LIMIT = 50 const TRACE_FETCH_CONCURRENCY = 5 const VALUE_MAX_CHARS = 600 const PATH_NOT_FOUND_NOTE = 'path not found on span' +/** + * The log projection withheld the content field this path reads through rather than + * return what it could not prove safe to display, so the value says nothing about the run. + */ +const CONTENT_WITHHELD_NOTE = 'span content withheld by the log projection; value unknown' +const WHERE_WITHHELD_NOTE = + 'span content withheld by the log projection; --where could not be checked, run kept but not a confirmed match' + +/** + * Where the log projection can omit content on a span. It omits a content field whole + * (never a key inside one), so a path is withheld only when it runs through one of these + * fields and the field itself is absent on a span carrying `contentWithheld`; a present + * field missing a nested key is a genuine miss. `#` matches an array index. + */ +const WITHHELD_CONTENT_PATHS: ReadonlyArray = [ + ['input'], + ['output'], + ['thinking'], + ['errorMessage'], + ['toolCalls', '#', 'input'], + ['toolCalls', '#', 'output'], + ['toolCalls', '#', 'error'], + ['modelToolCalls', '#', 'arguments'], + ['providerTiming', 'segments', '#', 'assistantContent'], + ['providerTiming', 'segments', '#', 'thinkingContent'], + ['providerTiming', 'segments', '#', 'errorMessage'], + ['providerTiming', 'segments', '#', 'toolCalls', '#', 'arguments'], +] /** * Keys that live on the span itself. A path whose head is anything else is read @@ -55,6 +84,7 @@ interface QueryTraceSpan { duration?: number input?: Record output?: Record + contentWithheld?: true children?: QueryTraceSpan[] } @@ -71,6 +101,8 @@ interface ResolvedSpanPath { /** The path that produced `value`: as given, or prefixed when the fallback applied. */ path: string resolvedUnder?: 'output' + /** Unresolved because the projection withheld the content field the path reads through. */ + withheld?: true } function collectSpansByName( @@ -93,16 +125,47 @@ function resolveSpanPath(span: QueryTraceSpan, path: string): unknown { return current } -/** The path as given first; under `output.` when the head is not a span-level key. */ +function isWithheldContentPrefix(segments: readonly string[]): boolean { + return WITHHELD_CONTENT_PATHS.some( + (pattern) => + pattern.length === segments.length && + pattern.every((part, index) => + part === '#' ? /^\d+$/.test(segments[index] ?? '') : part === segments[index] + ) + ) +} + +/** Whether an unresolved path stopped at a content field the projection omitted. */ +function isWithheldPath(span: QueryTraceSpan, path: string): boolean { + if (span.contentWithheld !== true) return false + const segments = path.split('.') + let current: unknown = span + for (let index = 0; index < segments.length; index++) { + if (current == null || typeof current !== 'object') return false + const next = (current as Record)[segments[index] ?? ''] + if (next === undefined) return isWithheldContentPrefix(segments.slice(0, index + 1)) + current = next + } + return false +} + +/** + * The path as given first; under `output.` when the head is not a span-level key. A + * direct path through a withheld content field (`thinking`) stays unknown rather than + * falling back to a same-named key under output. + */ function resolveSpanPathWithFallback(span: QueryTraceSpan, path: string): ResolvedSpanPath { const direct = resolveSpanPath(span, path) if (direct !== undefined) return { value: direct, path } + if (isWithheldPath(span, path)) return { value: undefined, path, withheld: true } const head = path.split('.')[0] ?? '' if (SPAN_LEVEL_KEYS.has(head)) return { value: undefined, path } const underOutput = `output.${path}` const value = resolveSpanPath(span, underOutput) - if (value === undefined) return { value: undefined, path } - return { value, path: underOutput, resolvedUnder: 'output' } + if (value !== undefined) return { value, path: underOutput, resolvedUnder: 'output' } + return isWithheldPath(span, underOutput) + ? { value: undefined, path, withheld: true } + : { value: undefined, path } } function clipValue(value: unknown): unknown { @@ -125,7 +188,10 @@ export const logsQueryCommand: AgentCliEngine = { return agentCliFail( 'Usage: sim logs query --block [--field ] [--where =] [--status ] [--trigger ] [--limit N]\n' + 'Paths resolve inside the matched block span: output.content, input.action_id, status, duration. ' + - 'A path that names no span-level key is read under output. (result.count means output.result.count).' + 'A path that names no span-level key is read under output. (result.count means output.result.count).\n' + + 'When the log projection withheld a content field (input, output, thinking, errorMessage, tool-call or provider-segment content), ' + + 'a path through it reports "value unknown" and, under --where, the run is kept with whereUnchecked: true (counted in whereUnchecked, not a confirmed match). ' + + 'A path missing inside a field that is present is "path not found" and fails --where.' ) } const field = stringFlag(flags, 'field') ?? 'output' @@ -155,64 +221,81 @@ export const logsQueryCommand: AgentCliEngine = { const runItems = runs.data ?? [] const normalizedBlockName = normalizeName(blockName) - const rows: (Record | undefined)[] = new Array(runItems.length) let filteredOut = 0 let missingTrace = 0 + let contentWithheld = 0 + let whereUnchecked = 0 let fieldResolvedUnder: 'output' | undefined let whereResolvedUnder: 'output' | undefined - for (let start = 0; start < runItems.length; start += TRACE_FETCH_CONCURRENCY) { - const chunk = runItems.slice(start, start + TRACE_FETCH_CONCURRENCY) - await Promise.all( - chunk.map(async (run, offset) => { - const base = { - runId: run.runId, - startedAt: run.startedAt, - runStatus: run.status, - } - let spans: QueryTraceSpan[] - try { - const trace = await runtime.client.request<{ - data: { traceSpans?: QueryTraceSpan[] } - }>(`/api/v2/logs/${encodeURIComponent(run.runId)}`) - spans = trace.data.traceSpans ?? [] - } catch { - missingTrace++ - rows[start + offset] = { ...base, note: 'trace unavailable' } - return - } - const matches: QueryTraceSpan[] = [] - collectSpansByName(spans, normalizedBlockName, matches) - const last = matches[matches.length - 1] - if (!last) { - // Under --where a run the block never reached cannot match; returning it as - // `hits: 0` made matches indistinguishable from padding. - if (wherePath) { - filteredOut++ - return - } - rows[start + offset] = { ...base, hits: 0, value: null } - return - } + const rows = await mapWithConcurrency( + runItems, + TRACE_FETCH_CONCURRENCY, + async (run): Promise | undefined> => { + const base = { + runId: run.runId, + startedAt: run.startedAt, + runStatus: run.status, + } + let spans: QueryTraceSpan[] + try { + const trace = await runtime.client.request<{ + data: { traceSpans?: QueryTraceSpan[] } + }>(`/api/v2/logs/${encodeURIComponent(run.runId)}`, { + query: { includeWorkflowState: 'false' }, + }) + spans = trace.data.traceSpans ?? [] + } catch { + missingTrace++ + return { ...base, note: 'trace unavailable' } + } + const matches: QueryTraceSpan[] = [] + collectSpansByName(spans, normalizedBlockName, matches) + const last = matches[matches.length - 1] + if (!last) { + // Under --where a run the block never reached cannot match; returning it as + // `hits: 0` made matches indistinguishable from padding. if (wherePath) { - const matched = resolveSpanPathWithFallback(last, wherePath) - if (matched.resolvedUnder) whereResolvedUnder = matched.resolvedUnder - if (String(matched.value) !== whereValue) { - filteredOut++ - return - } + filteredOut++ + return undefined } - const resolved = resolveSpanPathWithFallback(last, field) - if (resolved.resolvedUnder) fieldResolvedUnder = resolved.resolvedUnder - rows[start + offset] = { - ...base, - hits: matches.length, - blockStatus: last.status ?? 'success', - value: clipValue(resolved.value), - ...(resolved.value === undefined ? { note: PATH_NOT_FOUND_NOTE } : {}), + return { ...base, hits: 0, value: null } + } + const matchedRow = { + ...base, + hits: matches.length, + blockStatus: last.status ?? 'success', + } + let whereWithheld = false + if (wherePath) { + const matched = resolveSpanPathWithFallback(last, wherePath) + if (matched.resolvedUnder) whereResolvedUnder = matched.resolvedUnder + // Filtering on a withheld value would silently drop a run that may well match. + whereWithheld = matched.withheld === true + if (!whereWithheld && String(matched.value) !== whereValue) { + filteredOut++ + return undefined } - }) - ) - } + } + const resolved = resolveSpanPathWithFallback(last, field) + if (resolved.resolvedUnder) fieldResolvedUnder = resolved.resolvedUnder + const fieldWithheld = resolved.withheld === true + if (fieldWithheld) contentWithheld++ + if (whereWithheld) whereUnchecked++ + const note = fieldWithheld + ? CONTENT_WITHHELD_NOTE + : resolved.value === undefined + ? PATH_NOT_FOUND_NOTE + : whereWithheld + ? WHERE_WITHHELD_NOTE + : undefined + return { + ...matchedRow, + value: clipValue(resolved.value), + ...(note ? { note } : {}), + ...(whereWithheld ? { whereUnchecked: true } : {}), + } + } + ) const kept = rows.filter((row): row is Record => row !== undefined) return agentCliOk( @@ -228,9 +311,11 @@ export const logsQueryCommand: AgentCliEngine = { where: whereResolvedUnder ? `output.${where}` : where, ...(whereResolvedUnder ? { whereResolvedUnder } : {}), filteredOut, + ...(whereUnchecked ? { whereUnchecked } : {}), } : {}), ...(missingTrace ? { missingTrace } : {}), + ...(contentWithheld ? { contentWithheld } : {}), rows: kept, }, null, diff --git a/apps/sim/lib/mothership/generated/docs-manifest.ts b/apps/sim/lib/mothership/generated/docs-manifest.ts index 4d0f45680da..cab203ffdb4 100644 --- a/apps/sim/lib/mothership/generated/docs-manifest.ts +++ b/apps/sim/lib/mothership/generated/docs-manifest.ts @@ -138,6 +138,7 @@ export const DOCS_MANIFEST: readonly string[] = [ 'integrations/duckduckgo.mdx', 'integrations/dynamodb.mdx', 'integrations/dynatrace.mdx', + 'integrations/ec2.mdx', 'integrations/elasticsearch.mdx', 'integrations/elevenlabs.mdx', 'integrations/emailbison.mdx', diff --git a/apps/sim/lib/mothership/tools/cli-tool-display.ts b/apps/sim/lib/mothership/tools/cli-tool-display.ts index 4b7aca0c4e7..d7d50fcaca6 100644 --- a/apps/sim/lib/mothership/tools/cli-tool-display.ts +++ b/apps/sim/lib/mothership/tools/cli-tool-display.ts @@ -78,6 +78,9 @@ export const CLI_TOOL_TITLES: Record = { cli_knowledge_folders_move: 'Moving knowledge folder', cli_knowledge_from_workspace_files_create: 'Creating knowledge base', cli_knowledge_get: 'Reading knowledge base', + cli_knowledge_import: 'Importing knowledge base', + cli_knowledge_imports_cancel: 'Cancelling knowledge base import', + cli_knowledge_imports_get: 'Reading knowledge base import', cli_knowledge_list: 'Listing knowledge bases', cli_knowledge_ls: 'Listing knowledge bases', cli_knowledge_mkdir: 'Creating knowledge base', diff --git a/apps/sim/lib/mothership/tools/client/computer-tool-unload.test.ts b/apps/sim/lib/mothership/tools/client/computer-tool-unload.test.ts index cf2c384afb6..5cee9bef2e0 100644 --- a/apps/sim/lib/mothership/tools/client/computer-tool-unload.test.ts +++ b/apps/sim/lib/mothership/tools/client/computer-tool-unload.test.ts @@ -8,6 +8,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { copilotConfirmBodySchema } from '@/lib/api/contracts/copilot' import { executeComputerToolOnClient } from '@/lib/mothership/tools/client/computer-tool-execution' import { clearUserData } from '@/stores' +import '@/stores/reset-all-stores' const native = vi.hoisted(() => ({ execute: vi.fn(), cancel: vi.fn() })) vi.mock('@/lib/computer-use/transport', () => ({ diff --git a/apps/sim/lib/projects/files/__integration__/documents.integration.ts b/apps/sim/lib/projects/files/__integration__/documents.integration.ts index 5bcfc09569d..e2336442def 100644 --- a/apps/sim/lib/projects/files/__integration__/documents.integration.ts +++ b/apps/sim/lib/projects/files/__integration__/documents.integration.ts @@ -137,14 +137,15 @@ async function fixture(permissionType: 'read' | 'write' = 'write') { }, }) const target = { projectId: ids.projectId, fileId: created.file.id } + const issuedAt = new Date() const principal: ResourceDelegatedPrincipal = { kind: 'resource_delegated', serviceId: 'realtime', subjectUserId: editorId, audience: 'sim:project-files', delegationId: generateId(), - issuedAt: new Date(), - expiresAt: new Date(Date.now() + 60_000), + issuedAt, + expiresAt: new Date(issuedAt.getTime() + 60_000), scope: { kind: 'entity', entityType: 'project', diff --git a/apps/sim/lib/table/backfill-runner.ts b/apps/sim/lib/table/backfill-runner.ts index 0ddd65d8e09..ad93dc810f7 100644 --- a/apps/sim/lib/table/backfill-runner.ts +++ b/apps/sim/lib/table/backfill-runner.ts @@ -5,8 +5,7 @@ import { getErrorMessage } from '@sim/utils/errors' import { generateId } from '@sim/utils/id' import { getValueAtPath, isRecordLike } from '@sim/utils/object' import { and, asc, count, eq, gt, inArray } from 'drizzle-orm' -import { isTriggerDevEnabled } from '@/lib/core/config/env-flags' -import { runDetached } from '@/lib/core/utils/background' +import { dispatchBackgroundTask } from '@/lib/core/async-jobs/background-task' import { MATERIALIZE_CONCURRENCY, mapWithConcurrency } from '@/lib/core/utils/concurrency' import { type FunctionalExecutionDataSource, @@ -29,6 +28,7 @@ import type { TableDefinition, WorkflowGroupOutput, } from '@/lib/table/types' +import type { tableBackfillTask } from '@/background/table-backfill' import { isResolvedSecretTraceProvenanceV1, RESOLVED_SECRET_TRACE_CHECKPOINT_VERSION, @@ -421,29 +421,20 @@ export async function maybeBackfillGroupOutputs(opts: { actorUserId, capabilityGovernedUserId, } - if (isTriggerDevEnabled) { - try { - const [{ tableBackfillTask }, { tasks }, { resolveTriggerRegion }] = await Promise.all([ - import('@/background/table-backfill'), - import('@trigger.dev/sdk'), - import('@/lib/core/async-jobs/region'), - ]) - await tasks.trigger('table-backfill', payload, { - tags: [`tableId:${table.id}`, `jobId:${jobId}`], - region: await resolveTriggerRegion(), - }) - } catch (error) { - // Release the claim so a ghost `running` job doesn't block imports/deletes. - // Swallowed (warn only): a failed backfill never fails the schema change — - // the data stays backfillable. - const { releaseJobClaim } = await import('@/lib/table/jobs/service') - await releaseJobClaim(table.id, jobId).catch(() => {}) - logger.warn( - `[${requestId}] Backfill dispatch failed for table ${table.id} group ${groupId}; skipping`, - { error: getErrorMessage(error) } - ) - } - } else { - runDetached('table-backfill', () => runTableBackfill(payload)) + try { + await dispatchBackgroundTask('table-backfill', payload, { + runInProcess: runTableBackfill, + trigger: { tags: [`tableId:${table.id}`, `jobId:${jobId}`] }, + }) + } catch (error) { + // Release the claim so a ghost `running` job doesn't block imports/deletes. + // Swallowed (warn only): a failed backfill never fails the schema change — + // the data stays backfillable. + const { releaseJobClaim } = await import('@/lib/table/jobs/service') + await releaseJobClaim(table.id, jobId).catch(() => {}) + logger.warn( + `[${requestId}] Backfill dispatch failed for table ${table.id} group ${groupId}; skipping`, + { error: getErrorMessage(error) } + ) } } diff --git a/apps/sim/lib/table/orchestration/export-resource.ts b/apps/sim/lib/table/orchestration/export-resource.ts index 6f8410d5c1a..928f09f2135 100644 --- a/apps/sim/lib/table/orchestration/export-resource.ts +++ b/apps/sim/lib/table/orchestration/export-resource.ts @@ -4,13 +4,13 @@ import { getErrorMessage } from '@sim/utils/errors' import { generateId } from '@sim/utils/id' import { and, eq } from 'drizzle-orm' import type { V2TableExport, V2TableExportStatus } from '@/lib/api/contracts/v2/tables' -import { isTriggerDevEnabled } from '@/lib/core/config/env-flags' +import { dispatchBackgroundTask } from '@/lib/core/async-jobs/background-task' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { runDetached } from '@/lib/core/utils/background' import { TABLE_LIMITS } from '@/lib/table/constants' import { runTableExport, type TableExportPayload } from '@/lib/table/export-runner' import { markTableJobRunningInWorkspace } from '@/lib/table/jobs/service' import type { TableDefinition, TableExportJobPayload } from '@/lib/table/types' +import type { tableExportTask } from '@/background/table-export' export type TableExportRecord = typeof tableJobs.$inferSelect @@ -42,19 +42,10 @@ export async function createTableExportResource(params: { await runTableExport(runnerPayload) } else { try { - if (isTriggerDevEnabled) { - const [{ tableExportTask }, { tasks }, { resolveTriggerRegion }] = await Promise.all([ - import('@/background/table-export'), - import('@trigger.dev/sdk'), - import('@/lib/core/async-jobs/region'), - ]) - await tasks.trigger('table-export', runnerPayload, { - tags: [`tableId:${params.table.id}`, `jobId:${exportId}`], - region: await resolveTriggerRegion(), - }) - } else { - runDetached('table-export', () => runTableExport(runnerPayload)) - } + await dispatchBackgroundTask('table-export', runnerPayload, { + runInProcess: runTableExport, + trigger: { tags: [`tableId:${params.table.id}`, `jobId:${exportId}`] }, + }) } catch (error) { await markExportFailed({ tableId: params.table.id, diff --git a/apps/sim/lib/table/orchestration/import-resource.ts b/apps/sim/lib/table/orchestration/import-resource.ts index ac7468efb7a..d01e427d7d8 100644 --- a/apps/sim/lib/table/orchestration/import-resource.ts +++ b/apps/sim/lib/table/orchestration/import-resource.ts @@ -17,9 +17,8 @@ import { v2TableImportSourceSchema, v2TableImportTargetSchema, } from '@/lib/api/contracts/v2/tables' -import { isTriggerDevEnabled } from '@/lib/core/config/env-flags' +import { dispatchBackgroundTask } from '@/lib/core/async-jobs/background-task' import { OrchestrationError } from '@/lib/core/orchestration/types' -import { runDetached } from '@/lib/core/utils/background' import { generateRequestId } from '@/lib/core/utils/request' import { findActiveFolder } from '@/lib/folders/queries' import { getWorkspaceTableLimits } from '@/lib/table/billing' @@ -43,9 +42,11 @@ import { type CreatedUploadSession, createUploadSession, getOwnedUploadSession, + importStatusForUploadSession, type UploadSessionRecord, } from '@/lib/uploads/upload-session/service' import { getUserSettings } from '@/lib/users/queries' +import type { tableImportTask } from '@/background/table-import' const logger = createLogger('TableImportResource') @@ -411,19 +412,10 @@ async function startTableImport(params: StartTableImportParams): Promise('table-import', payload, { - tags: [`tableId:${tableId}`, `jobId:${params.id}`], - region: await resolveTriggerRegion(), - }) - } else { - runDetached('table-import', () => runTableImport(payload)) - } + await dispatchBackgroundTask('table-import', payload, { + runInProcess: runTableImport, + trigger: { tags: [`tableId:${tableId}`, `jobId:${params.id}`] }, + }) return getTableImportResource({ importId: params.id, assertedWorkspaceId: params.workspaceId, @@ -477,7 +469,7 @@ function resourceFromUpload( target: body.target, options: importOptions(body), tableId: body.target.type === 'existing' ? body.target.tableId : null, - status: uploadStatus(upload), + status: importStatusForUploadSession(upload.status), rowsProcessed: 0, rowsRejected: 0, cellsRejected: 0, @@ -650,23 +642,6 @@ async function requireWorkspaceSource( return resolved } -function uploadStatus(upload: UploadSessionRecord): TableImportStatus { - switch (upload.status) { - case 'uploading': - case 'completing': - case 'finalizing': - case 'completed': - return 'uploading' - case 'aborting': - case 'aborted': - return 'canceled' - case 'failed': - return 'failed' - case 'expired': - return 'expired' - } -} - async function markImportFailed(params: { tableId: string workspaceId: string diff --git a/apps/sim/lib/table/orchestration/import.test.ts b/apps/sim/lib/table/orchestration/import.test.ts index 928c9af7e44..56a17ee9113 100644 --- a/apps/sim/lib/table/orchestration/import.test.ts +++ b/apps/sim/lib/table/orchestration/import.test.ts @@ -161,6 +161,50 @@ describe('performTableCsvImport', () => { expect(mockImportAppendRows).not.toHaveBeenCalled() }) + it('reports the row limit for an over-limit file before contending for the job slot', async () => { + mockMarkTableJobRunning.mockResolvedValue(false) + mockGetMaxRowsPerTable.mockResolvedValue(11) + const threeRows = `${CSV}g@h.i,Gus\n` + + const append = await performTableCsvImport(importParams()) + const replaceWithinLimit = await performTableCsvImport( + importParams({ mode: 'replace', fileStream: csvStream(threeRows) }) + ) + mockGetMaxRowsPerTable.mockResolvedValue(2) + const replaceOverLimit = await performTableCsvImport( + importParams({ mode: 'replace', fileStream: csvStream(threeRows) }) + ) + + expect(append).toMatchObject({ success: false, errorCode: 'validation' }) + expect(append.error).toContain('Append would exceed table row limit') + expect(replaceWithinLimit).toMatchObject({ success: false, errorCode: 'conflict' }) + expect(replaceOverLimit).toMatchObject({ success: false, errorCode: 'validation' }) + expect(replaceOverLimit.error).toContain('Replace would exceed table row limit (2)') + }) + + it('lets timers run while coercing a large file instead of holding the event loop', async () => { + const rowCount = 50_000 + const lines = ['email,name'] + for (let i = 0; i < rowCount; i++) lines.push(`user${i}@example.com,Name ${i}`) + let timerFired = false + let timerFiredBeforeWrite = false + mockGetMaxRowsPerTable.mockResolvedValue(-1) + mockImportAppendRows.mockImplementation(async () => { + timerFiredBeforeWrite = timerFired + return { inserted: [], table: TABLE } + }) + + setTimeout(() => { + timerFired = true + }, 0) + const result = await performTableCsvImport( + importParams({ fileStream: csvStream(`${lines.join('\n')}\n`) }) + ) + + expect(result.success).toBe(true) + expect(timerFiredBeforeWrite).toBe(true) + }) + it('rejects an archived table and a table with a job already running', async () => { const archived = await performTableCsvImport( importParams({ table: { ...TABLE, archivedAt: new Date() } }) diff --git a/apps/sim/lib/table/orchestration/import.ts b/apps/sim/lib/table/orchestration/import.ts index 5b2dc97549b..badac316e35 100644 --- a/apps/sim/lib/table/orchestration/import.ts +++ b/apps/sim/lib/table/orchestration/import.ts @@ -1,4 +1,5 @@ import type { Readable } from 'node:stream' +import { setImmediate as yieldToEventLoop } from 'node:timers/promises' import { createLogger } from '@sim/logger' import { toError } from '@sim/utils/errors' import { generateId } from '@sim/utils/id' @@ -267,6 +268,27 @@ export interface PerformTableCsvImportResult { data?: TableCsvImportData } +/** Rows coerced between event-loop yields; one slice of a wide sheet stays in single-digit ms. */ +const COERCE_SLICE_ROWS = 2_000 + +/** + * {@link coerceRowsForTable} over a whole synchronous-import file, yielding between + * slices. One `rows.map` over a 25 MB file holds the event loop for up to a second, + * stalling every other request the process is serving. + */ +async function coerceRowsInSlices( + ...[rows, ...rest]: Parameters +): Promise> { + const coerced: ReturnType = [] + for (let start = 0; start < rows.length; start += COERCE_SLICE_ROWS) { + if (start > 0) await yieldToEventLoop() + for (const row of coerceRowsForTable(rows.slice(start, start + COERCE_SLICE_ROWS), ...rest)) { + coerced.push(row) + } + } + return coerced +} + /** * Imports a CSV into an EXISTING table, appending or replacing its rows. * @@ -335,8 +357,20 @@ export async function performTableCsvImport( ) } + const maxRows = await getMaxRowsPerTable(workspaceId) + const currentRowCount = mode === 'append' ? table.rowCount : 0 + if (wouldExceedRowLimit(maxRows, currentRowCount, rows.length)) { + const deficit = currentRowCount + rows.length - maxRows + return fail( + mode === 'append' + ? `Append would exceed table row limit (${maxRows}). Currently ${table.rowCount} rows, ${rows.length} new rows, ${deficit} over.` + : `Replace would exceed table row limit (${maxRows}). The file has ${rows.length} rows, ${deficit} over.`, + 'validation' + ) + } + let cellsRejected = 0 - const coerced = coerceRowsForTable( + const coerced = await coerceRowsInSlices( rows, prospectiveSchema, validation.effectiveMap, @@ -371,15 +405,6 @@ export async function performTableCsvImport( try { if (mode === 'append') { - const maxRows = await getMaxRowsPerTable(workspaceId) - if (wouldExceedRowLimit(maxRows, table.rowCount, coerced.length)) { - const deficit = table.rowCount + coerced.length - maxRows - return fail( - `Append would exceed table row limit (${maxRows}). Currently ${table.rowCount} rows, ${coerced.length} new rows, ${deficit} over.`, - 'validation' - ) - } - const { inserted, table: finalTable } = await importAppendRows(table, additions, coerced, { workspaceId, userId, diff --git a/apps/sim/lib/uploads/config.ts b/apps/sim/lib/uploads/config.ts index c2f01f76033..e1f5e8b2c1d 100644 --- a/apps/sim/lib/uploads/config.ts +++ b/apps/sim/lib/uploads/config.ts @@ -224,6 +224,7 @@ function getS3Config(context: StorageContext): StorageConfig { case 'test': case 'changelog': case 'table-import': + case 'knowledge-import': case 'organization-logos': return { bucket: S3_CONFIG.bucket, @@ -291,6 +292,7 @@ function getBlobConfig(context: StorageContext): StorageConfig { case 'test': case 'changelog': case 'table-import': + case 'knowledge-import': case 'organization-logos': return { accountName: BLOB_CONFIG.accountName, @@ -355,6 +357,7 @@ function getGcsConfig(context: StorageContext): StorageConfig { case 'test': case 'changelog': case 'table-import': + case 'knowledge-import': case 'organization-logos': return { bucket: GCS_CONFIG.bucket } case 'profile-pictures': diff --git a/apps/sim/lib/uploads/shared/types.ts b/apps/sim/lib/uploads/shared/types.ts index 02502593d30..097718ffccd 100644 --- a/apps/sim/lib/uploads/shared/types.ts +++ b/apps/sim/lib/uploads/shared/types.ts @@ -73,6 +73,7 @@ export type StorageContext = | 'test' | 'changelog' | 'table-import' + | 'knowledge-import' | 'profile-pictures' | 'og-images' | 'logs' diff --git a/apps/sim/lib/uploads/upload-session/service.test.ts b/apps/sim/lib/uploads/upload-session/service.test.ts index 1420925a282..eb09c6594a1 100644 --- a/apps/sim/lib/uploads/upload-session/service.test.ts +++ b/apps/sim/lib/uploads/upload-session/service.test.ts @@ -334,6 +334,7 @@ describe('upload sessions', () => { it.each([ ['knowledge_document', { knowledgeBaseId: 'kb-1' }], ['table_import', {}], + ['knowledge_import', {}], ['profile_picture', {}], ['workspace_logo', {}], ['execution_attachment', { workflowId: 'workflow-1', executionId: 'execution-1' }], @@ -560,6 +561,7 @@ describe('upload sessions', () => { it.each([ ['workspace_file', 'sim:workspace-files'], ['knowledge_document', 'sim:knowledge'], + ['knowledge_import', 'sim:knowledge'], ['table_import', 'sim:tables'], ] as const)( 'binds %s Copilot uploads to the actual subject/chat/workspace across refreshed calls', diff --git a/apps/sim/lib/uploads/upload-session/service.ts b/apps/sim/lib/uploads/upload-session/service.ts index cdc758c58a7..ad73dc99b32 100644 --- a/apps/sim/lib/uploads/upload-session/service.ts +++ b/apps/sim/lib/uploads/upload-session/service.ts @@ -226,6 +226,7 @@ export type CreateUploadSessionParams = CreateUploadSessionBaseParams & secretProvenance?: WorkspaceFileUploadSource } | { purpose: 'table_import'; workspaceId: string; principal?: Principal } + | { purpose: 'knowledge_import'; workspaceId: string; principal: Principal } | { purpose: 'knowledge_document' workspaceId: string @@ -408,7 +409,11 @@ export async function createUploadSession( ) } } - if (params.purpose === 'workspace_file' || params.purpose === 'knowledge_document') { + if ( + params.purpose === 'workspace_file' || + params.purpose === 'knowledge_document' || + params.purpose === 'knowledge_import' + ) { if (!workspaceId) throw new Error(`${params.purpose} upload is missing workspaceId`) if (!params.principal) { throw new Error(`${params.purpose} upload requires an authenticated principal`) @@ -750,7 +755,9 @@ export function assertUploadSessionAuthBinding( if (!isPrincipalBoundUploadPurpose(session.purpose)) return const candidate = session.metadata.authBinding if (candidate === undefined) { - if (session.purpose === 'table_import') throw uploadNotFound() + if (session.purpose === 'table_import' || session.purpose === 'knowledge_import') { + throw uploadNotFound() + } assertLegacyUploadSessionOwner(session, principal) return } @@ -1278,6 +1285,29 @@ export function expectedUploadPartSize(session: UploadSessionRecord, partNumber: return session.fileSize - session.partSize * (session.partCount - 1) } +/** + * How an import resource built on an upload session reads while it is still + * that session: everything short of a settled outcome is still `uploading`. + */ +export function importStatusForUploadSession( + status: UploadSessionStatus +): 'uploading' | 'canceled' | 'failed' | 'expired' { + switch (status) { + case 'uploading': + case 'completing': + case 'finalizing': + case 'completed': + return 'uploading' + case 'aborting': + case 'aborted': + return 'canceled' + case 'failed': + return 'failed' + case 'expired': + return 'expired' + } +} + export function uploadSessionObjectMetadata( session: Pick< UploadSessionRecord, @@ -1582,7 +1612,7 @@ function requiresStorageQuota(purpose: UploadSessionPurpose): boolean { function copilotUploadAudience(purpose: UploadSessionPurpose): string | undefined { if (purpose === 'workspace_file') return WORKSPACE_FILES_DELEGATION_AUDIENCE - if (purpose === 'knowledge_document') return 'sim:knowledge' + if (purpose === 'knowledge_document' || purpose === 'knowledge_import') return 'sim:knowledge' if (purpose === 'table_import') return 'sim:tables' return undefined } @@ -1593,6 +1623,7 @@ function isPrincipalBoundUploadPurpose(purpose: UploadSessionPurpose): boolean { purpose === 'project_file' || purpose === 'knowledge_document' || purpose === 'table_import' || + purpose === 'knowledge_import' || purpose === 'mothership_attachment' || purpose === 'organization_logo' ) @@ -1618,6 +1649,11 @@ function resolveUploadStorage( storageContext: 'table-import', finalKey: `table-import/${params.workspaceId}/${id}/${buildStorageKeySegment('', params.fileName)}`, } + case 'knowledge_import': + return { + storageContext: 'knowledge-import', + finalKey: `knowledge-import/${params.workspaceId}/${id}/${buildStorageKeySegment('', params.fileName)}`, + } case 'knowledge_document': return { storageContext: 'knowledge-base', @@ -1669,6 +1705,7 @@ function isStorageContext(value: string): value is StorageContext { 'workspace', 'project', 'table-import', + 'knowledge-import', 'knowledge-base', 'profile-pictures', 'workspace-logos', diff --git a/apps/sim/lib/uploads/upload-session/types.ts b/apps/sim/lib/uploads/upload-session/types.ts index 24e823d3c90..0c7404fb464 100644 --- a/apps/sim/lib/uploads/upload-session/types.ts +++ b/apps/sim/lib/uploads/upload-session/types.ts @@ -5,6 +5,7 @@ export type UploadSessionPurpose = | 'workspace_file' | 'project_file' | 'table_import' + | 'knowledge_import' | 'knowledge_document' | 'profile_picture' | 'workspace_logo' diff --git a/apps/sim/lib/users/storage-sweep.test.ts b/apps/sim/lib/users/storage-sweep.test.ts index 7d25cc24c89..b8bca298f88 100644 --- a/apps/sim/lib/users/storage-sweep.test.ts +++ b/apps/sim/lib/users/storage-sweep.test.ts @@ -122,6 +122,7 @@ const DOOMED_KEYS = [ 'table-snapshots/wsdoomed1/table-1/v1-hash.csv', 'copilot-doc-compiled/wsdoomed1/hash.pdf', 'workspace-logos/wsdoomed1/logo.png', + 'knowledge-import/wsdoomed1/import-1/bundle.simkb.zip', ] const NEIGHBOR_KEYS = [ diff --git a/apps/sim/lib/users/storage-sweep.ts b/apps/sim/lib/users/storage-sweep.ts index 04b57f8aa80..650a4bbc52a 100644 --- a/apps/sim/lib/users/storage-sweep.ts +++ b/apps/sim/lib/users/storage-sweep.ts @@ -82,6 +82,7 @@ const OBJECT_CONTEXTS: ReadonlySet = new Set([ 'knowledge-base', 'execution', 'table-import', + 'knowledge-import', 'workspace-logos', ]) diff --git a/apps/sim/lib/users/workspace-storage.ts b/apps/sim/lib/users/workspace-storage.ts index 0c4d54c2af2..76d776c30fd 100644 --- a/apps/sim/lib/users/workspace-storage.ts +++ b/apps/sim/lib/users/workspace-storage.ts @@ -18,6 +18,7 @@ export const WORKSPACE_STORAGE_FAMILIES = [ { root: 'table-snapshots', context: 'execution' }, { root: 'copilot-doc-compiled', context: 'copilot' }, { root: 'workspace-logos', context: 'workspace-logos' }, + { root: 'knowledge-import', context: 'knowledge-import' }, ] as const satisfies readonly { root: string; context: StorageContext }[] const WORKSPACE_KEYED_ROOTS: ReadonlySet = new Set( diff --git a/apps/sim/lib/workflows/executor/execution-status.test.ts b/apps/sim/lib/workflows/executor/execution-status.test.ts index 30eaee80adf..f69cd41431a 100644 --- a/apps/sim/lib/workflows/executor/execution-status.test.ts +++ b/apps/sim/lib/workflows/executor/execution-status.test.ts @@ -1,4 +1,5 @@ import { dbChainMockFns, queueTableRows, resetDbChainMock, schemaMock } from '@sim/testing' +import { flushMacrotask } from '@sim/testing/helpers/async' import { asyncJobsMock, asyncJobsMockFns } from '@sim/testing/mocks/async-jobs.mock' import { traceStoreMock, traceStoreMockFns } from '@sim/testing/mocks/trace-store.mock' import { and } from 'drizzle-orm' @@ -12,6 +13,7 @@ vi.mock('@/lib/workflows/executor/paused-execution-metadata', () => ({ getAutomaticResumeWaitingMetadata: vi.fn().mockReturnValue(null), })) +import { FunctionalOutputsUnavailableError } from '@/lib/logs/execution/functional-outputs' import { getWorkflowExecutionStatus } from '@/lib/workflows/executor/execution-status' const mockGetJob = asyncJobsMockFns.mockJobQueue.getJob @@ -552,3 +554,108 @@ describe('getWorkflowExecutionStatus settled resume attempts', () => { expect(status).toMatchObject({ status: 'cancelled', level: 'info', error: null }) }) }) + +describe('getWorkflowExecutionStatus polls that read no execution data', () => { + const STALLED = Symbol('stalled') + + function queueLog(status: string, pausedRows: unknown[] = []) { + queueTableRows(schemaMock.workflowExecutionLogs, [ + { + executionId: 'execution-1', + workflowId: 'workflow-1', + workspaceId: 'workspace-1', + status, + level: 'info', + trigger: 'api', + startedAt: new Date('2026-08-05T12:00:00.000Z'), + endedAt: new Date('2026-08-05T12:00:01.000Z'), + totalDurationMs: 1000, + executionData: { finalOutput: { answer: 42 } }, + costTotal: '0.5', + }, + ]) + queueTableRows(schemaMock.resumeQueue, []) + queueTableRows(schemaMock.pausedExecutions, pausedRows) + } + + /** Stands in for an archive read that has not come back from object storage yet. */ + function stallArchiveRead() { + mockMaterializeForDisplayWithBlockOutputs.mockReturnValue(new Promise(() => {})) + } + + /** Settles with {@link STALLED} instead of hanging when the read waits on the archive. */ + function readOrStall(read: Parameters[0]) { + return Promise.race([getWorkflowExecutionStatus(read), flushMacrotask().then(() => STALLED)]) + } + + beforeEach(() => { + resetDbChainMock() + mockGetJob.mockResolvedValue(null) + }) + + it.each([ + ['a running run', 'running', input], + ['a cancelled run', 'cancelled', input], + ['a completed run polled without includeOutput', 'completed', input], + ['a running run asked for its output early', 'running', { ...input, includeOutput: true }], + ])('answers %s without waiting on the run archive', async (_, status, read) => { + queueLog(status) + stallArchiveRead() + + await expect(readOrStall(read)).resolves.toMatchObject({ + status, + cost: { total: 0.5 }, + error: null, + finalOutput: null, + blockOutputs: null, + }) + }) + + it('answers a paused run without waiting on the run archive', async () => { + queueLog('running', [ + { + id: 'paused-1', + status: 'paused', + pausePoints: [{ contextId: 'context-1', blockId: 'block-1', resumeStatus: 'paused' }], + metadata: {}, + resumedCount: 0, + pausedAt: new Date('2026-08-05T12:00:00.500Z'), + nextResumeAt: null, + }, + ]) + stallArchiveRead() + + await expect(readOrStall({ ...input, includeOutput: true })).resolves.toMatchObject({ + status: 'paused', + paused: { contextId: 'context-1' }, + finalOutput: null, + }) + }) + + it('still reads selected block outputs from a run that is still running', async () => { + queueLog('running') + mockMaterializeForDisplayWithBlockOutputs.mockResolvedValue({ + executionData: {}, + blockOutputs: new Map([['block-1', { content: 'partial' }]]), + }) + + await expect( + getWorkflowExecutionStatus({ ...input, selectedOutputs: ['block-1'] }) + ).resolves.toMatchObject({ + status: 'running', + finalOutput: null, + blockOutputs: { 'block-1': { content: 'partial' } }, + }) + }) + + it('still rejects selected outputs of a running run whose execution data was truncated', async () => { + queueLog('running') + mockMaterializeForDisplayWithBlockOutputs.mockRejectedValue( + new FunctionalOutputsUnavailableError() + ) + + await expect( + getWorkflowExecutionStatus({ ...input, selectedOutputs: ['block-1'] }) + ).rejects.toBeInstanceOf(FunctionalOutputsUnavailableError) + }) +}) diff --git a/apps/sim/lib/workflows/executor/execution-status.ts b/apps/sim/lib/workflows/executor/execution-status.ts index 22d7867cee5..d55ff02742a 100644 --- a/apps/sim/lib/workflows/executor/execution-status.ts +++ b/apps/sim/lib/workflows/executor/execution-status.ts @@ -430,6 +430,27 @@ async function readWorkflowExecutionStatus( const cost = logRow.costTotal != null ? { total: Number(logRow.costTotal) } : null + const resource = { + executionId: logRow.executionId, + // Column is `set null` on workflow delete; the caller's param is the fallback. + workflowId: logRow.workflowId ?? workflowId, + status, + trigger: logRow.trigger, + level: logRow.level, + startedAt: logRow.startedAt.toISOString(), + endedAt: logRow.endedAt?.toISOString() ?? null, + totalDurationMs: logRow.totalDurationMs ?? null, + paused, + cost, + } + + // Mirrors the three output conditions below; a poll needing none skips the archive read. + const readsExecutionData = + status === 'failed' || (includeOutput && status === 'completed') || selectedOutputs.length > 0 + if (!readsExecutionData) { + return { ...resource, error: null, finalOutput: null, blockOutputs: null } + } + const requestedBlockIds = [ ...new Set(selectedOutputs.map((selector) => selector.split('.')[0]).filter(Boolean)), ] @@ -456,20 +477,5 @@ async function readWorkflowExecutionStatus( ? pickSelectedOutputs(selectedOutputs, materialized.blockOutputs) : null - return { - executionId: logRow.executionId, - // Column is `set null` on workflow delete; the caller's param is the fallback. - workflowId: logRow.workflowId ?? workflowId, - status, - trigger: logRow.trigger, - level: logRow.level, - startedAt: logRow.startedAt.toISOString(), - endedAt: logRow.endedAt?.toISOString() ?? null, - totalDurationMs: logRow.totalDurationMs ?? null, - paused, - cost, - error, - finalOutput, - blockOutputs, - } + return { ...resource, error, finalOutput, blockOutputs } } diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index 87cda652d68..dfd78ed898a 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -163,6 +163,7 @@ const nextConfig: NextConfig = { */ '/*': [ './lib/execution/sandbox/bundles/*.cjs', + './dist/xlsx-worker.mjs', './node_modules/ws/**/*', '../../packages/sim-cli/dist/runtime.js', ], diff --git a/apps/sim/package.json b/apps/sim/package.json index 0b65be456bf..dcee870e274 100644 --- a/apps/sim/package.json +++ b/apps/sim/package.json @@ -17,8 +17,9 @@ "load:workflow:baseline": "BASE_URL=${BASE_URL:-http://localhost:3000} WARMUP_DURATION=${WARMUP_DURATION:-10} WARMUP_RATE=${WARMUP_RATE:-2} PEAK_RATE=${PEAK_RATE:-8} HOLD_DURATION=${HOLD_DURATION:-20} artillery run scripts/load/workflow-concurrency.yml", "load:workflow:waves": "BASE_URL=${BASE_URL:-http://localhost:3000} WAVE_ONE_DURATION=${WAVE_ONE_DURATION:-10} WAVE_ONE_RATE=${WAVE_ONE_RATE:-6} QUIET_DURATION=${QUIET_DURATION:-5} WAVE_TWO_DURATION=${WAVE_TWO_DURATION:-15} WAVE_TWO_RATE=${WAVE_TWO_RATE:-8} WAVE_THREE_DURATION=${WAVE_THREE_DURATION:-20} WAVE_THREE_RATE=${WAVE_THREE_RATE:-10} artillery run scripts/load/workflow-waves.yml", "load:workflow:isolation": "BASE_URL=${BASE_URL:-http://localhost:3000} ISOLATION_DURATION=${ISOLATION_DURATION:-30} TOTAL_RATE=${TOTAL_RATE:-9} WORKSPACE_A_WEIGHT=${WORKSPACE_A_WEIGHT:-8} WORKSPACE_B_WEIGHT=${WORKSPACE_B_WEIGHT:-1} artillery run scripts/load/workflow-isolation.yml", - "build": "bun run build:cli-runtime && bun run build:sandbox-bundles && NODE_OPTIONS='--max-old-space-size=8192' next build", + "build": "bun run build:cli-runtime && bun run build:sandbox-bundles && bun run build:xlsx-worker && NODE_OPTIONS='--max-old-space-size=8192' next build", "build:sandbox-bundles": "bun run ./lib/execution/sandbox/bundles/build.ts", + "build:xlsx-worker": "bun build ./lib/file-parsers/xlsx-worker-entry.ts --target=node --format=esm --packages=bundle --outfile=./dist/xlsx-worker.mjs", "start": "next start", "test": "vitest run", "test:scim:e2e": "bun run scripts/test-scim-e2e.ts", @@ -40,7 +41,16 @@ "generate-docs": "bun run ../../scripts/generate-docs.ts", "org:consolidate-users": "bun run scripts/consolidate-users-into-organization.ts", "verify:oracledb": "node scripts/oracledb-patch-self-test.cjs --worker lib/internal/oracledb/oracle-worker.cjs", - "build:cli-runtime": "bun build ../../packages/sim-cli/src/runtime.ts --target=node --format=esm --packages=bundle --outfile=../../packages/sim-cli/dist/runtime.js" + "build:cli-runtime": "bun build ../../packages/sim-cli/src/runtime.ts --target=node --format=esm --packages=bundle --outfile=../../packages/sim-cli/dist/runtime.js", + "ci:e2e-scim": "bash ../../.github/scripts/http-e2e.sh scim", + "ci:e2e-cli": "bash ../../.github/scripts/http-e2e.sh cli", + "ci:e2e-stop-after": "bash ../../.github/scripts/http-e2e.sh stop-after", + "ci:e2e-desktop-inbox": "bash ../../.github/scripts/http-e2e.sh desktop-inbox", + "ci:e2e-project-files": "bash ../../.github/scripts/http-e2e.sh project-files", + "ci:e2e-mobile": "bash ../../.github/scripts/http-e2e.sh mobile", + "ci:e2e-seo": "bash ../../.github/scripts/http-e2e.sh seo", + "ci:integration": "vitest run --mode integration", + "ci:desktop-live": "cd ../desktop && bunx --no-install playwright test e2e/desktop-tools-live-sim.spec.ts" }, "dependencies": { "@1password/sdk": "0.5.0", @@ -56,6 +66,7 @@ "@aws-sdk/client-cloudwatch-logs": "3.1150.0", "@aws-sdk/client-codepipeline": "3.1150.0", "@aws-sdk/client-dynamodb": "3.1150.0", + "@aws-sdk/client-ec2": "3.1150.0", "@aws-sdk/client-iam": "3.1150.0", "@aws-sdk/client-identitystore": "3.1150.0", "@aws-sdk/client-lambda": "3.1150.0", @@ -222,7 +233,7 @@ "mssql": "12.7.4", "mysql2": "3.24.5", "neo4j-driver": "6.0.1", - "next": "16.4.0", + "next": "16.4.1", "next-mdx-remote": "^6.0.0", "next-themes": "^0.4.6", "nodemailer": "10.1.0", @@ -266,12 +277,13 @@ "word-extractor": "1.0.4", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz", "y-protocols": "1.0.7", + "yauzl": "3.4.0", "yjs": "13.6.33", "zod": "4.3.6", "zustand": "^5.0.15" }, "devDependencies": { - "@next/env": "16.4.0", + "@next/env": "16.4.1", "@opentelemetry/context-async-hooks": "2.10.0", "@playwright/test": "1.61.1", "@sim/testing": "workspace:*", @@ -296,6 +308,7 @@ "@types/react": "^19", "@types/react-dom": "^19", "@types/ssh2": "^1.15.6", + "@types/yauzl": "3.4.0", "@vitejs/plugin-react": "^6.1.2", "@vitest/coverage-v8": "^5.0.4", "@vitest/expect": "5.0.4", diff --git a/apps/sim/public/library/crewai-vs-langgraph-vs-autogen/cover.jpg b/apps/sim/public/library/crewai-vs-langgraph-vs-autogen/cover.jpg new file mode 100644 index 00000000000..d5dc2b3f89b Binary files /dev/null and b/apps/sim/public/library/crewai-vs-langgraph-vs-autogen/cover.jpg differ diff --git a/apps/sim/public/library/langchain-vs-langgraph/cover.jpg b/apps/sim/public/library/langchain-vs-langgraph/cover.jpg new file mode 100644 index 00000000000..472d45ffdaa Binary files /dev/null and b/apps/sim/public/library/langchain-vs-langgraph/cover.jpg differ diff --git a/apps/sim/public/library/n8n-vs-zapier-vs-make/cover.jpg b/apps/sim/public/library/n8n-vs-zapier-vs-make/cover.jpg new file mode 100644 index 00000000000..f192c2a8b8b Binary files /dev/null and b/apps/sim/public/library/n8n-vs-zapier-vs-make/cover.jpg differ diff --git a/apps/sim/public/library/openclaw-vs-claude-cowork/cover.jpg b/apps/sim/public/library/openclaw-vs-claude-cowork/cover.jpg new file mode 100644 index 00000000000..708b9014d93 Binary files /dev/null and b/apps/sim/public/library/openclaw-vs-claude-cowork/cover.jpg differ diff --git a/apps/sim/scripts/test-mcp-host-e2e.ts b/apps/sim/scripts/test-mcp-host-e2e.ts index 96928c60db0..d877892880d 100644 --- a/apps/sim/scripts/test-mcp-host-e2e.ts +++ b/apps/sim/scripts/test-mcp-host-e2e.ts @@ -207,11 +207,6 @@ try { assert.match(response.headers.get('content-type') ?? '', /^text\/html/) }) - await check('a real page is not shadowed by the Markdown 404', async () => { - const { response } = await request('/', 'Mozilla/5.0', baseUrl.host, 'GET', MARKDOWN_ACCEPT) - assert.equal(response.status, 200) - }) - await check('an unknown API path keeps its JSON 404 for a Markdown client', async () => { const { response, body } = await request( '/api/not-a-real-route', diff --git a/apps/sim/scripts/test-mobile-e2e.ts b/apps/sim/scripts/test-mobile-e2e.ts index 0ebc467311b..698dd952e4c 100644 --- a/apps/sim/scripts/test-mobile-e2e.ts +++ b/apps/sim/scripts/test-mobile-e2e.ts @@ -21,6 +21,7 @@ import postgres from 'postgres' * Requires MOBILE_E2E_BASE_URL, MOBILE_E2E_DATABASE_URL, MOBILE_E2E_AUTH_SECRET, * and MOBILE_E2E_REPORT_PATH. Install Chromium and WebKit with Playwright first. * MOBILE_E2E_BROWSER and MOBILE_E2E_VIEWPORT narrow a diagnostic rerun. + * MOBILE_E2E_SHARD (index/count, one-based) partitions all viewports across CI jobs. */ const logger = createLogger('MobileE2E') const expect = browserExpect.configure({ timeout: 20_000 }) @@ -104,6 +105,12 @@ assert( !selectedViewport || viewports.some((viewport) => viewport.name === selectedViewport), 'Unknown viewport' ) +const shard = /^([1-9]\d*)\/([1-9]\d*)$/.exec(process.env.MOBILE_E2E_SHARD || '1/1') +assert(shard, 'MOBILE_E2E_SHARD must be index/count, one-based') +const shardIndex = Number(shard[1]) - 1 +const shardCount = Number(shard[2]) +assert(shardIndex < shardCount && shardCount <= viewports.length, 'Invalid viewport shard') +assert(!selectedViewport || shardCount === 1, 'Select either a viewport or a shard') interface CheckResult { name: string @@ -1278,7 +1285,8 @@ try { }) if (!browser) continue try { - for (const viewport of viewports) { + for (const [index, viewport] of viewports.entries()) { + if (index % shardCount !== shardIndex) continue if (selectedViewport && selectedViewport !== viewport.name) continue await exerciseViewport(browser, browserName, cookie, viewport) } diff --git a/apps/sim/scripts/test-project-files-e2e.ts b/apps/sim/scripts/test-project-files-e2e.ts index 20562b595b2..112b4164990 100644 --- a/apps/sim/scripts/test-project-files-e2e.ts +++ b/apps/sim/scripts/test-project-files-e2e.ts @@ -25,6 +25,8 @@ function requiredString(value: unknown): string { assert.ok(typeof value === 'string' && value.length > 0, 'Fixture response field is missing') return value } +const appServer = process.env.PROJECT_FILES_E2E_APP_SERVER ?? 'dev' +assert.ok(appServer === 'dev' || appServer === 'start', 'App server must be dev or start') const reportPath = resolve(required('PROJECT_FILES_E2E_REPORT_PATH')) const reportDir = dirname(reportPath) const adminUrl = new URL(required('PROJECT_FILES_E2E_ADMIN_DATABASE_URL')) @@ -76,7 +78,8 @@ const environment: NodeJS.ProcessEnv = { HOME: process.env.HOME, TMPDIR: process.env.TMPDIR, SYSTEMROOT: process.env.SYSTEMROOT, - NODE_ENV: 'development', + NODE_ENV: appServer === 'start' ? 'production' : 'development', + LOG_LEVEL: 'INFO', __NEXT_PROCESSED_ENV: 'true', DATABASE_URL: databaseUrl.toString(), MIGRATION_DATABASE_URL: databaseUrl.toString(), @@ -394,7 +397,7 @@ try { [ 'node', join(rootDir, 'node_modules/next/dist/bin/next'), - 'dev', + appServer, '--hostname', base.hostname, '--port', diff --git a/apps/sim/scripts/test-scim-e2e.ts b/apps/sim/scripts/test-scim-e2e.ts index bdbb789d422..a9e3d592f56 100644 --- a/apps/sim/scripts/test-scim-e2e.ts +++ b/apps/sim/scripts/test-scim-e2e.ts @@ -282,6 +282,24 @@ async function run() { } ) + await check( + 'Hosted SCIM rejects administration and bearer access after Enterprise entitlement ends', + async () => { + await admin(primary) + await scim(token, '/Users') + await sql`update subscription set status = 'canceled' where reference_id = ${primary.orgId}` + try { + const denied = await admin(primary, '', { expected: 403 }) + assert.match(string(denied.body.error), /active enterprise subscription/) + await scim(token, '/Users', { expected: 401 }) + } finally { + await sql`update subscription set status = 'active' where reference_id = ${primary.orgId}` + } + await admin(primary) + await scim(token, '/Users') + } + ) + await check( 'Protocol authentication, malformed JSON, and content-type errors are SCIM responses', async () => { diff --git a/apps/sim/telemetry.config.ts b/apps/sim/telemetry.config.ts index 0256b3f32db..9ed670dcb7c 100644 --- a/apps/sim/telemetry.config.ts +++ b/apps/sim/telemetry.config.ts @@ -23,15 +23,15 @@ * - API keys or tokens * - IP addresses or geolocation data */ -import { env } from './lib/core/config/env' +import { ANONYMOUS_TELEMETRY_ENDPOINT } from './lib/monitoring/otlp' const config = { /** - * OTLP Endpoint URL where telemetry data is sent - * Change this if you want to send telemetry to your own collector + * OTLP Endpoint URL where telemetry data is sent when neither OTEL_EXPORTER_OTLP_ENDPOINT nor + * TELEMETRY_ENDPOINT is set. Change this if you want to send telemetry to your own collector. * Supports any OTLP-compatible backend (Jaeger, Grafana Tempo, etc.) */ - endpoint: env.TELEMETRY_ENDPOINT || 'https://telemetry.simstudio.ai/v1/traces', + endpoint: ANONYMOUS_TELEMETRY_ENDPOINT, /** * Service name used to identify this instance diff --git a/apps/sim/tools/ec2/allocate_address.ts b/apps/sim/tools/ec2/allocate_address.ts new file mode 100644 index 00000000000..b010997c0cc --- /dev/null +++ b/apps/sim/tools/ec2/allocate_address.ts @@ -0,0 +1,108 @@ +import type { Ec2AllocateAddressParams, Ec2AllocateAddressResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const allocateAddressTool: InternalToolConfig< + Ec2AllocateAddressParams, + Ec2AllocateAddressResponse +> = { + id: 'ec2_allocate_address', + name: 'EC2 Allocate Address', + description: 'Allocate a new Elastic IP address for use in a VPC', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + networkBorderGroup: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Network border group to allocate from (defaults to the region)', + }, + publicIpv4Pool: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'BYOIP address pool to allocate from (defaults to the Amazon pool)', + }, + tags: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Tags to apply as a JSON object, e.g. {"Name":"web-eip"}', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + networkBorderGroup: params.networkBorderGroup, + publicIpv4Pool: params.publicIpv4Pool, + tags: params.tags, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Allocate Address') + } + + return { + success: true, + output: { + allocationId: data.allocationId ?? '', + publicIp: data.publicIp ?? '', + domain: data.domain ?? null, + networkBorderGroup: data.networkBorderGroup ?? null, + publicIpv4Pool: data.publicIpv4Pool ?? null, + }, + } + }, + + outputs: { + allocationId: { + type: 'string', + description: 'Allocation ID of the new Elastic IP', + }, + publicIp: { + type: 'string', + description: 'Allocated Elastic IP address', + }, + domain: { + type: 'string', + description: 'Address scope (vpc)', + nullable: true, + }, + networkBorderGroup: { + type: 'string', + description: 'Network border group', + nullable: true, + }, + publicIpv4Pool: { + type: 'string', + description: 'Public IPv4 pool', + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/ec2/associate_address.ts b/apps/sim/tools/ec2/associate_address.ts new file mode 100644 index 00000000000..872a0154538 --- /dev/null +++ b/apps/sim/tools/ec2/associate_address.ts @@ -0,0 +1,99 @@ +import type { Ec2AssociateAddressParams, Ec2AssociateAddressResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const associateAddressTool: InternalToolConfig< + Ec2AssociateAddressParams, + Ec2AssociateAddressResponse +> = { + id: 'ec2_associate_address', + name: 'EC2 Associate Address', + description: 'Associate an Elastic IP address with an instance or network interface', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + allocationId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Allocation ID of the Elastic IP (e.g., eipalloc-0abc123)', + }, + instanceId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Instance ID to associate with (provide this or networkInterfaceId)', + }, + networkInterfaceId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Network interface ID to associate with (provide this or instanceId)', + }, + privateIpAddress: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Private IP address on the target to associate with', + }, + allowReassociation: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Allow moving an Elastic IP that is already associated', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + allocationId: params.allocationId, + instanceId: params.instanceId, + networkInterfaceId: params.networkInterfaceId, + privateIpAddress: params.privateIpAddress, + allowReassociation: params.allowReassociation, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Associate Address') + } + + return { + success: true, + output: { + associationId: data.associationId ?? '', + }, + } + }, + + outputs: { + associationId: { + type: 'string', + description: 'ID of the new association', + }, + }, +} diff --git a/apps/sim/tools/ec2/authorize_security_group_ingress.ts b/apps/sim/tools/ec2/authorize_security_group_ingress.ts new file mode 100644 index 00000000000..0be1881892b --- /dev/null +++ b/apps/sim/tools/ec2/authorize_security_group_ingress.ts @@ -0,0 +1,176 @@ +import type { + Ec2AuthorizeSecurityGroupIngressParams, + Ec2AuthorizeSecurityGroupIngressResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const authorizeSecurityGroupIngressTool: InternalToolConfig< + Ec2AuthorizeSecurityGroupIngressParams, + Ec2AuthorizeSecurityGroupIngressResponse +> = { + id: 'ec2_authorize_security_group_ingress', + name: 'EC2 Authorize Security Group Ingress', + description: 'Add an inbound rule to a security group', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + groupId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Security group ID (e.g., sg-0abc123)', + }, + ipProtocol: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'IP protocol: tcp, udp, icmp, icmpv6, or -1 for all traffic', + }, + fromPort: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Start of the port range (ICMP type for icmp; omit for -1)', + }, + toPort: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'End of the port range (ICMP code for icmp; omit for -1)', + }, + cidrIp: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'IPv4 CIDR source (e.g., 203.0.113.0/24). Provide exactly one source', + }, + cidrIpv6: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'IPv6 CIDR source (e.g., 2001:db8::/32). Provide exactly one source', + }, + sourceGroupId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Source security group ID. Provide exactly one source', + }, + description: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Description for the rule', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + groupId: params.groupId, + ipProtocol: params.ipProtocol, + fromPort: params.fromPort, + toPort: params.toPort, + cidrIp: params.cidrIp, + cidrIpv6: params.cidrIpv6, + sourceGroupId: params.sourceGroupId, + description: params.description, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Authorize Security Group Ingress') + } + + return { + success: true, + output: { + authorized: data.authorized ?? false, + securityGroupRules: data.securityGroupRules ?? [], + }, + } + }, + + outputs: { + authorized: { + type: 'boolean', + description: 'Whether the rule was added', + }, + securityGroupRules: { + type: 'array', + description: 'Rules that were added', + items: { + type: 'object', + properties: { + securityGroupRuleId: { + type: 'string', + description: 'Security group rule ID', + }, + groupId: { + type: 'string', + description: 'Security group ID', + }, + ipProtocol: { + type: 'string', + description: 'IP protocol', + nullable: true, + }, + fromPort: { + type: 'number', + description: 'Start of the port range', + nullable: true, + }, + toPort: { + type: 'number', + description: 'End of the port range', + nullable: true, + }, + cidrIpv4: { + type: 'string', + description: 'IPv4 CIDR source', + nullable: true, + }, + cidrIpv6: { + type: 'string', + description: 'IPv6 CIDR source', + nullable: true, + }, + referencedGroupId: { + type: 'string', + description: 'Source security group ID', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/create_snapshot.ts b/apps/sim/tools/ec2/create_snapshot.ts new file mode 100644 index 00000000000..5690e2127fe --- /dev/null +++ b/apps/sim/tools/ec2/create_snapshot.ts @@ -0,0 +1,131 @@ +import { + EC2_TAGS_OUTPUT, + type Ec2CreateSnapshotParams, + type Ec2CreateSnapshotResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const createSnapshotTool: InternalToolConfig< + Ec2CreateSnapshotParams, + Ec2CreateSnapshotResponse +> = { + id: 'ec2_create_snapshot', + name: 'EC2 Create Snapshot', + description: 'Create a point-in-time snapshot of an EBS volume', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + volumeId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'ID of the EBS volume to snapshot (e.g., vol-0abc123)', + }, + description: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Description for the snapshot', + }, + tags: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Tags to apply as a JSON object, e.g. {"Name":"nightly-backup"}', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + volumeId: params.volumeId, + description: params.description, + tags: params.tags, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Create Snapshot') + } + + return { + success: true, + output: { + snapshotId: data.snapshotId ?? '', + volumeId: data.volumeId ?? '', + volumeSize: data.volumeSize ?? null, + state: data.state ?? null, + startTime: data.startTime ?? null, + description: data.description ?? null, + encrypted: data.encrypted ?? false, + ownerId: data.ownerId ?? null, + tags: data.tags ?? {}, + }, + } + }, + + outputs: { + snapshotId: { + type: 'string', + description: 'ID of the new snapshot', + }, + volumeId: { + type: 'string', + description: 'Source volume ID', + }, + volumeSize: { + type: 'number', + description: 'Source volume size in GiB', + nullable: true, + }, + state: { + type: 'string', + description: 'Snapshot state (pending until complete)', + nullable: true, + }, + startTime: { + type: 'string', + description: 'Start time (ISO 8601)', + nullable: true, + }, + description: { + type: 'string', + description: 'Description', + nullable: true, + }, + encrypted: { + type: 'boolean', + description: 'Whether the snapshot is encrypted', + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/create_tags.ts b/apps/sim/tools/ec2/create_tags.ts new file mode 100644 index 00000000000..fa71546e64d --- /dev/null +++ b/apps/sim/tools/ec2/create_tags.ts @@ -0,0 +1,82 @@ +import { + EC2_TAGS_OUTPUT, + type Ec2CreateTagsParams, + type Ec2CreateTagsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const createTagsTool: InternalToolConfig = { + id: 'ec2_create_tags', + name: 'EC2 Create Tags', + description: 'Add or overwrite tags on one or more EC2 resources', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + resourceIds: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Comma-separated resource IDs to tag (e.g., i-0abc123,vol-0def456)', + }, + tags: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Tags as a JSON object, e.g. {"Environment":"prod","Owner":"platform"}', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + resourceIds: params.resourceIds, + tags: params.tags, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Create Tags') + } + + return { + success: true, + output: { + resourceIds: data.resourceIds ?? [], + tags: data.tags ?? {}, + }, + } + }, + + outputs: { + resourceIds: { + type: 'array', + description: 'Resource IDs that were tagged', + items: { type: 'string' }, + }, + tags: EC2_TAGS_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/delete_snapshot.ts b/apps/sim/tools/ec2/delete_snapshot.ts new file mode 100644 index 00000000000..e539575a728 --- /dev/null +++ b/apps/sim/tools/ec2/delete_snapshot.ts @@ -0,0 +1,76 @@ +import type { Ec2DeleteSnapshotParams, Ec2DeleteSnapshotResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const deleteSnapshotTool: InternalToolConfig< + Ec2DeleteSnapshotParams, + Ec2DeleteSnapshotResponse +> = { + id: 'ec2_delete_snapshot', + name: 'EC2 Delete Snapshot', + description: 'Permanently delete an EBS snapshot', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + snapshotId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'ID of the EBS snapshot to delete (e.g., snap-0abc123)', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + snapshotId: params.snapshotId, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Delete Snapshot') + } + + return { + success: true, + output: { + deleted: data.deleted ?? false, + snapshotId: data.snapshotId ?? '', + }, + } + }, + + outputs: { + deleted: { + type: 'boolean', + description: 'Whether the snapshot was deleted', + }, + snapshotId: { + type: 'string', + description: 'Snapshot ID that was deleted', + }, + }, +} diff --git a/apps/sim/tools/ec2/delete_tags.ts b/apps/sim/tools/ec2/delete_tags.ts new file mode 100644 index 00000000000..c8219124ccb --- /dev/null +++ b/apps/sim/tools/ec2/delete_tags.ts @@ -0,0 +1,82 @@ +import type { Ec2DeleteTagsParams, Ec2DeleteTagsResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const deleteTagsTool: InternalToolConfig = { + id: 'ec2_delete_tags', + name: 'EC2 Delete Tags', + description: 'Remove tags from one or more EC2 resources', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + resourceIds: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Comma-separated resource IDs to untag', + }, + tagKeys: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Comma-separated tag keys to remove', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + resourceIds: params.resourceIds, + tagKeys: params.tagKeys, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Delete Tags') + } + + return { + success: true, + output: { + resourceIds: data.resourceIds ?? [], + tagKeys: data.tagKeys ?? [], + }, + } + }, + + outputs: { + resourceIds: { + type: 'array', + description: 'Resource IDs that were untagged', + items: { type: 'string' }, + }, + tagKeys: { + type: 'array', + description: 'Tag keys that were removed', + items: { type: 'string' }, + }, + }, +} diff --git a/apps/sim/tools/ec2/delete_volume.ts b/apps/sim/tools/ec2/delete_volume.ts new file mode 100644 index 00000000000..d123bafb3c9 --- /dev/null +++ b/apps/sim/tools/ec2/delete_volume.ts @@ -0,0 +1,74 @@ +import type { Ec2DeleteVolumeParams, Ec2DeleteVolumeResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const deleteVolumeTool: InternalToolConfig = + { + id: 'ec2_delete_volume', + name: 'EC2 Delete Volume', + description: 'Permanently delete an EBS volume that is not attached to an instance', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + volumeId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'ID of the EBS volume to delete (e.g., vol-0abc123)', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + volumeId: params.volumeId, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Delete Volume') + } + + return { + success: true, + output: { + deleted: data.deleted ?? false, + volumeId: data.volumeId ?? '', + }, + } + }, + + outputs: { + deleted: { + type: 'boolean', + description: 'Whether the volume deletion was accepted', + }, + volumeId: { + type: 'string', + description: 'Volume ID that was deleted', + }, + }, + } diff --git a/apps/sim/tools/ec2/describe_addresses.ts b/apps/sim/tools/ec2/describe_addresses.ts new file mode 100644 index 00000000000..c4a0e601e48 --- /dev/null +++ b/apps/sim/tools/ec2/describe_addresses.ts @@ -0,0 +1,150 @@ +import { + EC2_TAGS_OUTPUT, + type Ec2DescribeAddressesParams, + type Ec2DescribeAddressesResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeAddressesTool: InternalToolConfig< + Ec2DescribeAddressesParams, + Ec2DescribeAddressesResponse +> = { + id: 'ec2_describe_addresses', + name: 'EC2 Describe Addresses', + description: 'List Elastic IP addresses and what they are associated with', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + publicIps: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated Elastic IP addresses to describe', + }, + allocationIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated allocation IDs (e.g., eipalloc-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"domain","Values":["vpc"]}]', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + publicIps: params.publicIps, + allocationIds: params.allocationIds, + filters: params.filters, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Addresses') + } + + return { + success: true, + output: { + addresses: data.addresses ?? [], + }, + } + }, + + outputs: { + addresses: { + type: 'array', + description: 'Elastic IP addresses', + items: { + type: 'object', + properties: { + publicIp: { + type: 'string', + description: 'Elastic IP address', + nullable: true, + }, + allocationId: { + type: 'string', + description: 'Allocation ID', + nullable: true, + }, + associationId: { + type: 'string', + description: 'Association ID when associated', + nullable: true, + }, + domain: { + type: 'string', + description: 'Address scope (vpc or standard)', + nullable: true, + }, + instanceId: { + type: 'string', + description: 'Associated instance ID', + nullable: true, + }, + networkInterfaceId: { + type: 'string', + description: 'Associated network interface ID', + nullable: true, + }, + networkInterfaceOwnerId: { + type: 'string', + description: 'AWS account ID that owns the network interface', + nullable: true, + }, + privateIpAddress: { + type: 'string', + description: 'Associated private IP address', + nullable: true, + }, + publicIpv4Pool: { + type: 'string', + description: 'Public IPv4 pool the address came from', + nullable: true, + }, + networkBorderGroup: { + type: 'string', + description: 'Network border group the address is advertised from', + nullable: true, + }, + serviceManaged: { + type: 'string', + description: 'AWS service managing the address, if any (e.g., alb, nlb)', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/describe_availability_zones.ts b/apps/sim/tools/ec2/describe_availability_zones.ts new file mode 100644 index 00000000000..3f64ae2a095 --- /dev/null +++ b/apps/sim/tools/ec2/describe_availability_zones.ts @@ -0,0 +1,132 @@ +import type { + Ec2DescribeAvailabilityZonesParams, + Ec2DescribeAvailabilityZonesResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeAvailabilityZonesTool: InternalToolConfig< + Ec2DescribeAvailabilityZonesParams, + Ec2DescribeAvailabilityZonesResponse +> = { + id: 'ec2_describe_availability_zones', + name: 'EC2 Describe Availability Zones', + description: 'List Availability Zones, Local Zones, and Wavelength Zones in the region', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + zoneNames: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated zone names (e.g., us-east-1a)', + }, + allAvailabilityZones: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Include zones that are not opted in', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"state","Values":["available"]}]', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + zoneNames: params.zoneNames, + allAvailabilityZones: params.allAvailabilityZones, + filters: params.filters, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Availability Zones') + } + + return { + success: true, + output: { + availabilityZones: data.availabilityZones ?? [], + }, + } + }, + + outputs: { + availabilityZones: { + type: 'array', + description: 'Zones', + items: { + type: 'object', + properties: { + zoneName: { + type: 'string', + description: 'Zone name (e.g., us-east-1a)', + }, + zoneId: { + type: 'string', + description: 'Zone ID (e.g., use1-az1)', + nullable: true, + }, + zoneType: { + type: 'string', + description: 'Zone type (availability-zone, local-zone, wavelength-zone)', + nullable: true, + }, + state: { + type: 'string', + description: 'Zone state', + nullable: true, + }, + regionName: { + type: 'string', + description: 'Region name', + nullable: true, + }, + groupName: { + type: 'string', + description: 'Zone group name', + nullable: true, + }, + networkBorderGroup: { + type: 'string', + description: 'Network border group', + nullable: true, + }, + optInStatus: { + type: 'string', + description: 'Opt-in status', + nullable: true, + }, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/describe_images.ts b/apps/sim/tools/ec2/describe_images.ts new file mode 100644 index 00000000000..e69a3676d99 --- /dev/null +++ b/apps/sim/tools/ec2/describe_images.ts @@ -0,0 +1,182 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeImagesParams, + type Ec2DescribeImagesResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeImagesTool: InternalToolConfig< + Ec2DescribeImagesParams, + Ec2DescribeImagesResponse +> = { + id: 'ec2_describe_images', + name: 'EC2 Describe Images', + description: 'List AMIs owned by the account (or by the owners you specify)', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + imageIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated AMI IDs (e.g., ami-0abc123)', + }, + owners: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Comma-separated owners: AWS account IDs, self, amazon, or aws-marketplace (defaults to self)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"name","Values":["my-app-*"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + imageIds: params.imageIds, + owners: params.owners, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Images') + } + + return { + success: true, + output: { + images: data.images ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + images: { + type: 'array', + description: 'AMIs', + items: { + type: 'object', + properties: { + imageId: { + type: 'string', + description: 'AMI ID', + }, + name: { + type: 'string', + description: 'AMI name', + nullable: true, + }, + description: { + type: 'string', + description: 'Description', + nullable: true, + }, + state: { + type: 'string', + description: + 'State (pending, available, invalid, deregistered, transient, failed, error, disabled)', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + ownerAlias: { + type: 'string', + description: 'Owner alias (e.g., amazon)', + nullable: true, + }, + public: { + type: 'boolean', + description: 'Whether the AMI is public', + }, + architecture: { + type: 'string', + description: 'CPU architecture', + nullable: true, + }, + platformDetails: { + type: 'string', + description: 'Platform details (e.g., Linux/UNIX)', + nullable: true, + }, + rootDeviceType: { + type: 'string', + description: 'Root device type (ebs or instance-store)', + nullable: true, + }, + virtualizationType: { + type: 'string', + description: 'Virtualization type (hvm or paravirtual)', + nullable: true, + }, + creationDate: { + type: 'string', + description: 'Creation date (ISO 8601)', + nullable: true, + }, + deprecationTime: { + type: 'string', + description: 'Deprecation time (ISO 8601)', + nullable: true, + }, + lastLaunchedTime: { + type: 'string', + description: 'Last time an instance was launched from the AMI (ISO 8601)', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_instance_status.ts b/apps/sim/tools/ec2/describe_instance_status.ts new file mode 100644 index 00000000000..329a16d8d79 --- /dev/null +++ b/apps/sim/tools/ec2/describe_instance_status.ts @@ -0,0 +1,172 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + type Ec2DescribeInstanceStatusParams, + type Ec2DescribeInstanceStatusResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeInstanceStatusTool: InternalToolConfig< + Ec2DescribeInstanceStatusParams, + Ec2DescribeInstanceStatusResponse +> = { + id: 'ec2_describe_instance_status', + name: 'EC2 Describe Instance Status', + description: 'Get status checks and scheduled events for EC2 instances', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + instanceIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated instance IDs (max 100). Leave empty to describe all', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'EC2 filters as a JSON array, e.g. [{"Name":"instance-status.status","Values":["impaired"]}]', + }, + includeAllInstances: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: + 'Include instances that are not running (by default only running instances are returned)', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + instanceIds: params.instanceIds, + filters: params.filters, + includeAllInstances: params.includeAllInstances, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Instance Status') + } + + return { + success: true, + output: { + instanceStatuses: data.instanceStatuses ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + instanceStatuses: { + type: 'array', + description: 'Status of each instance', + items: { + type: 'object', + properties: { + instanceId: { + type: 'string', + description: 'Instance ID', + }, + availabilityZone: { + type: 'string', + description: 'Availability Zone', + nullable: true, + }, + instanceState: { + type: 'string', + description: 'Instance state (e.g., running, stopped)', + nullable: true, + }, + instanceStatus: { + type: 'string', + description: + 'Instance status check (ok, impaired, initializing, insufficient-data, not-applicable)', + nullable: true, + }, + systemStatus: { + type: 'string', + description: + 'System status check (ok, impaired, initializing, insufficient-data, not-applicable)', + nullable: true, + }, + attachedEbsStatus: { + type: 'string', + description: 'Attached EBS status check', + nullable: true, + }, + events: { + type: 'array', + description: 'Scheduled events', + items: { + type: 'object', + properties: { + code: { + type: 'string', + description: 'Event code (e.g., system-reboot, instance-retirement)', + nullable: true, + }, + description: { + type: 'string', + description: 'Event description', + nullable: true, + }, + notBefore: { + type: 'string', + description: 'Earliest start time (ISO 8601)', + nullable: true, + }, + notAfter: { + type: 'string', + description: 'Latest end time (ISO 8601)', + nullable: true, + }, + }, + }, + }, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_instances.ts b/apps/sim/tools/ec2/describe_instances.ts new file mode 100644 index 00000000000..4067e8224e9 --- /dev/null +++ b/apps/sim/tools/ec2/describe_instances.ts @@ -0,0 +1,211 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeInstancesParams, + type Ec2DescribeInstancesResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeInstancesTool: InternalToolConfig< + Ec2DescribeInstancesParams, + Ec2DescribeInstancesResponse +> = { + id: 'ec2_describe_instances', + name: 'EC2 Describe Instances', + description: 'List EC2 instances with their state, type, networking, and tags', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + instanceIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Comma-separated instance IDs (e.g., i-0abc123,i-0def456). Leave empty to list all', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'EC2 filters as a JSON array, e.g. [{"Name":"instance-state-name","Values":["running"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + instanceIds: params.instanceIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Instances') + } + + return { + success: true, + output: { + instances: data.instances ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + instances: { + type: 'array', + description: 'EC2 instances', + items: { + type: 'object', + properties: { + instanceId: { + type: 'string', + description: 'Instance ID', + }, + instanceType: { + type: 'string', + description: 'Instance type (e.g., t3.micro)', + nullable: true, + }, + state: { + type: 'string', + description: + 'Instance state (pending, running, stopping, stopped, shutting-down, terminated)', + nullable: true, + }, + stateReason: { + type: 'string', + description: 'Reason for the most recent state transition', + nullable: true, + }, + launchTime: { + type: 'string', + description: 'Launch time (ISO 8601)', + nullable: true, + }, + availabilityZone: { + type: 'string', + description: 'Availability Zone', + nullable: true, + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + subnetId: { + type: 'string', + description: 'Subnet ID', + nullable: true, + }, + privateIpAddress: { + type: 'string', + description: 'Primary private IPv4 address', + nullable: true, + }, + publicIpAddress: { + type: 'string', + description: 'Public IPv4 address', + nullable: true, + }, + privateDnsName: { + type: 'string', + description: 'Private DNS name', + nullable: true, + }, + publicDnsName: { + type: 'string', + description: 'Public DNS name', + nullable: true, + }, + imageId: { + type: 'string', + description: 'AMI ID used to launch the instance', + nullable: true, + }, + keyName: { + type: 'string', + description: 'Key pair name', + nullable: true, + }, + platformDetails: { + type: 'string', + description: 'Platform details (e.g., Linux/UNIX, Windows)', + nullable: true, + }, + architecture: { + type: 'string', + description: 'CPU architecture', + nullable: true, + }, + iamInstanceProfileArn: { + type: 'string', + description: 'ARN of the attached IAM instance profile', + nullable: true, + }, + securityGroups: { + type: 'array', + description: 'Attached security groups', + items: { + type: 'object', + properties: { + groupId: { + type: 'string', + description: 'Security group ID', + nullable: true, + }, + groupName: { + type: 'string', + description: 'Security group name', + nullable: true, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_internet_gateways.ts b/apps/sim/tools/ec2/describe_internet_gateways.ts new file mode 100644 index 00000000000..9c207b3beba --- /dev/null +++ b/apps/sim/tools/ec2/describe_internet_gateways.ts @@ -0,0 +1,134 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeInternetGatewaysParams, + type Ec2DescribeInternetGatewaysResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeInternetGatewaysTool: InternalToolConfig< + Ec2DescribeInternetGatewaysParams, + Ec2DescribeInternetGatewaysResponse +> = { + id: 'ec2_describe_internet_gateways', + name: 'EC2 Describe Internet Gateways', + description: 'List internet gateways and the VPCs they are attached to', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + internetGatewayIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated internet gateway IDs (e.g., igw-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'EC2 filters as a JSON array, e.g. [{"Name":"attachment.vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + internetGatewayIds: params.internetGatewayIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Internet Gateways') + } + + return { + success: true, + output: { + internetGateways: data.internetGateways ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + internetGateways: { + type: 'array', + description: 'Internet gateways', + items: { + type: 'object', + properties: { + internetGatewayId: { + type: 'string', + description: 'Internet gateway ID', + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + attachments: { + type: 'array', + description: 'VPC attachments', + items: { + type: 'object', + properties: { + vpcId: { + type: 'string', + description: 'Attached VPC ID', + nullable: true, + }, + state: { + type: 'string', + description: 'Attachment state', + nullable: true, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_key_pairs.ts b/apps/sim/tools/ec2/describe_key_pairs.ts new file mode 100644 index 00000000000..66cb1e32a8a --- /dev/null +++ b/apps/sim/tools/ec2/describe_key_pairs.ts @@ -0,0 +1,119 @@ +import { + EC2_TAGS_OUTPUT, + type Ec2DescribeKeyPairsParams, + type Ec2DescribeKeyPairsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeKeyPairsTool: InternalToolConfig< + Ec2DescribeKeyPairsParams, + Ec2DescribeKeyPairsResponse +> = { + id: 'ec2_describe_key_pairs', + name: 'EC2 Describe Key Pairs', + description: 'List EC2 key pairs with their type, fingerprint, and creation time', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + keyNames: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated key pair names', + }, + keyPairIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated key pair IDs (e.g., key-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"key-name","Values":["deploy-*"]}]', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + keyNames: params.keyNames, + keyPairIds: params.keyPairIds, + filters: params.filters, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Key Pairs') + } + + return { + success: true, + output: { + keyPairs: data.keyPairs ?? [], + }, + } + }, + + outputs: { + keyPairs: { + type: 'array', + description: 'Key pairs', + items: { + type: 'object', + properties: { + keyPairId: { + type: 'string', + description: 'Key pair ID', + }, + keyName: { + type: 'string', + description: 'Key pair name', + nullable: true, + }, + keyType: { + type: 'string', + description: 'Key type (rsa or ed25519)', + nullable: true, + }, + keyFingerprint: { + type: 'string', + description: 'Key fingerprint', + nullable: true, + }, + createTime: { + type: 'string', + description: 'Creation time (ISO 8601)', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/describe_nat_gateways.ts b/apps/sim/tools/ec2/describe_nat_gateways.ts new file mode 100644 index 00000000000..7da51885345 --- /dev/null +++ b/apps/sim/tools/ec2/describe_nat_gateways.ts @@ -0,0 +1,193 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeNatGatewaysParams, + type Ec2DescribeNatGatewaysResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeNatGatewaysTool: InternalToolConfig< + Ec2DescribeNatGatewaysParams, + Ec2DescribeNatGatewaysResponse +> = { + id: 'ec2_describe_nat_gateways', + name: 'EC2 Describe NAT Gateways', + description: 'List NAT gateways with their state, subnet, and IP addresses', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + natGatewayIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated NAT gateway IDs (e.g., nat-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + natGatewayIds: params.natGatewayIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe NAT Gateways') + } + + return { + success: true, + output: { + natGateways: data.natGateways ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + natGateways: { + type: 'array', + description: 'NAT gateways', + items: { + type: 'object', + properties: { + natGatewayId: { + type: 'string', + description: 'NAT gateway ID', + }, + state: { + type: 'string', + description: 'State (pending, failed, available, deleting, deleted)', + nullable: true, + }, + connectivityType: { + type: 'string', + description: 'Connectivity type (public or private)', + nullable: true, + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + subnetId: { + type: 'string', + description: 'Subnet ID', + nullable: true, + }, + createTime: { + type: 'string', + description: 'Creation time (ISO 8601)', + nullable: true, + }, + deleteTime: { + type: 'string', + description: 'Deletion time (ISO 8601)', + nullable: true, + }, + failureCode: { + type: 'string', + description: 'Failure code when state is failed', + nullable: true, + }, + failureMessage: { + type: 'string', + description: 'Failure message when state is failed', + nullable: true, + }, + addresses: { + type: 'array', + description: 'IP addresses of the NAT gateway', + items: { + type: 'object', + properties: { + allocationId: { + type: 'string', + description: 'Elastic IP allocation ID', + nullable: true, + }, + networkInterfaceId: { + type: 'string', + description: 'Network interface ID', + nullable: true, + }, + privateIp: { + type: 'string', + description: 'Private IP address', + nullable: true, + }, + publicIp: { + type: 'string', + description: 'Elastic IP address', + nullable: true, + }, + associationId: { + type: 'string', + description: 'Association ID', + nullable: true, + }, + isPrimary: { + type: 'boolean', + description: 'Whether this is the primary address', + nullable: true, + }, + status: { + type: 'string', + description: 'Address status', + nullable: true, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_network_acls.ts b/apps/sim/tools/ec2/describe_network_acls.ts new file mode 100644 index 00000000000..254b41d0f42 --- /dev/null +++ b/apps/sim/tools/ec2/describe_network_acls.ts @@ -0,0 +1,200 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeNetworkAclsParams, + type Ec2DescribeNetworkAclsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeNetworkAclsTool: InternalToolConfig< + Ec2DescribeNetworkAclsParams, + Ec2DescribeNetworkAclsResponse +> = { + id: 'ec2_describe_network_acls', + name: 'EC2 Describe Network ACLs', + description: 'List network ACLs with their inbound and outbound rules and subnet associations', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + networkAclIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated network ACL IDs (e.g., acl-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + networkAclIds: params.networkAclIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Network ACLs') + } + + return { + success: true, + output: { + networkAcls: data.networkAcls ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + networkAcls: { + type: 'array', + description: 'Network ACLs', + items: { + type: 'object', + properties: { + networkAclId: { + type: 'string', + description: 'Network ACL ID', + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + isDefault: { + type: 'boolean', + description: 'Whether this is the default ACL for the VPC', + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + entries: { + type: 'array', + description: 'Rules, evaluated in ascending rule number', + items: { + type: 'object', + properties: { + ruleNumber: { + type: 'number', + description: 'Rule number', + nullable: true, + }, + egress: { + type: 'boolean', + description: 'Whether the rule applies to outbound traffic', + }, + ruleAction: { + type: 'string', + description: 'allow or deny', + nullable: true, + }, + protocol: { + type: 'string', + description: 'Protocol number (-1 for all, 6 for TCP, 17 for UDP)', + nullable: true, + }, + cidrBlock: { + type: 'string', + description: 'IPv4 CIDR', + nullable: true, + }, + ipv6CidrBlock: { + type: 'string', + description: 'IPv6 CIDR', + nullable: true, + }, + fromPort: { + type: 'number', + description: 'Start of the port range', + nullable: true, + }, + toPort: { + type: 'number', + description: 'End of the port range', + nullable: true, + }, + icmpType: { + type: 'number', + description: 'ICMP type', + nullable: true, + }, + icmpCode: { + type: 'number', + description: 'ICMP code', + nullable: true, + }, + }, + }, + }, + associations: { + type: 'array', + description: 'Subnet associations', + items: { + type: 'object', + properties: { + associationId: { + type: 'string', + description: 'Association ID', + nullable: true, + }, + subnetId: { + type: 'string', + description: 'Subnet ID', + nullable: true, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_network_interfaces.ts b/apps/sim/tools/ec2/describe_network_interfaces.ts new file mode 100644 index 00000000000..4c1552e650c --- /dev/null +++ b/apps/sim/tools/ec2/describe_network_interfaces.ts @@ -0,0 +1,214 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeNetworkInterfacesParams, + type Ec2DescribeNetworkInterfacesResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeNetworkInterfacesTool: InternalToolConfig< + Ec2DescribeNetworkInterfacesParams, + Ec2DescribeNetworkInterfacesResponse +> = { + id: 'ec2_describe_network_interfaces', + name: 'EC2 Describe Network Interfaces', + description: 'List elastic network interfaces with their IPs, attachment, and security groups', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + networkInterfaceIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated network interface IDs (e.g., eni-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + networkInterfaceIds: params.networkInterfaceIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Network Interfaces') + } + + return { + success: true, + output: { + networkInterfaces: data.networkInterfaces ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + networkInterfaces: { + type: 'array', + description: 'Network interfaces', + items: { + type: 'object', + properties: { + networkInterfaceId: { + type: 'string', + description: 'Network interface ID', + }, + interfaceType: { + type: 'string', + description: 'Interface type (e.g., interface, nat_gateway, lambda)', + nullable: true, + }, + status: { + type: 'string', + description: 'Status (available, in-use, attaching, detaching)', + nullable: true, + }, + description: { + type: 'string', + description: 'Description', + nullable: true, + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + subnetId: { + type: 'string', + description: 'Subnet ID', + nullable: true, + }, + availabilityZone: { + type: 'string', + description: 'Availability Zone', + nullable: true, + }, + privateIpAddress: { + type: 'string', + description: 'Primary private IPv4 address', + nullable: true, + }, + privateIpAddresses: { + type: 'array', + description: 'All private IPv4 addresses', + items: { type: 'string' }, + }, + publicIp: { + type: 'string', + description: 'Associated public IPv4 address', + nullable: true, + }, + macAddress: { + type: 'string', + description: 'MAC address', + nullable: true, + }, + requesterManaged: { + type: 'boolean', + description: 'Whether an AWS service manages the interface', + }, + attachment: { + type: 'object', + description: 'Instance attachment, if attached', + nullable: true, + properties: { + attachmentId: { + type: 'string', + description: 'Attachment ID', + nullable: true, + }, + instanceId: { + type: 'string', + description: 'Attached instance ID', + nullable: true, + }, + deviceIndex: { + type: 'number', + description: 'Device index on the instance', + nullable: true, + }, + status: { + type: 'string', + description: 'Attachment status', + nullable: true, + }, + deleteOnTermination: { + type: 'boolean', + description: 'Whether the interface is deleted when the instance terminates', + nullable: true, + }, + }, + }, + securityGroups: { + type: 'array', + description: 'Attached security groups', + items: { + type: 'object', + properties: { + groupId: { + type: 'string', + description: 'Security group ID', + nullable: true, + }, + groupName: { + type: 'string', + description: 'Security group name', + nullable: true, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_regions.ts b/apps/sim/tools/ec2/describe_regions.ts new file mode 100644 index 00000000000..b06ccb98de4 --- /dev/null +++ b/apps/sim/tools/ec2/describe_regions.ts @@ -0,0 +1,105 @@ +import type { Ec2DescribeRegionsParams, Ec2DescribeRegionsResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeRegionsTool: InternalToolConfig< + Ec2DescribeRegionsParams, + Ec2DescribeRegionsResponse +> = { + id: 'ec2_describe_regions', + name: 'EC2 Describe Regions', + description: 'List AWS Regions available to the account', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + regionNames: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated region names to describe', + }, + allRegions: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Include Regions that are not enabled for the account', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'EC2 filters as a JSON array, e.g. [{"Name":"opt-in-status","Values":["opted-in"]}]', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + regionNames: params.regionNames, + allRegions: params.allRegions, + filters: params.filters, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Regions') + } + + return { + success: true, + output: { + regions: data.regions ?? [], + }, + } + }, + + outputs: { + regions: { + type: 'array', + description: 'AWS Regions', + items: { + type: 'object', + properties: { + regionName: { + type: 'string', + description: 'Region name (e.g., us-east-1)', + }, + endpoint: { + type: 'string', + description: 'EC2 endpoint for the Region', + nullable: true, + }, + optInStatus: { + type: 'string', + description: 'Opt-in status (opt-in-not-required, opted-in, not-opted-in)', + nullable: true, + }, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/describe_route_tables.ts b/apps/sim/tools/ec2/describe_route_tables.ts new file mode 100644 index 00000000000..2063f86cc7f --- /dev/null +++ b/apps/sim/tools/ec2/describe_route_tables.ts @@ -0,0 +1,222 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeRouteTablesParams, + type Ec2DescribeRouteTablesResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeRouteTablesTool: InternalToolConfig< + Ec2DescribeRouteTablesParams, + Ec2DescribeRouteTablesResponse +> = { + id: 'ec2_describe_route_tables', + name: 'EC2 Describe Route Tables', + description: 'List VPC route tables with their routes and subnet associations', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + routeTableIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated route table IDs (e.g., rtb-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-100, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + routeTableIds: params.routeTableIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Route Tables') + } + + return { + success: true, + output: { + routeTables: data.routeTables ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + routeTables: { + type: 'array', + description: 'Route tables', + items: { + type: 'object', + properties: { + routeTableId: { + type: 'string', + description: 'Route table ID', + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + routes: { + type: 'array', + description: 'Routes in the table', + items: { + type: 'object', + properties: { + destinationCidrBlock: { + type: 'string', + description: 'IPv4 destination CIDR', + nullable: true, + }, + destinationIpv6CidrBlock: { + type: 'string', + description: 'IPv6 destination CIDR', + nullable: true, + }, + destinationPrefixListId: { + type: 'string', + description: 'Destination prefix list ID', + nullable: true, + }, + gatewayId: { + type: 'string', + description: + 'Internet or virtual private gateway ID (local for VPC-local routes)', + nullable: true, + }, + natGatewayId: { + type: 'string', + description: 'NAT gateway ID', + nullable: true, + }, + transitGatewayId: { + type: 'string', + description: 'Transit gateway ID', + nullable: true, + }, + vpcPeeringConnectionId: { + type: 'string', + description: 'VPC peering connection ID', + nullable: true, + }, + networkInterfaceId: { + type: 'string', + description: 'Network interface ID', + nullable: true, + }, + instanceId: { + type: 'string', + description: 'NAT instance ID', + nullable: true, + }, + egressOnlyInternetGatewayId: { + type: 'string', + description: 'Egress-only internet gateway ID', + nullable: true, + }, + state: { + type: 'string', + description: 'Route state (active or blackhole)', + nullable: true, + }, + origin: { + type: 'string', + description: 'How the route was created', + nullable: true, + }, + }, + }, + }, + associations: { + type: 'array', + description: 'Subnet and gateway associations', + items: { + type: 'object', + properties: { + associationId: { + type: 'string', + description: 'Association ID', + nullable: true, + }, + main: { + type: 'boolean', + description: 'Whether this is the main route table for the VPC', + }, + subnetId: { + type: 'string', + description: 'Associated subnet ID', + nullable: true, + }, + gatewayId: { + type: 'string', + description: 'Associated gateway ID', + nullable: true, + }, + state: { + type: 'string', + description: 'Association state', + nullable: true, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_security_groups.ts b/apps/sim/tools/ec2/describe_security_groups.ts new file mode 100644 index 00000000000..e0e3530993f --- /dev/null +++ b/apps/sim/tools/ec2/describe_security_groups.ts @@ -0,0 +1,311 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeSecurityGroupsParams, + type Ec2DescribeSecurityGroupsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeSecurityGroupsTool: InternalToolConfig< + Ec2DescribeSecurityGroupsParams, + Ec2DescribeSecurityGroupsResponse +> = { + id: 'ec2_describe_security_groups', + name: 'EC2 Describe Security Groups', + description: 'List security groups with their inbound and outbound rules', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + groupIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated security group IDs (e.g., sg-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + groupIds: params.groupIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Security Groups') + } + + return { + success: true, + output: { + securityGroups: data.securityGroups ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + securityGroups: { + type: 'array', + description: 'Security groups', + items: { + type: 'object', + properties: { + groupId: { + type: 'string', + description: 'Security group ID', + }, + groupName: { + type: 'string', + description: 'Security group name', + nullable: true, + }, + description: { + type: 'string', + description: 'Description', + nullable: true, + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + ingressRules: { + type: 'array', + description: 'Inbound rules', + items: { + type: 'object', + properties: { + ipProtocol: { + type: 'string', + description: 'IP protocol (tcp, udp, icmp, or -1 for all)', + nullable: true, + }, + fromPort: { + type: 'number', + description: 'Start of the port range', + nullable: true, + }, + toPort: { + type: 'number', + description: 'End of the port range', + nullable: true, + }, + ipv4Ranges: { + type: 'array', + description: 'IPv4 CIDR ranges', + items: { + type: 'object', + properties: { + cidr: { + type: 'string', + description: 'IPv4 CIDR', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + ipv6Ranges: { + type: 'array', + description: 'IPv6 CIDR ranges', + items: { + type: 'object', + properties: { + cidr: { + type: 'string', + description: 'IPv6 CIDR', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + referencedGroups: { + type: 'array', + description: 'Referenced security groups', + items: { + type: 'object', + properties: { + groupId: { + type: 'string', + description: 'Security group ID', + nullable: true, + }, + userId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + prefixListIds: { + type: 'array', + description: 'Referenced prefix list IDs', + items: { type: 'string' }, + }, + }, + }, + }, + egressRules: { + type: 'array', + description: 'Outbound rules', + items: { + type: 'object', + properties: { + ipProtocol: { + type: 'string', + description: 'IP protocol (tcp, udp, icmp, or -1 for all)', + nullable: true, + }, + fromPort: { + type: 'number', + description: 'Start of the port range', + nullable: true, + }, + toPort: { + type: 'number', + description: 'End of the port range', + nullable: true, + }, + ipv4Ranges: { + type: 'array', + description: 'IPv4 CIDR ranges', + items: { + type: 'object', + properties: { + cidr: { + type: 'string', + description: 'IPv4 CIDR', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + ipv6Ranges: { + type: 'array', + description: 'IPv6 CIDR ranges', + items: { + type: 'object', + properties: { + cidr: { + type: 'string', + description: 'IPv6 CIDR', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + referencedGroups: { + type: 'array', + description: 'Referenced security groups', + items: { + type: 'object', + properties: { + groupId: { + type: 'string', + description: 'Security group ID', + nullable: true, + }, + userId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + prefixListIds: { + type: 'array', + description: 'Referenced prefix list IDs', + items: { type: 'string' }, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_snapshots.ts b/apps/sim/tools/ec2/describe_snapshots.ts new file mode 100644 index 00000000000..1fc7a690cbb --- /dev/null +++ b/apps/sim/tools/ec2/describe_snapshots.ts @@ -0,0 +1,166 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeSnapshotsParams, + type Ec2DescribeSnapshotsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeSnapshotsTool: InternalToolConfig< + Ec2DescribeSnapshotsParams, + Ec2DescribeSnapshotsResponse +> = { + id: 'ec2_describe_snapshots', + name: 'EC2 Describe Snapshots', + description: 'List EBS snapshots owned by the account (or by the owners you specify)', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + snapshotIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated snapshot IDs (e.g., snap-0abc123)', + }, + ownerIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated owners: AWS account IDs, self, or amazon (defaults to self)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'EC2 filters as a JSON array, e.g. [{"Name":"volume-id","Values":["vol-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + snapshotIds: params.snapshotIds, + ownerIds: params.ownerIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Snapshots') + } + + return { + success: true, + output: { + snapshots: data.snapshots ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + snapshots: { + type: 'array', + description: 'EBS snapshots', + items: { + type: 'object', + properties: { + snapshotId: { + type: 'string', + description: 'Snapshot ID', + }, + volumeId: { + type: 'string', + description: 'Source volume ID', + nullable: true, + }, + volumeSize: { + type: 'number', + description: 'Source volume size in GiB', + nullable: true, + }, + state: { + type: 'string', + description: 'State (pending, completed, error, recoverable, recovering)', + nullable: true, + }, + progress: { + type: 'string', + description: 'Completion progress (e.g., 100%)', + nullable: true, + }, + startTime: { + type: 'string', + description: 'Start time (ISO 8601)', + nullable: true, + }, + description: { + type: 'string', + description: 'Description', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + encrypted: { + type: 'boolean', + description: 'Whether the snapshot is encrypted', + }, + kmsKeyId: { + type: 'string', + description: 'KMS key ARN used for encryption', + nullable: true, + }, + storageTier: { + type: 'string', + description: 'Storage tier (standard or archive)', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_subnets.ts b/apps/sim/tools/ec2/describe_subnets.ts new file mode 100644 index 00000000000..137f526be63 --- /dev/null +++ b/apps/sim/tools/ec2/describe_subnets.ts @@ -0,0 +1,162 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeSubnetsParams, + type Ec2DescribeSubnetsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeSubnetsTool: InternalToolConfig< + Ec2DescribeSubnetsParams, + Ec2DescribeSubnetsResponse +> = { + id: 'ec2_describe_subnets', + name: 'EC2 Describe Subnets', + description: 'List subnets with their CIDR, Availability Zone, and free IP count', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + subnetIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated subnet IDs (e.g., subnet-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + subnetIds: params.subnetIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Subnets') + } + + return { + success: true, + output: { + subnets: data.subnets ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + subnets: { + type: 'array', + description: 'Subnets', + items: { + type: 'object', + properties: { + subnetId: { + type: 'string', + description: 'Subnet ID', + }, + subnetArn: { + type: 'string', + description: 'Subnet ARN', + nullable: true, + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + cidrBlock: { + type: 'string', + description: 'IPv4 CIDR block', + nullable: true, + }, + ipv6CidrBlocks: { + type: 'array', + description: 'Associated IPv6 CIDR blocks', + items: { type: 'string' }, + }, + availabilityZone: { + type: 'string', + description: 'Availability Zone', + nullable: true, + }, + availabilityZoneId: { + type: 'string', + description: 'Availability Zone ID', + nullable: true, + }, + availableIpAddressCount: { + type: 'number', + description: 'Number of unused private IPv4 addresses', + nullable: true, + }, + state: { + type: 'string', + description: 'State (pending, available, unavailable)', + nullable: true, + }, + defaultForAz: { + type: 'boolean', + description: 'Whether this is the default subnet for its Availability Zone', + }, + mapPublicIpOnLaunch: { + type: 'boolean', + description: 'Whether instances get a public IPv4 address on launch', + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_volumes.ts b/apps/sim/tools/ec2/describe_volumes.ts new file mode 100644 index 00000000000..4c4244435e6 --- /dev/null +++ b/apps/sim/tools/ec2/describe_volumes.ts @@ -0,0 +1,196 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeVolumesParams, + type Ec2DescribeVolumesResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeVolumesTool: InternalToolConfig< + Ec2DescribeVolumesParams, + Ec2DescribeVolumesResponse +> = { + id: 'ec2_describe_volumes', + name: 'EC2 Describe Volumes', + description: 'List EBS volumes with their size, type, state, and attachments', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + volumeIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated volume IDs (e.g., vol-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"status","Values":["available"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + volumeIds: params.volumeIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe Volumes') + } + + return { + success: true, + output: { + volumes: data.volumes ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + volumes: { + type: 'array', + description: 'EBS volumes', + items: { + type: 'object', + properties: { + volumeId: { + type: 'string', + description: 'Volume ID', + }, + volumeType: { + type: 'string', + description: 'Volume type (gp2, gp3, io1, io2, st1, sc1, standard)', + nullable: true, + }, + size: { + type: 'number', + description: 'Size in GiB', + nullable: true, + }, + state: { + type: 'string', + description: 'State (creating, available, in-use, deleting, deleted, error)', + nullable: true, + }, + availabilityZone: { + type: 'string', + description: 'Availability Zone', + nullable: true, + }, + iops: { + type: 'number', + description: 'Provisioned IOPS', + nullable: true, + }, + throughput: { + type: 'number', + description: 'Throughput in MiB/s (gp3)', + nullable: true, + }, + encrypted: { + type: 'boolean', + description: 'Whether the volume is encrypted', + }, + kmsKeyId: { + type: 'string', + description: 'KMS key ARN used for encryption', + nullable: true, + }, + snapshotId: { + type: 'string', + description: 'Snapshot the volume was created from', + nullable: true, + }, + createTime: { + type: 'string', + description: 'Creation time (ISO 8601)', + nullable: true, + }, + multiAttachEnabled: { + type: 'boolean', + description: 'Whether Multi-Attach is enabled', + }, + attachments: { + type: 'array', + description: 'Instance attachments', + items: { + type: 'object', + properties: { + instanceId: { + type: 'string', + description: 'Attached instance ID', + nullable: true, + }, + device: { + type: 'string', + description: 'Device name (e.g., /dev/xvda)', + nullable: true, + }, + state: { + type: 'string', + description: 'Attachment state', + nullable: true, + }, + attachTime: { + type: 'string', + description: 'Attach time (ISO 8601)', + nullable: true, + }, + deleteOnTermination: { + type: 'boolean', + description: 'Whether the volume is deleted when the instance terminates', + nullable: true, + }, + }, + }, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_vpc_endpoints.ts b/apps/sim/tools/ec2/describe_vpc_endpoints.ts new file mode 100644 index 00000000000..d9c21c67709 --- /dev/null +++ b/apps/sim/tools/ec2/describe_vpc_endpoints.ts @@ -0,0 +1,169 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeVpcEndpointsParams, + type Ec2DescribeVpcEndpointsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeVpcEndpointsTool: InternalToolConfig< + Ec2DescribeVpcEndpointsParams, + Ec2DescribeVpcEndpointsResponse +> = { + id: 'ec2_describe_vpc_endpoints', + name: 'EC2 Describe VPC Endpoints', + description: 'List VPC endpoints with their service, type, state, and network placement', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + vpcEndpointIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated VPC endpoint IDs (e.g., vpce-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"vpc-id","Values":["vpc-0abc123"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + vpcEndpointIds: params.vpcEndpointIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe VPC Endpoints') + } + + return { + success: true, + output: { + vpcEndpoints: data.vpcEndpoints ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + vpcEndpoints: { + type: 'array', + description: 'VPC endpoints', + items: { + type: 'object', + properties: { + vpcEndpointId: { + type: 'string', + description: 'VPC endpoint ID', + }, + vpcEndpointType: { + type: 'string', + description: + 'Endpoint type (Interface, Gateway, GatewayLoadBalancer, Resource, ServiceNetwork)', + nullable: true, + }, + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + serviceName: { + type: 'string', + description: 'Service name (e.g., com.amazonaws.us-east-1.s3)', + nullable: true, + }, + state: { + type: 'string', + description: 'Endpoint state', + nullable: true, + }, + privateDnsEnabled: { + type: 'boolean', + description: 'Whether private DNS is enabled', + }, + routeTableIds: { + type: 'array', + description: 'Associated route table IDs (gateway endpoints)', + items: { type: 'string' }, + }, + subnetIds: { + type: 'array', + description: 'Subnet IDs (interface endpoints)', + items: { type: 'string' }, + }, + networkInterfaceIds: { + type: 'array', + description: 'Endpoint network interface IDs', + items: { type: 'string' }, + }, + securityGroupIds: { + type: 'array', + description: 'Attached security group IDs', + items: { type: 'string' }, + }, + dnsNames: { + type: 'array', + description: 'DNS names for the endpoint', + items: { type: 'string' }, + }, + creationTimestamp: { + type: 'string', + description: 'Creation time (ISO 8601)', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_vpc_peering_connections.ts b/apps/sim/tools/ec2/describe_vpc_peering_connections.ts new file mode 100644 index 00000000000..8b37af91fff --- /dev/null +++ b/apps/sim/tools/ec2/describe_vpc_peering_connections.ts @@ -0,0 +1,176 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeVpcPeeringConnectionsParams, + type Ec2DescribeVpcPeeringConnectionsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeVpcPeeringConnectionsTool: InternalToolConfig< + Ec2DescribeVpcPeeringConnectionsParams, + Ec2DescribeVpcPeeringConnectionsResponse +> = { + id: 'ec2_describe_vpc_peering_connections', + name: 'EC2 Describe VPC Peering Connections', + description: 'List VPC peering connections with their status and both VPCs', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + vpcPeeringConnectionIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated VPC peering connection IDs (e.g., pcx-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"status-code","Values":["active"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + vpcPeeringConnectionIds: params.vpcPeeringConnectionIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe VPC Peering Connections') + } + + return { + success: true, + output: { + vpcPeeringConnections: data.vpcPeeringConnections ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + vpcPeeringConnections: { + type: 'array', + description: 'VPC peering connections', + items: { + type: 'object', + properties: { + vpcPeeringConnectionId: { + type: 'string', + description: 'VPC peering connection ID', + }, + status: { + type: 'string', + description: 'Status code (e.g., pending-acceptance, active, rejected, deleted)', + nullable: true, + }, + statusMessage: { + type: 'string', + description: 'Status message', + nullable: true, + }, + requesterVpc: { + type: 'object', + description: 'Requester VPC', + properties: { + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + region: { + type: 'string', + description: 'Region', + nullable: true, + }, + cidrBlock: { + type: 'string', + description: 'IPv4 CIDR block', + nullable: true, + }, + }, + }, + accepterVpc: { + type: 'object', + description: 'Accepter VPC', + properties: { + vpcId: { + type: 'string', + description: 'VPC ID', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + region: { + type: 'string', + description: 'Region', + nullable: true, + }, + cidrBlock: { + type: 'string', + description: 'IPv4 CIDR block', + nullable: true, + }, + }, + }, + expirationTime: { + type: 'string', + description: 'Time an unaccepted request expires (ISO 8601)', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, +} diff --git a/apps/sim/tools/ec2/describe_vpcs.ts b/apps/sim/tools/ec2/describe_vpcs.ts new file mode 100644 index 00000000000..b69c7f26a2a --- /dev/null +++ b/apps/sim/tools/ec2/describe_vpcs.ts @@ -0,0 +1,146 @@ +import { + EC2_NEXT_TOKEN_OUTPUT, + EC2_TAGS_OUTPUT, + type Ec2DescribeVpcsParams, + type Ec2DescribeVpcsResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const describeVpcsTool: InternalToolConfig = + { + id: 'ec2_describe_vpcs', + name: 'EC2 Describe VPCs', + description: 'List VPCs with their CIDR blocks and state', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + vpcIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Comma-separated VPC IDs (e.g., vpc-0abc123)', + }, + filters: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'EC2 filters as a JSON array, e.g. [{"Name":"is-default","Values":["false"]}]', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Maximum results per page when no IDs are given (5-1000, default 100)', + }, + nextToken: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Pagination token from a previous response', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + vpcIds: params.vpcIds, + filters: params.filters, + maxResults: params.maxResults, + nextToken: params.nextToken, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Describe VPCs') + } + + return { + success: true, + output: { + vpcs: data.vpcs ?? [], + nextToken: data.nextToken ?? null, + }, + } + }, + + outputs: { + vpcs: { + type: 'array', + description: 'VPCs', + items: { + type: 'object', + properties: { + vpcId: { + type: 'string', + description: 'VPC ID', + }, + cidrBlock: { + type: 'string', + description: 'Primary IPv4 CIDR block', + nullable: true, + }, + cidrBlocks: { + type: 'array', + description: 'All associated IPv4 CIDR blocks', + items: { type: 'string' }, + }, + ipv6CidrBlocks: { + type: 'array', + description: 'Associated IPv6 CIDR blocks', + items: { type: 'string' }, + }, + state: { + type: 'string', + description: 'State (pending or available)', + nullable: true, + }, + isDefault: { + type: 'boolean', + description: 'Whether this is the default VPC', + }, + instanceTenancy: { + type: 'string', + description: 'Instance tenancy', + nullable: true, + }, + dhcpOptionsId: { + type: 'string', + description: 'DHCP options set ID', + nullable: true, + }, + ownerId: { + type: 'string', + description: 'Owning AWS account ID', + nullable: true, + }, + tags: EC2_TAGS_OUTPUT, + }, + }, + }, + nextToken: EC2_NEXT_TOKEN_OUTPUT, + }, + } diff --git a/apps/sim/tools/ec2/disassociate_address.ts b/apps/sim/tools/ec2/disassociate_address.ts new file mode 100644 index 00000000000..241de2209e5 --- /dev/null +++ b/apps/sim/tools/ec2/disassociate_address.ts @@ -0,0 +1,79 @@ +import type { + Ec2DisassociateAddressParams, + Ec2DisassociateAddressResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const disassociateAddressTool: InternalToolConfig< + Ec2DisassociateAddressParams, + Ec2DisassociateAddressResponse +> = { + id: 'ec2_disassociate_address', + name: 'EC2 Disassociate Address', + description: 'Disassociate an Elastic IP address from its instance or network interface', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + associationId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Association ID of the Elastic IP (e.g., eipassoc-0abc123)', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + associationId: params.associationId, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Disassociate Address') + } + + return { + success: true, + output: { + disassociated: data.disassociated ?? false, + associationId: data.associationId ?? '', + }, + } + }, + + outputs: { + disassociated: { + type: 'boolean', + description: 'Whether the address was disassociated', + }, + associationId: { + type: 'string', + description: 'Association ID that was removed', + }, + }, +} diff --git a/apps/sim/tools/ec2/index.ts b/apps/sim/tools/ec2/index.ts new file mode 100644 index 00000000000..9cd4cc1d878 --- /dev/null +++ b/apps/sim/tools/ec2/index.ts @@ -0,0 +1,71 @@ +import { allocateAddressTool } from './allocate_address' +import { associateAddressTool } from './associate_address' +import { authorizeSecurityGroupIngressTool } from './authorize_security_group_ingress' +import { createSnapshotTool } from './create_snapshot' +import { createTagsTool } from './create_tags' +import { deleteSnapshotTool } from './delete_snapshot' +import { deleteTagsTool } from './delete_tags' +import { deleteVolumeTool } from './delete_volume' +import { describeAddressesTool } from './describe_addresses' +import { describeAvailabilityZonesTool } from './describe_availability_zones' +import { describeImagesTool } from './describe_images' +import { describeInstanceStatusTool } from './describe_instance_status' +import { describeInstancesTool } from './describe_instances' +import { describeInternetGatewaysTool } from './describe_internet_gateways' +import { describeKeyPairsTool } from './describe_key_pairs' +import { describeNatGatewaysTool } from './describe_nat_gateways' +import { describeNetworkAclsTool } from './describe_network_acls' +import { describeNetworkInterfacesTool } from './describe_network_interfaces' +import { describeRegionsTool } from './describe_regions' +import { describeRouteTablesTool } from './describe_route_tables' +import { describeSecurityGroupsTool } from './describe_security_groups' +import { describeSnapshotsTool } from './describe_snapshots' +import { describeSubnetsTool } from './describe_subnets' +import { describeVolumesTool } from './describe_volumes' +import { describeVpcEndpointsTool } from './describe_vpc_endpoints' +import { describeVpcPeeringConnectionsTool } from './describe_vpc_peering_connections' +import { describeVpcsTool } from './describe_vpcs' +import { disassociateAddressTool } from './disassociate_address' +import { rebootInstancesTool } from './reboot_instances' +import { releaseAddressTool } from './release_address' +import { revokeSecurityGroupIngressTool } from './revoke_security_group_ingress' +import { startInstancesTool } from './start_instances' +import { stopInstancesTool } from './stop_instances' +import { terminateInstancesTool } from './terminate_instances' + +export const ec2DescribeInstancesTool = describeInstancesTool +export const ec2DescribeInstanceStatusTool = describeInstanceStatusTool +export const ec2StartInstancesTool = startInstancesTool +export const ec2StopInstancesTool = stopInstancesTool +export const ec2RebootInstancesTool = rebootInstancesTool +export const ec2TerminateInstancesTool = terminateInstancesTool +export const ec2DescribeAddressesTool = describeAddressesTool +export const ec2AllocateAddressTool = allocateAddressTool +export const ec2AssociateAddressTool = associateAddressTool +export const ec2DisassociateAddressTool = disassociateAddressTool +export const ec2ReleaseAddressTool = releaseAddressTool +export const ec2DescribeNatGatewaysTool = describeNatGatewaysTool +export const ec2DescribeRouteTablesTool = describeRouteTablesTool +export const ec2DescribeVpcsTool = describeVpcsTool +export const ec2DescribeSubnetsTool = describeSubnetsTool +export const ec2DescribeSecurityGroupsTool = describeSecurityGroupsTool +export const ec2DescribeInternetGatewaysTool = describeInternetGatewaysTool +export const ec2DescribeNetworkInterfacesTool = describeNetworkInterfacesTool +export const ec2DescribeVolumesTool = describeVolumesTool +export const ec2DescribeSnapshotsTool = describeSnapshotsTool +export const ec2CreateSnapshotTool = createSnapshotTool +export const ec2CreateTagsTool = createTagsTool +export const ec2DeleteTagsTool = deleteTagsTool +export const ec2DescribeRegionsTool = describeRegionsTool +export const ec2DescribeAvailabilityZonesTool = describeAvailabilityZonesTool +export const ec2DescribeNetworkAclsTool = describeNetworkAclsTool +export const ec2DescribeVpcEndpointsTool = describeVpcEndpointsTool +export const ec2DescribeVpcPeeringConnectionsTool = describeVpcPeeringConnectionsTool +export const ec2DescribeImagesTool = describeImagesTool +export const ec2DescribeKeyPairsTool = describeKeyPairsTool +export const ec2AuthorizeSecurityGroupIngressTool = authorizeSecurityGroupIngressTool +export const ec2RevokeSecurityGroupIngressTool = revokeSecurityGroupIngressTool +export const ec2DeleteVolumeTool = deleteVolumeTool +export const ec2DeleteSnapshotTool = deleteSnapshotTool + +export * from './types' diff --git a/apps/sim/tools/ec2/reboot_instances.ts b/apps/sim/tools/ec2/reboot_instances.ts new file mode 100644 index 00000000000..f5814013a3f --- /dev/null +++ b/apps/sim/tools/ec2/reboot_instances.ts @@ -0,0 +1,77 @@ +import type { Ec2RebootInstancesParams, Ec2RebootInstancesResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const rebootInstancesTool: InternalToolConfig< + Ec2RebootInstancesParams, + Ec2RebootInstancesResponse +> = { + id: 'ec2_reboot_instances', + name: 'EC2 Reboot Instances', + description: 'Request a reboot of one or more EC2 instances', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + instanceIds: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Comma-separated instance IDs to reboot', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + instanceIds: params.instanceIds, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Reboot Instances') + } + + return { + success: true, + output: { + rebooted: data.rebooted ?? false, + instanceIds: data.instanceIds ?? [], + }, + } + }, + + outputs: { + rebooted: { + type: 'boolean', + description: 'Whether the reboot request was accepted', + }, + instanceIds: { + type: 'array', + description: 'Instance IDs that were sent the reboot request', + items: { type: 'string' }, + }, + }, +} diff --git a/apps/sim/tools/ec2/release_address.ts b/apps/sim/tools/ec2/release_address.ts new file mode 100644 index 00000000000..fa399594103 --- /dev/null +++ b/apps/sim/tools/ec2/release_address.ts @@ -0,0 +1,83 @@ +import type { Ec2ReleaseAddressParams, Ec2ReleaseAddressResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const releaseAddressTool: InternalToolConfig< + Ec2ReleaseAddressParams, + Ec2ReleaseAddressResponse +> = { + id: 'ec2_release_address', + name: 'EC2 Release Address', + description: 'Release an Elastic IP address back to AWS', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + allocationId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Allocation ID of the Elastic IP to release', + }, + networkBorderGroup: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Network border group the address was allocated from', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + allocationId: params.allocationId, + networkBorderGroup: params.networkBorderGroup, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Release Address') + } + + return { + success: true, + output: { + released: data.released ?? false, + allocationId: data.allocationId ?? '', + }, + } + }, + + outputs: { + released: { + type: 'boolean', + description: 'Whether the address was released', + }, + allocationId: { + type: 'string', + description: 'Allocation ID that was released', + }, + }, +} diff --git a/apps/sim/tools/ec2/revoke_security_group_ingress.ts b/apps/sim/tools/ec2/revoke_security_group_ingress.ts new file mode 100644 index 00000000000..efc729164fc --- /dev/null +++ b/apps/sim/tools/ec2/revoke_security_group_ingress.ts @@ -0,0 +1,179 @@ +import type { + Ec2RevokeSecurityGroupIngressParams, + Ec2RevokeSecurityGroupIngressResponse, +} from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const revokeSecurityGroupIngressTool: InternalToolConfig< + Ec2RevokeSecurityGroupIngressParams, + Ec2RevokeSecurityGroupIngressResponse +> = { + id: 'ec2_revoke_security_group_ingress', + name: 'EC2 Revoke Security Group Ingress', + description: + 'Remove inbound rules from a security group by rule ID or by matching protocol, ports, and source', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + groupId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Security group ID (e.g., sg-0abc123)', + }, + ipProtocol: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'IP protocol: tcp, udp, icmp, icmpv6, or -1 for all traffic', + }, + fromPort: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Start of the port range (ICMP type for icmp; omit for -1)', + }, + toPort: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'End of the port range (ICMP code for icmp; omit for -1)', + }, + cidrIp: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'IPv4 CIDR source (e.g., 203.0.113.0/24). Provide exactly one source', + }, + cidrIpv6: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'IPv6 CIDR source (e.g., 2001:db8::/32). Provide exactly one source', + }, + sourceGroupId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Source security group ID. Provide exactly one source', + }, + securityGroupRuleIds: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Comma-separated security group rule IDs (e.g., sgr-0abc123). Use instead of protocol, ports, and source', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + groupId: params.groupId, + ipProtocol: params.ipProtocol, + fromPort: params.fromPort, + toPort: params.toPort, + cidrIp: params.cidrIp, + cidrIpv6: params.cidrIpv6, + sourceGroupId: params.sourceGroupId, + securityGroupRuleIds: params.securityGroupRuleIds, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Revoke Security Group Ingress') + } + + return { + success: true, + output: { + revoked: data.revoked ?? false, + revokedRules: data.revokedRules ?? [], + unmatchedRuleCount: data.unmatchedRuleCount ?? 0, + }, + } + }, + + outputs: { + revoked: { + type: 'boolean', + description: 'Whether the request succeeded', + }, + revokedRules: { + type: 'array', + description: 'Rules that were removed', + items: { + type: 'object', + properties: { + securityGroupRuleId: { + type: 'string', + description: 'Security group rule ID', + }, + ipProtocol: { + type: 'string', + description: 'IP protocol', + nullable: true, + }, + fromPort: { + type: 'number', + description: 'Start of the port range', + nullable: true, + }, + toPort: { + type: 'number', + description: 'End of the port range', + nullable: true, + }, + cidrIpv4: { + type: 'string', + description: 'IPv4 CIDR source', + nullable: true, + }, + cidrIpv6: { + type: 'string', + description: 'IPv6 CIDR source', + nullable: true, + }, + referencedGroupId: { + type: 'string', + description: 'Source security group ID', + nullable: true, + }, + description: { + type: 'string', + description: 'Rule description', + nullable: true, + }, + }, + }, + }, + unmatchedRuleCount: { + type: 'number', + description: 'Number of requested rules that did not match an existing rule', + }, + }, +} diff --git a/apps/sim/tools/ec2/start_instances.ts b/apps/sim/tools/ec2/start_instances.ts new file mode 100644 index 00000000000..a82649c5067 --- /dev/null +++ b/apps/sim/tools/ec2/start_instances.ts @@ -0,0 +1,90 @@ +import type { Ec2StartInstancesParams, Ec2StartInstancesResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const startInstancesTool: InternalToolConfig< + Ec2StartInstancesParams, + Ec2StartInstancesResponse +> = { + id: 'ec2_start_instances', + name: 'EC2 Start Instances', + description: 'Start one or more stopped EC2 instances', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + instanceIds: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Comma-separated instance IDs to start', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + instanceIds: params.instanceIds, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Start Instances') + } + + return { + success: true, + output: { + instances: data.instances ?? [], + }, + } + }, + + outputs: { + instances: { + type: 'array', + description: 'State transition for each instance', + items: { + type: 'object', + properties: { + instanceId: { + type: 'string', + description: 'Instance ID', + }, + currentState: { + type: 'string', + description: 'State after the request (e.g., pending, running)', + nullable: true, + }, + previousState: { + type: 'string', + description: 'State before the request', + nullable: true, + }, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/stop_instances.ts b/apps/sim/tools/ec2/stop_instances.ts new file mode 100644 index 00000000000..8bcdde13252 --- /dev/null +++ b/apps/sim/tools/ec2/stop_instances.ts @@ -0,0 +1,105 @@ +import type { Ec2StopInstancesParams, Ec2StopInstancesResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const stopInstancesTool: InternalToolConfig< + Ec2StopInstancesParams, + Ec2StopInstancesResponse +> = { + id: 'ec2_stop_instances', + name: 'EC2 Stop Instances', + description: 'Stop one or more running EC2 instances', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + instanceIds: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Comma-separated instance IDs to stop', + }, + hibernate: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: + 'Hibernate the instances instead of stopping them (hibernation must be enabled on the instance)', + }, + force: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Force the instances to stop without flushing file system caches', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + instanceIds: params.instanceIds, + hibernate: params.hibernate, + force: params.force, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Stop Instances') + } + + return { + success: true, + output: { + instances: data.instances ?? [], + }, + } + }, + + outputs: { + instances: { + type: 'array', + description: 'State transition for each instance', + items: { + type: 'object', + properties: { + instanceId: { + type: 'string', + description: 'Instance ID', + }, + currentState: { + type: 'string', + description: 'State after the request (e.g., stopping, stopped)', + nullable: true, + }, + previousState: { + type: 'string', + description: 'State before the request', + nullable: true, + }, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/terminate_instances.ts b/apps/sim/tools/ec2/terminate_instances.ts new file mode 100644 index 00000000000..962d02d8917 --- /dev/null +++ b/apps/sim/tools/ec2/terminate_instances.ts @@ -0,0 +1,90 @@ +import type { Ec2TerminateInstancesParams, Ec2TerminateInstancesResponse } from '@/tools/ec2/types' +import { ec2ConnectionInput, suppliedParams } from '@/tools/ec2/utils' +import type { InternalToolConfig } from '@/tools/types' + +export const terminateInstancesTool: InternalToolConfig< + Ec2TerminateInstancesParams, + Ec2TerminateInstancesResponse +> = { + id: 'ec2_terminate_instances', + name: 'EC2 Terminate Instances', + description: 'Permanently terminate one or more EC2 instances', + version: '1.0.0', + + params: { + awsRegion: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS region (e.g., us-east-1)', + }, + awsAccessKeyId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS access key ID', + }, + awsSecretAccessKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'AWS secret access key', + }, + instanceIds: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Comma-separated instance IDs to terminate', + }, + }, + + operation: { + input: (params) => ({ + ...ec2ConnectionInput(params), + ...suppliedParams({ + instanceIds: params.instanceIds, + }), + }), + }, + + transformResponse: async (response: Response) => { + const data = await response.json() + + if (!response.ok) { + throw new Error(data.error || 'Failed to run EC2 Terminate Instances') + } + + return { + success: true, + output: { + instances: data.instances ?? [], + }, + } + }, + + outputs: { + instances: { + type: 'array', + description: 'State transition for each instance', + items: { + type: 'object', + properties: { + instanceId: { + type: 'string', + description: 'Instance ID', + }, + currentState: { + type: 'string', + description: 'State after the request (e.g., shutting-down, terminated)', + nullable: true, + }, + previousState: { + type: 'string', + description: 'State before the request', + nullable: true, + }, + }, + }, + }, + }, +} diff --git a/apps/sim/tools/ec2/types.ts b/apps/sim/tools/ec2/types.ts new file mode 100644 index 00000000000..a0961d86431 --- /dev/null +++ b/apps/sim/tools/ec2/types.ts @@ -0,0 +1,832 @@ +import type { OutputProperty, ToolResponse } from '@/tools/types' + +export interface Ec2ConnectionParams { + awsRegion: string + awsAccessKeyId: string + awsSecretAccessKey: string +} + +export const EC2_TAGS_OUTPUT: OutputProperty = { + type: 'json', + description: 'Resource tags as key/value pairs', +} + +export const EC2_NEXT_TOKEN_OUTPUT: OutputProperty = { + type: 'string', + description: 'Pagination token for the next page, or null when there are no more results', + nullable: true, +} + +export interface Ec2DescribeInstancesParams extends Ec2ConnectionParams { + instanceIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeInstancesResponse extends ToolResponse { + output: { + instances: { + instanceId: string + instanceType: string | null + state: string | null + stateReason: string | null + launchTime: string | null + availabilityZone: string | null + vpcId: string | null + subnetId: string | null + privateIpAddress: string | null + publicIpAddress: string | null + privateDnsName: string | null + publicDnsName: string | null + imageId: string | null + keyName: string | null + platformDetails: string | null + architecture: string | null + iamInstanceProfileArn: string | null + securityGroups: { + groupId: string | null + groupName: string | null + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeInstanceStatusParams extends Ec2ConnectionParams { + instanceIds?: string | null + filters?: unknown | null + includeAllInstances?: boolean | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeInstanceStatusResponse extends ToolResponse { + output: { + instanceStatuses: { + instanceId: string + availabilityZone: string | null + instanceState: string | null + instanceStatus: string | null + systemStatus: string | null + attachedEbsStatus: string | null + events: { + code: string | null + description: string | null + notBefore: string | null + notAfter: string | null + }[] + }[] + nextToken: string | null + } +} + +export interface Ec2StartInstancesParams extends Ec2ConnectionParams { + instanceIds: string +} + +export interface Ec2StartInstancesResponse extends ToolResponse { + output: { + instances: { + instanceId: string + currentState: string | null + previousState: string | null + }[] + } +} + +export interface Ec2StopInstancesParams extends Ec2ConnectionParams { + instanceIds: string + hibernate?: boolean | null + force?: boolean | null +} + +export interface Ec2StopInstancesResponse extends ToolResponse { + output: { + instances: { + instanceId: string + currentState: string | null + previousState: string | null + }[] + } +} + +export interface Ec2RebootInstancesParams extends Ec2ConnectionParams { + instanceIds: string +} + +export interface Ec2RebootInstancesResponse extends ToolResponse { + output: { + rebooted: boolean + instanceIds: string[] + } +} + +export interface Ec2TerminateInstancesParams extends Ec2ConnectionParams { + instanceIds: string +} + +export interface Ec2TerminateInstancesResponse extends ToolResponse { + output: { + instances: { + instanceId: string + currentState: string | null + previousState: string | null + }[] + } +} + +export interface Ec2DescribeAddressesParams extends Ec2ConnectionParams { + publicIps?: string | null + allocationIds?: string | null + filters?: unknown | null +} + +export interface Ec2DescribeAddressesResponse extends ToolResponse { + output: { + addresses: { + publicIp: string | null + allocationId: string | null + associationId: string | null + domain: string | null + instanceId: string | null + networkInterfaceId: string | null + networkInterfaceOwnerId: string | null + privateIpAddress: string | null + publicIpv4Pool: string | null + networkBorderGroup: string | null + serviceManaged: string | null + tags: Record + }[] + } +} + +export interface Ec2AllocateAddressParams extends Ec2ConnectionParams { + networkBorderGroup?: string | null + publicIpv4Pool?: string | null + tags?: unknown | null +} + +export interface Ec2AllocateAddressResponse extends ToolResponse { + output: { + allocationId: string + publicIp: string + domain: string | null + networkBorderGroup: string | null + publicIpv4Pool: string | null + } +} + +export interface Ec2AssociateAddressParams extends Ec2ConnectionParams { + allocationId: string + instanceId?: string | null + networkInterfaceId?: string | null + privateIpAddress?: string | null + allowReassociation?: boolean | null +} + +export interface Ec2AssociateAddressResponse extends ToolResponse { + output: { + associationId: string + } +} + +export interface Ec2DisassociateAddressParams extends Ec2ConnectionParams { + associationId: string +} + +export interface Ec2DisassociateAddressResponse extends ToolResponse { + output: { + disassociated: boolean + associationId: string + } +} + +export interface Ec2ReleaseAddressParams extends Ec2ConnectionParams { + allocationId: string + networkBorderGroup?: string | null +} + +export interface Ec2ReleaseAddressResponse extends ToolResponse { + output: { + released: boolean + allocationId: string + } +} + +export interface Ec2DescribeNatGatewaysParams extends Ec2ConnectionParams { + natGatewayIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeNatGatewaysResponse extends ToolResponse { + output: { + natGateways: { + natGatewayId: string + state: string | null + connectivityType: string | null + vpcId: string | null + subnetId: string | null + createTime: string | null + deleteTime: string | null + failureCode: string | null + failureMessage: string | null + addresses: { + allocationId: string | null + networkInterfaceId: string | null + privateIp: string | null + publicIp: string | null + associationId: string | null + isPrimary: boolean | null + status: string | null + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeRouteTablesParams extends Ec2ConnectionParams { + routeTableIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeRouteTablesResponse extends ToolResponse { + output: { + routeTables: { + routeTableId: string + vpcId: string | null + ownerId: string | null + routes: { + destinationCidrBlock: string | null + destinationIpv6CidrBlock: string | null + destinationPrefixListId: string | null + gatewayId: string | null + natGatewayId: string | null + transitGatewayId: string | null + vpcPeeringConnectionId: string | null + networkInterfaceId: string | null + instanceId: string | null + egressOnlyInternetGatewayId: string | null + state: string | null + origin: string | null + }[] + associations: { + associationId: string | null + main: boolean + subnetId: string | null + gatewayId: string | null + state: string | null + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeVpcsParams extends Ec2ConnectionParams { + vpcIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeVpcsResponse extends ToolResponse { + output: { + vpcs: { + vpcId: string + cidrBlock: string | null + cidrBlocks: string[] + ipv6CidrBlocks: string[] + state: string | null + isDefault: boolean + instanceTenancy: string | null + dhcpOptionsId: string | null + ownerId: string | null + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeSubnetsParams extends Ec2ConnectionParams { + subnetIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeSubnetsResponse extends ToolResponse { + output: { + subnets: { + subnetId: string + subnetArn: string | null + vpcId: string | null + cidrBlock: string | null + ipv6CidrBlocks: string[] + availabilityZone: string | null + availabilityZoneId: string | null + availableIpAddressCount: number | null + state: string | null + defaultForAz: boolean + mapPublicIpOnLaunch: boolean + ownerId: string | null + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeSecurityGroupsParams extends Ec2ConnectionParams { + groupIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeSecurityGroupsResponse extends ToolResponse { + output: { + securityGroups: { + groupId: string + groupName: string | null + description: string | null + vpcId: string | null + ownerId: string | null + ingressRules: { + ipProtocol: string | null + fromPort: number | null + toPort: number | null + ipv4Ranges: { + cidr: string | null + description: string | null + }[] + ipv6Ranges: { + cidr: string | null + description: string | null + }[] + referencedGroups: { + groupId: string | null + userId: string | null + description: string | null + }[] + prefixListIds: string[] + }[] + egressRules: { + ipProtocol: string | null + fromPort: number | null + toPort: number | null + ipv4Ranges: { + cidr: string | null + description: string | null + }[] + ipv6Ranges: { + cidr: string | null + description: string | null + }[] + referencedGroups: { + groupId: string | null + userId: string | null + description: string | null + }[] + prefixListIds: string[] + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeInternetGatewaysParams extends Ec2ConnectionParams { + internetGatewayIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeInternetGatewaysResponse extends ToolResponse { + output: { + internetGateways: { + internetGatewayId: string + ownerId: string | null + attachments: { + vpcId: string | null + state: string | null + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeNetworkInterfacesParams extends Ec2ConnectionParams { + networkInterfaceIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeNetworkInterfacesResponse extends ToolResponse { + output: { + networkInterfaces: { + networkInterfaceId: string + interfaceType: string | null + status: string | null + description: string | null + vpcId: string | null + subnetId: string | null + availabilityZone: string | null + privateIpAddress: string | null + privateIpAddresses: string[] + publicIp: string | null + macAddress: string | null + requesterManaged: boolean + attachment: { + attachmentId: string | null + instanceId: string | null + deviceIndex: number | null + status: string | null + deleteOnTermination: boolean | null + } | null + securityGroups: { + groupId: string | null + groupName: string | null + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeVolumesParams extends Ec2ConnectionParams { + volumeIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeVolumesResponse extends ToolResponse { + output: { + volumes: { + volumeId: string + volumeType: string | null + size: number | null + state: string | null + availabilityZone: string | null + iops: number | null + throughput: number | null + encrypted: boolean + kmsKeyId: string | null + snapshotId: string | null + createTime: string | null + multiAttachEnabled: boolean + attachments: { + instanceId: string | null + device: string | null + state: string | null + attachTime: string | null + deleteOnTermination: boolean | null + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeSnapshotsParams extends Ec2ConnectionParams { + snapshotIds?: string | null + ownerIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeSnapshotsResponse extends ToolResponse { + output: { + snapshots: { + snapshotId: string + volumeId: string | null + volumeSize: number | null + state: string | null + progress: string | null + startTime: string | null + description: string | null + ownerId: string | null + encrypted: boolean + kmsKeyId: string | null + storageTier: string | null + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2CreateSnapshotParams extends Ec2ConnectionParams { + volumeId: string + description?: string | null + tags?: unknown | null +} + +export interface Ec2CreateSnapshotResponse extends ToolResponse { + output: { + snapshotId: string + volumeId: string + volumeSize: number | null + state: string | null + startTime: string | null + description: string | null + encrypted: boolean + ownerId: string | null + tags: Record + } +} + +export interface Ec2CreateTagsParams extends Ec2ConnectionParams { + resourceIds: string + tags: unknown +} + +export interface Ec2CreateTagsResponse extends ToolResponse { + output: { + resourceIds: string[] + tags: Record + } +} + +export interface Ec2DeleteTagsParams extends Ec2ConnectionParams { + resourceIds: string + tagKeys: string +} + +export interface Ec2DeleteTagsResponse extends ToolResponse { + output: { + resourceIds: string[] + tagKeys: string[] + } +} + +export interface Ec2DescribeRegionsParams extends Ec2ConnectionParams { + regionNames?: string | null + allRegions?: boolean | null + filters?: unknown | null +} + +export interface Ec2DescribeRegionsResponse extends ToolResponse { + output: { + regions: { + regionName: string + endpoint: string | null + optInStatus: string | null + }[] + } +} + +export interface Ec2DescribeAvailabilityZonesParams extends Ec2ConnectionParams { + zoneNames?: string | null + allAvailabilityZones?: boolean | null + filters?: unknown | null +} + +export interface Ec2DescribeAvailabilityZonesResponse extends ToolResponse { + output: { + availabilityZones: { + zoneName: string + zoneId: string | null + zoneType: string | null + state: string | null + regionName: string | null + groupName: string | null + networkBorderGroup: string | null + optInStatus: string | null + }[] + } +} + +export interface Ec2DescribeNetworkAclsParams extends Ec2ConnectionParams { + networkAclIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeNetworkAclsResponse extends ToolResponse { + output: { + networkAcls: { + networkAclId: string + vpcId: string | null + isDefault: boolean + ownerId: string | null + entries: { + ruleNumber: number | null + egress: boolean + ruleAction: string | null + protocol: string | null + cidrBlock: string | null + ipv6CidrBlock: string | null + fromPort: number | null + toPort: number | null + icmpType: number | null + icmpCode: number | null + }[] + associations: { + associationId: string | null + subnetId: string | null + }[] + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeVpcEndpointsParams extends Ec2ConnectionParams { + vpcEndpointIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeVpcEndpointsResponse extends ToolResponse { + output: { + vpcEndpoints: { + vpcEndpointId: string + vpcEndpointType: string | null + vpcId: string | null + serviceName: string | null + state: string | null + privateDnsEnabled: boolean + routeTableIds: string[] + subnetIds: string[] + networkInterfaceIds: string[] + securityGroupIds: string[] + dnsNames: string[] + creationTimestamp: string | null + ownerId: string | null + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeVpcPeeringConnectionsParams extends Ec2ConnectionParams { + vpcPeeringConnectionIds?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeVpcPeeringConnectionsResponse extends ToolResponse { + output: { + vpcPeeringConnections: { + vpcPeeringConnectionId: string + status: string | null + statusMessage: string | null + requesterVpc: { + vpcId: string | null + ownerId: string | null + region: string | null + cidrBlock: string | null + } + accepterVpc: { + vpcId: string | null + ownerId: string | null + region: string | null + cidrBlock: string | null + } + expirationTime: string | null + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeImagesParams extends Ec2ConnectionParams { + imageIds?: string | null + owners?: string | null + filters?: unknown | null + maxResults?: number | null + nextToken?: string | null +} + +export interface Ec2DescribeImagesResponse extends ToolResponse { + output: { + images: { + imageId: string + name: string | null + description: string | null + state: string | null + ownerId: string | null + ownerAlias: string | null + public: boolean + architecture: string | null + platformDetails: string | null + rootDeviceType: string | null + virtualizationType: string | null + creationDate: string | null + deprecationTime: string | null + lastLaunchedTime: string | null + tags: Record + }[] + nextToken: string | null + } +} + +export interface Ec2DescribeKeyPairsParams extends Ec2ConnectionParams { + keyNames?: string | null + keyPairIds?: string | null + filters?: unknown | null +} + +export interface Ec2DescribeKeyPairsResponse extends ToolResponse { + output: { + keyPairs: { + keyPairId: string + keyName: string | null + keyType: string | null + keyFingerprint: string | null + createTime: string | null + tags: Record + }[] + } +} + +export interface Ec2AuthorizeSecurityGroupIngressParams extends Ec2ConnectionParams { + groupId: string + ipProtocol: string + fromPort?: number | null + toPort?: number | null + cidrIp?: string | null + cidrIpv6?: string | null + sourceGroupId?: string | null + description?: string | null +} + +export interface Ec2AuthorizeSecurityGroupIngressResponse extends ToolResponse { + output: { + authorized: boolean + securityGroupRules: { + securityGroupRuleId: string + groupId: string + ipProtocol: string | null + fromPort: number | null + toPort: number | null + cidrIpv4: string | null + cidrIpv6: string | null + referencedGroupId: string | null + description: string | null + }[] + } +} + +export interface Ec2RevokeSecurityGroupIngressParams extends Ec2ConnectionParams { + groupId: string + ipProtocol?: string | null + fromPort?: number | null + toPort?: number | null + cidrIp?: string | null + cidrIpv6?: string | null + sourceGroupId?: string | null + securityGroupRuleIds?: string | null +} + +export interface Ec2RevokeSecurityGroupIngressResponse extends ToolResponse { + output: { + revoked: boolean + revokedRules: { + securityGroupRuleId: string + ipProtocol: string | null + fromPort: number | null + toPort: number | null + cidrIpv4: string | null + cidrIpv6: string | null + referencedGroupId: string | null + description: string | null + }[] + unmatchedRuleCount: number + } +} + +export interface Ec2DeleteVolumeParams extends Ec2ConnectionParams { + volumeId: string +} + +export interface Ec2DeleteVolumeResponse extends ToolResponse { + output: { + deleted: boolean + volumeId: string + } +} + +export interface Ec2DeleteSnapshotParams extends Ec2ConnectionParams { + snapshotId: string +} + +export interface Ec2DeleteSnapshotResponse extends ToolResponse { + output: { + deleted: boolean + snapshotId: string + } +} diff --git a/apps/sim/tools/ec2/utils.ts b/apps/sim/tools/ec2/utils.ts new file mode 100644 index 00000000000..07d190d272f --- /dev/null +++ b/apps/sim/tools/ec2/utils.ts @@ -0,0 +1,21 @@ +import type { Ec2ConnectionParams } from '@/tools/ec2/types' + +export function ec2ConnectionInput(params: Ec2ConnectionParams) { + return { + region: params.awsRegion, + accessKeyId: params.awsAccessKeyId, + secretAccessKey: params.awsSecretAccessKey, + } +} + +/** + * Drops optional params that carry no value. A direct LLM tool call can pass `null` or an + * empty string for a param it means to omit, which would otherwise fail input validation. + */ +export function suppliedParams(params: Record): Record { + const supplied: Record = {} + for (const [key, value] of Object.entries(params)) { + if (value !== undefined && value !== null && value !== '') supplied[key] = value + } + return supplied +} diff --git a/apps/sim/tools/generated/tool-ids.ts b/apps/sim/tools/generated/tool-ids.ts index dcf6e27edbe..6ad6bf8b683 100644 --- a/apps/sim/tools/generated/tool-ids.ts +++ b/apps/sim/tools/generated/tool-ids.ts @@ -3,7 +3,7 @@ /** Every registered tool id, including versioned variants. */ const toolIds: string[] = JSON.parse( - '["a2a_cancel_task","a2a_get_agent_card","a2a_get_task","a2a_send_message","affinity_batch_update_entity_fields","affinity_batch_update_list_entry_fields","affinity_create_list","affinity_create_list_field_dropdown_option","affinity_create_merge","affinity_create_note","affinity_create_reminder","affinity_delete_list_field_dropdown_option","affinity_delete_note","affinity_get_company","affinity_get_current_user","affinity_get_entity_field_value","affinity_get_list","affinity_get_list_entry","affinity_get_list_entry_field","affinity_get_list_field_dropdown_option","affinity_get_merge","affinity_get_merge_task","affinity_get_note","affinity_get_opportunity","affinity_get_person","affinity_get_saved_view","affinity_get_transcript","affinity_get_user","affinity_list_calls","affinity_list_chat_messages","affinity_list_companies","affinity_list_coworker_connections","affinity_list_emails","affinity_list_entity_field_values","affinity_list_entity_list_entries","affinity_list_entity_lists","affinity_list_entity_notes","affinity_list_entity_relationships","affinity_list_field_dropdown_options","affinity_list_field_metadata","affinity_list_field_value_changes","affinity_list_investor_executive_connections","affinity_list_list_entries","affinity_list_list_entry_field_value_changes","affinity_list_list_entry_fields","affinity_list_list_field_dropdown_options","affinity_list_list_fields","affinity_list_lists","affinity_list_meetings","affinity_list_merge_tasks","affinity_list_merges","affinity_list_note_attached_companies","affinity_list_note_attached_opportunities","affinity_list_note_attached_persons","affinity_list_note_replies","affinity_list_notes","affinity_list_opportunities","affinity_list_persons","affinity_list_reminders","affinity_list_saved_view_entries","affinity_list_saved_views","affinity_list_transcript_fragments","affinity_list_transcripts","affinity_list_users","affinity_search_companies","affinity_search_files","affinity_search_list_entries","affinity_search_notes","affinity_search_persons","affinity_semantic_search","affinity_update_entity_field_value","affinity_update_list_entry_field","affinity_update_list_field_dropdown_option","affinity_update_note","agentmail_create_draft","agentmail_create_inbox","agentmail_delete_draft","agentmail_delete_inbox","agentmail_delete_thread","agentmail_forward_message","agentmail_get_draft","agentmail_get_inbox","agentmail_get_message","agentmail_get_thread","agentmail_list_drafts","agentmail_list_inboxes","agentmail_list_messages","agentmail_list_threads","agentmail_reply_message","agentmail_send_draft","agentmail_send_message","agentmail_update_draft","agentmail_update_inbox","agentmail_update_message","agentmail_update_thread","agentphone_create_call","agentphone_create_contact","agentphone_create_number","agentphone_delete_contact","agentphone_get_call","agentphone_get_call_transcript","agentphone_get_contact","agentphone_get_conversation","agentphone_get_conversation_messages","agentphone_get_number_messages","agentphone_get_usage","agentphone_get_usage_daily","agentphone_get_usage_monthly","agentphone_list_calls","agentphone_list_contacts","agentphone_list_conversations","agentphone_list_numbers","agentphone_react_to_message","agentphone_release_number","agentphone_send_message","agentphone_update_contact","agentphone_update_conversation","agiloft_async_status","agiloft_attach_file","agiloft_attachment_info","agiloft_create_record","agiloft_delete_record","agiloft_get_choice_line_id","agiloft_list_tables","agiloft_lock_record","agiloft_nlp_search","agiloft_read_record","agiloft_remove_attachment","agiloft_retrieve_attachment","agiloft_run_action_button","agiloft_saved_search","agiloft_search_records","agiloft_select_records","agiloft_update_record","agiloft_upsert_record","ahrefs_anchors","ahrefs_backlinks","ahrefs_backlinks_stats","ahrefs_batch_analysis","ahrefs_broken_backlinks","ahrefs_domain_rating","ahrefs_domain_rating_history","ahrefs_keyword_overview","ahrefs_keywords_history","ahrefs_metrics","ahrefs_metrics_history","ahrefs_organic_competitors","ahrefs_organic_keywords","ahrefs_paid_pages","ahrefs_rank_tracker_competitors_overview","ahrefs_rank_tracker_competitors_stats","ahrefs_rank_tracker_overview","ahrefs_rank_tracker_serp_overview","ahrefs_refdomains_history","ahrefs_referring_domains","ahrefs_related_terms","ahrefs_site_audit_page_explorer","ahrefs_top_pages","airtable_create_records","airtable_delete_records","airtable_get_base_schema","airtable_get_record","airtable_list_bases","airtable_list_records","airtable_list_tables","airtable_update_multiple_records","airtable_update_record","airtable_upsert_records","algolia_add_record","algolia_batch_operations","algolia_browse_records","algolia_clear_records","algolia_copy_move_index","algolia_delete_by_filter","algolia_delete_index","algolia_delete_record","algolia_get_record","algolia_get_records","algolia_get_settings","algolia_get_task_status","algolia_list_indices","algolia_partial_update_record","algolia_search","algolia_update_settings","amplitude_event_segmentation","amplitude_funnels","amplitude_get_active_users","amplitude_get_revenue","amplitude_group_identify","amplitude_identify_user","amplitude_list_events","amplitude_realtime_active_users","amplitude_retention","amplitude_send_event","amplitude_user_activity","amplitude_user_profile","amplitude_user_search","apify_get_dataset_items","apify_get_run","apify_run_actor_async","apify_run_actor_sync","apify_run_task","apollo_account_bulk_create","apollo_account_bulk_update","apollo_account_create","apollo_account_search","apollo_account_update","apollo_contact_bulk_create","apollo_contact_bulk_update","apollo_contact_create","apollo_contact_search","apollo_contact_update","apollo_email_accounts","apollo_opportunity_create","apollo_opportunity_get","apollo_opportunity_search","apollo_opportunity_update","apollo_organization_bulk_enrich","apollo_organization_enrich","apollo_organization_search","apollo_people_bulk_enrich","apollo_people_enrich","apollo_people_search","apollo_sequence_add_contacts","apollo_sequence_search","apollo_task_create","apollo_task_search","appconfig_create_application","appconfig_create_configuration_profile","appconfig_create_environment","appconfig_create_hosted_configuration_version","appconfig_delete_application","appconfig_delete_configuration_profile","appconfig_delete_environment","appconfig_delete_hosted_configuration_version","appconfig_get_application","appconfig_get_configuration","appconfig_get_configuration_profile","appconfig_get_deployment","appconfig_get_environment","appconfig_get_hosted_configuration_version","appconfig_list_applications","appconfig_list_configuration_profiles","appconfig_list_deployment_strategies","appconfig_list_deployments","appconfig_list_environments","appconfig_list_hosted_configuration_versions","appconfig_start_deployment","appconfig_stop_deployment","appconfig_update_application","appconfig_update_configuration_profile","appconfig_update_environment","arxiv_get_author_papers","arxiv_get_paper","arxiv_search","asana_add_comment","asana_add_followers","asana_create_project","asana_create_section","asana_create_subtask","asana_create_task","asana_delete_task","asana_get_project","asana_get_projects","asana_get_task","asana_list_sections","asana_list_workspaces","asana_search_tasks","asana_update_task","ashby_add_candidate_tag","ashby_anonymize_candidate","ashby_change_application_source","ashby_change_application_stage","ashby_create_application","ashby_create_candidate","ashby_create_note","ashby_delete_application","ashby_get_application","ashby_get_candidate","ashby_get_job","ashby_get_job_posting","ashby_get_offer","ashby_get_opening","ashby_list_application_feedback","ashby_list_application_history","ashby_list_applications","ashby_list_archive_reasons","ashby_list_candidate_tags","ashby_list_candidates","ashby_list_custom_fields","ashby_list_departments","ashby_list_interview_plans","ashby_list_interview_stages","ashby_list_interviews","ashby_list_job_postings","ashby_list_jobs","ashby_list_locations","ashby_list_notes","ashby_list_offers","ashby_list_openings","ashby_list_sources","ashby_list_users","ashby_remove_candidate_tag","ashby_search_candidates","ashby_search_jobs","ashby_search_openings","ashby_search_users","ashby_set_custom_field_value","ashby_set_custom_field_values","ashby_transfer_application","ashby_update_candidate","ashby_upload_candidate_file","ashby_upload_resume","athena_batch_get_named_query","athena_batch_get_prepared_statement","athena_batch_get_query_execution","athena_create_named_query","athena_create_prepared_statement","athena_delete_named_query","athena_delete_prepared_statement","athena_get_data_catalog","athena_get_database","athena_get_named_query","athena_get_prepared_statement","athena_get_query_execution","athena_get_query_results","athena_get_query_runtime_statistics","athena_get_table_metadata","athena_get_work_group","athena_list_data_catalogs","athena_list_databases","athena_list_named_queries","athena_list_prepared_statements","athena_list_query_executions","athena_list_table_metadata","athena_list_work_groups","athena_start_query","athena_stop_query","athena_update_named_query","athena_update_prepared_statement","attio_assert_record","attio_create_attribute","attio_create_comment","attio_create_list","attio_create_list_entry","attio_create_note","attio_create_object","attio_create_record","attio_create_task","attio_create_webhook","attio_delete_comment","attio_delete_list_entry","attio_delete_note","attio_delete_record","attio_delete_task","attio_delete_webhook","attio_get_attribute","attio_get_comment","attio_get_list","attio_get_list_entry","attio_get_member","attio_get_note","attio_get_object","attio_get_record","attio_get_task","attio_get_thread","attio_get_webhook","attio_list_attributes","attio_list_lists","attio_list_members","attio_list_notes","attio_list_objects","attio_list_records","attio_list_tasks","attio_list_threads","attio_list_webhooks","attio_query_list_entries","attio_search_records","attio_update_attribute","attio_update_list","attio_update_list_entry","attio_update_object","attio_update_record","attio_update_task","attio_update_webhook","azure_data_explorer_create_table","azure_data_explorer_drop_table","azure_data_explorer_ingest_from_query","azure_data_explorer_ingest_inline","azure_data_explorer_list_databases","azure_data_explorer_list_functions","azure_data_explorer_list_tables","azure_data_explorer_management","azure_data_explorer_query","azure_data_explorer_show_database_schema","azure_data_explorer_show_ingestion_failures","azure_data_explorer_show_operations","azure_data_explorer_show_table_details","azure_data_explorer_show_table_schema","azure_devops_add_comment","azure_devops_create_work_item","azure_devops_get_build_log","azure_devops_get_build_timeline","azure_devops_get_comments","azure_devops_get_pipeline","azure_devops_get_pipeline_run","azure_devops_get_work_item","azure_devops_get_work_items_batch","azure_devops_get_work_items_between_builds","azure_devops_list_build_logs","azure_devops_list_builds","azure_devops_list_pipeline_runs","azure_devops_list_pipelines","azure_devops_query_work_items","azure_devops_update_work_item","bitbucket_approve_pull_request","bitbucket_create_branch","bitbucket_create_pull_request","bitbucket_create_pull_request_comment","bitbucket_decline_pull_request","bitbucket_delete_branch","bitbucket_get_commit","bitbucket_get_file","bitbucket_get_file_metadata","bitbucket_get_pipeline","bitbucket_get_pipeline_step_log","bitbucket_get_pull_request","bitbucket_get_pull_request_diff","bitbucket_get_pull_request_diffstat","bitbucket_get_pull_request_merge_task_status","bitbucket_get_repository","bitbucket_list_branches","bitbucket_list_commits","bitbucket_list_directory","bitbucket_list_pipeline_steps","bitbucket_list_pipelines","bitbucket_list_pull_request_comments","bitbucket_list_pull_request_commit_statuses","bitbucket_list_pull_requests","bitbucket_list_repositories","bitbucket_list_workspaces","bitbucket_merge_pull_request","bitbucket_request_pull_request_changes","bitbucket_stop_pipeline","bitbucket_trigger_pipeline","box_copy_file","box_create_folder","box_delete_file","box_delete_folder","box_download_file","box_download_file_v2","box_get_file_info","box_list_folder_items","box_search","box_sign_cancel_request","box_sign_create_request","box_sign_get_request","box_sign_list_requests","box_sign_resend_request","box_update_file","box_upload_file","brandfetch_get_brand","brandfetch_search","brex_archive_budget","brex_create_budget","brex_create_spend_limit","brex_create_transfer","brex_create_vendor","brex_get_budget","brex_get_cash_account","brex_get_company","brex_get_current_user","brex_get_expense","brex_get_spend_limit","brex_get_transfer","brex_get_user","brex_get_vendor","brex_list_budgets","brex_list_card_accounts","brex_list_card_statements","brex_list_card_transactions","brex_list_cards","brex_list_cash_accounts","brex_list_cash_statements","brex_list_cash_transactions","brex_list_departments","brex_list_expenses","brex_list_locations","brex_list_spend_limits","brex_list_titles","brex_list_transfers","brex_list_users","brex_list_vendors","brex_match_receipt","brex_update_expense","brex_update_vendor","brex_upload_receipt","brightdata_cancel_snapshot","brightdata_discover","brightdata_download_snapshot","brightdata_scrape_dataset","brightdata_scrape_url","brightdata_serp_search","brightdata_snapshot_status","brightdata_sync_scrape","browser_use_run_task","buffer_create_idea","buffer_create_post","buffer_delete_post","buffer_edit_post","buffer_get_account","buffer_get_aggregated_post_metrics","buffer_get_channel","buffer_get_channels","buffer_get_daily_posting_limits","buffer_get_idea_groups","buffer_get_ideas","buffer_get_post","buffer_get_posts","calcom_cancel_booking","calcom_confirm_booking","calcom_create_booking","calcom_create_event_type","calcom_create_schedule","calcom_decline_booking","calcom_delete_event_type","calcom_delete_schedule","calcom_get_booking","calcom_get_default_schedule","calcom_get_event_type","calcom_get_schedule","calcom_get_slots","calcom_list_bookings","calcom_list_event_types","calcom_list_schedules","calcom_reschedule_booking","calcom_update_event_type","calcom_update_schedule","calendly_cancel_event","calendly_create_event_invitee","calendly_create_invitee_no_show","calendly_create_scheduling_link","calendly_create_webhook","calendly_delete_invitee_no_show","calendly_delete_webhook","calendly_get_current_user","calendly_get_event_invitee","calendly_get_event_type","calendly_get_scheduled_event","calendly_get_user","calendly_list_event_invitees","calendly_list_event_type_available_times","calendly_list_event_types","calendly_list_organization_memberships","calendly_list_routing_form_submissions","calendly_list_routing_forms","calendly_list_scheduled_events","calendly_list_user_availability_schedules","calendly_list_user_busy_times","calendly_list_webhooks","cbinsights_chat","cbinsights_get_commercial_maturity_history","cbinsights_get_exit_probability_history","cbinsights_get_mosaic_history","cbinsights_get_org_business_relationships","cbinsights_get_org_funding_window","cbinsights_get_org_fundings","cbinsights_get_org_investments","cbinsights_get_org_management_and_board","cbinsights_get_org_outlook","cbinsights_get_org_portfolio_exits","cbinsights_get_org_revenue","cbinsights_get_scouting_report","cbinsights_get_strategy_map","cbinsights_list_business_relationships","cbinsights_list_funding_window","cbinsights_list_fundings","cbinsights_list_investments","cbinsights_list_management_and_board","cbinsights_list_outlook","cbinsights_list_portfolio_exits","cbinsights_list_revenue","cbinsights_lookup_organizations","cbinsights_rag","cbinsights_search_firmographics","checkr_add_report_tag","checkr_apply_report_review_action","checkr_cancel_adverse_action","checkr_cancel_continuous_check","checkr_cancel_invitation","checkr_cancel_subscription","checkr_complete_report","checkr_create_adverse_action","checkr_create_candidate","checkr_create_continuous_check","checkr_create_geo","checkr_create_invitation","checkr_create_report","checkr_create_subscription","checkr_delete_candidate_pii","checkr_delete_geo","checkr_get_account","checkr_get_adverse_action","checkr_get_candidate","checkr_get_continuous_check","checkr_get_document","checkr_get_geo","checkr_get_invitation","checkr_get_node","checkr_get_package","checkr_get_program","checkr_get_report","checkr_get_report_eta","checkr_get_report_progressive_status","checkr_get_report_tags","checkr_get_screening","checkr_get_subscription","checkr_get_verification","checkr_list_adverse_actions","checkr_list_adverse_items","checkr_list_assessments","checkr_list_candidate_documents","checkr_list_candidates","checkr_list_continuous_checks","checkr_list_counties","checkr_list_geos","checkr_list_invitations","checkr_list_nodes","checkr_list_packages","checkr_list_programs","checkr_list_report_addresses","checkr_list_subscriptions","checkr_list_users","checkr_list_verifications","checkr_remove_report_tag","checkr_set_report_tags","checkr_update_candidate","checkr_update_continuous_check","checkr_update_geo","checkr_update_report","checkr_update_subscription","circleback_add_tag_to_meetings","circleback_create_tag","circleback_delete_action_item","circleback_delete_meeting","circleback_delete_tag","circleback_get_company","circleback_get_meeting","circleback_get_person","circleback_get_transcript","circleback_list_action_items","circleback_list_calendar_events","circleback_list_companies","circleback_list_meetings","circleback_list_people","circleback_list_tags","circleback_remove_tag_from_meetings","circleback_search_meetings","circleback_update_action_item","circleback_update_meeting","circleback_update_tag","clay_populate","clerk_add_organization_member","clerk_ban_user","clerk_create_actor_token","clerk_create_allowlist_identifier","clerk_create_blocklist_identifier","clerk_create_organization","clerk_create_organization_invitation","clerk_create_user","clerk_delete_allowlist_identifier","clerk_delete_blocklist_identifier","clerk_delete_organization","clerk_delete_user","clerk_get_jwt_template","clerk_get_organization","clerk_get_session","clerk_get_user","clerk_get_user_oauth_token","clerk_list_allowlist_identifiers","clerk_list_blocklist_identifiers","clerk_list_jwt_templates","clerk_list_organization_invitations","clerk_list_organization_memberships","clerk_list_organizations","clerk_list_sessions","clerk_list_users","clerk_lock_user","clerk_remove_organization_member","clerk_revoke_actor_token","clerk_revoke_session","clerk_unban_user","clerk_unlock_user","clerk_update_organization","clerk_update_organization_membership","clerk_update_user","clickhouse_count_rows","clickhouse_create_database","clickhouse_create_table","clickhouse_delete","clickhouse_describe_table","clickhouse_drop_database","clickhouse_drop_partition","clickhouse_drop_table","clickhouse_execute","clickhouse_insert","clickhouse_insert_rows","clickhouse_introspect","clickhouse_kill_query","clickhouse_list_clusters","clickhouse_list_databases","clickhouse_list_mutations","clickhouse_list_partitions","clickhouse_list_running_queries","clickhouse_list_tables","clickhouse_optimize_table","clickhouse_query","clickhouse_rename_table","clickhouse_show_create_table","clickhouse_table_stats","clickhouse_truncate_table","clickhouse_update","clickup_add_tag_to_task","clickup_create_checklist","clickup_create_checklist_item","clickup_create_comment","clickup_create_folder","clickup_create_list","clickup_create_task","clickup_create_time_entry","clickup_delete_checklist","clickup_delete_checklist_item","clickup_delete_comment","clickup_delete_task","clickup_delete_time_entry","clickup_get_comments","clickup_get_custom_fields","clickup_get_folders","clickup_get_list_members","clickup_get_lists","clickup_get_running_timer","clickup_get_space_tags","clickup_get_spaces","clickup_get_task","clickup_get_task_members","clickup_get_tasks","clickup_get_time_entries","clickup_get_workspaces","clickup_remove_custom_field_value","clickup_remove_tag_from_task","clickup_search_tasks","clickup_set_custom_field_value","clickup_start_timer","clickup_stop_timer","clickup_update_checklist","clickup_update_checklist_item","clickup_update_comment","clickup_update_task","clickup_update_time_entry","clickup_upload_attachment","cloudflare_create_access_application","cloudflare_create_access_group","cloudflare_create_access_policy","cloudflare_create_access_service_token","cloudflare_create_dns_record","cloudflare_create_r2_bucket","cloudflare_create_rate_limit_rule","cloudflare_create_ruleset","cloudflare_create_ruleset_rule","cloudflare_create_tunnel","cloudflare_create_worker_route","cloudflare_create_zone","cloudflare_delete_access_application","cloudflare_delete_access_group","cloudflare_delete_access_policy","cloudflare_delete_dns_record","cloudflare_delete_r2_bucket","cloudflare_delete_r2_bucket_cors","cloudflare_delete_ruleset","cloudflare_delete_ruleset_rule","cloudflare_delete_tunnel","cloudflare_delete_worker_route","cloudflare_delete_worker_script","cloudflare_delete_zone","cloudflare_dns_analytics","cloudflare_get_access_application","cloudflare_get_access_group","cloudflare_get_access_policy","cloudflare_get_access_service_token","cloudflare_get_dns_record","cloudflare_get_r2_bucket","cloudflare_get_r2_bucket_cors","cloudflare_get_r2_bucket_lifecycle","cloudflare_get_ruleset","cloudflare_get_ruleset_entrypoint","cloudflare_get_tunnel","cloudflare_get_tunnel_configuration","cloudflare_get_tunnel_token","cloudflare_get_worker_route","cloudflare_get_worker_script_settings","cloudflare_get_zone","cloudflare_get_zone_settings","cloudflare_list_access_applications","cloudflare_list_access_groups","cloudflare_list_access_identity_providers","cloudflare_list_access_policies","cloudflare_list_access_service_tokens","cloudflare_list_certificates","cloudflare_list_dns_records","cloudflare_list_managed_ruleset_overrides","cloudflare_list_r2_buckets","cloudflare_list_rate_limit_rules","cloudflare_list_rulesets","cloudflare_list_tunnels","cloudflare_list_worker_routes","cloudflare_list_worker_scripts","cloudflare_list_zones","cloudflare_purge_cache","cloudflare_refresh_access_service_token","cloudflare_revoke_access_service_token","cloudflare_rotate_access_service_token","cloudflare_update_access_application","cloudflare_update_access_group","cloudflare_update_access_policy","cloudflare_update_access_service_token","cloudflare_update_dns_record","cloudflare_update_r2_bucket_cors","cloudflare_update_r2_bucket_lifecycle","cloudflare_update_rate_limit_rule","cloudflare_update_ruleset","cloudflare_update_ruleset_rule","cloudflare_update_tunnel","cloudflare_update_tunnel_configuration","cloudflare_update_worker_route","cloudflare_update_zone","cloudflare_update_zone_setting","cloudformation_cancel_update_stack","cloudformation_create_change_set","cloudformation_create_stack","cloudformation_delete_stack","cloudformation_describe_change_set","cloudformation_describe_stack_drift_detection_status","cloudformation_describe_stack_events","cloudformation_describe_stacks","cloudformation_detect_stack_drift","cloudformation_execute_change_set","cloudformation_get_template","cloudformation_get_template_summary","cloudformation_list_stack_resources","cloudformation_update_stack","cloudformation_validate_template","cloudtrail_cancel_query","cloudtrail_describe_query","cloudtrail_describe_trails","cloudtrail_get_event_data_store","cloudtrail_get_event_selectors","cloudtrail_get_insight_selectors","cloudtrail_get_query_results","cloudtrail_get_trail","cloudtrail_get_trail_status","cloudtrail_list_event_data_stores","cloudtrail_list_tags","cloudtrail_list_trails","cloudtrail_lookup_events","cloudtrail_start_query","cloudwatch_describe_alarm_history","cloudwatch_describe_alarms","cloudwatch_describe_log_groups","cloudwatch_describe_log_streams","cloudwatch_filter_log_events","cloudwatch_get_log_events","cloudwatch_get_metric_statistics","cloudwatch_list_metrics","cloudwatch_mute_alarm","cloudwatch_put_log_group_retention","cloudwatch_put_metric_data","cloudwatch_query_logs","cloudwatch_unmute_alarm","coda_add_custom_domain","coda_add_permission","coda_change_user_role","coda_create_doc","coda_create_folder","coda_create_page","coda_delete_custom_domain","coda_delete_doc","coda_delete_folder","coda_delete_page","coda_delete_page_content","coda_delete_permission","coda_delete_row","coda_delete_rows","coda_export_page","coda_get_acl_settings","coda_get_analytics_last_updated","coda_get_column","coda_get_control","coda_get_custom_domain_provider","coda_get_doc","coda_get_doc_analytics_summary","coda_get_folder","coda_get_formula","coda_get_mutation_status","coda_get_page","coda_get_page_content","coda_get_page_export_status","coda_get_row","coda_get_sharing_metadata","coda_get_table","coda_list_categories","coda_list_columns","coda_list_controls","coda_list_custom_domains","coda_list_doc_analytics","coda_list_docs","coda_list_folder_children","coda_list_folders","coda_list_formulas","coda_list_page_analytics","coda_list_pages","coda_list_permissions","coda_list_rows","coda_list_tables","coda_list_workspace_members","coda_list_workspace_roles","coda_publish_doc","coda_push_button","coda_resolve_browser_link","coda_search_principals","coda_trigger_automation","coda_unpublish_doc","coda_update_acl_settings","coda_update_doc","coda_update_folder","coda_update_page","coda_update_row","coda_upsert_rows","coda_whoami","codepipeline_disable_stage_transition","codepipeline_enable_stage_transition","codepipeline_get_pipeline","codepipeline_get_pipeline_execution","codepipeline_get_pipeline_state","codepipeline_list_action_executions","codepipeline_list_pipeline_executions","codepipeline_list_pipelines","codepipeline_put_approval_result","codepipeline_retry_stage_execution","codepipeline_start_execution","codepipeline_stop_execution","confluence_add_label","confluence_create_blogpost","confluence_create_comment","confluence_create_page","confluence_create_page_property","confluence_create_space","confluence_create_space_property","confluence_delete_attachment","confluence_delete_blogpost","confluence_delete_comment","confluence_delete_label","confluence_delete_page","confluence_delete_page_property","confluence_delete_space","confluence_delete_space_property","confluence_get_blogpost","confluence_get_page_ancestors","confluence_get_page_children","confluence_get_page_descendants","confluence_get_page_version","confluence_get_pages_by_label","confluence_get_space","confluence_get_task","confluence_get_user","confluence_list_attachments","confluence_list_blogposts","confluence_list_blogposts_in_space","confluence_list_comments","confluence_list_labels","confluence_list_page_properties","confluence_list_page_versions","confluence_list_pages_in_space","confluence_list_space_labels","confluence_list_space_permissions","confluence_list_space_properties","confluence_list_spaces","confluence_list_tasks","confluence_retrieve","confluence_search","confluence_search_in_space","confluence_update","confluence_update_blogpost","confluence_update_comment","confluence_update_space","confluence_update_task","confluence_upload_attachment","context_dev_classify_naics","context_dev_classify_sic","context_dev_crawl","context_dev_extract","context_dev_extract_product","context_dev_extract_products","context_dev_get_brand","context_dev_get_brand_by_email","context_dev_get_brand_by_name","context_dev_get_brand_by_ticker","context_dev_identify_transaction","context_dev_map","context_dev_scrape_fonts","context_dev_scrape_html","context_dev_scrape_images","context_dev_scrape_markdown","context_dev_scrape_styleguide","context_dev_screenshot","context_dev_search","convex_action","convex_document_deltas","convex_list_documents","convex_list_tables","convex_mutation","convex_query","convex_run_function","crowdstrike_create_indicators","crowdstrike_delete_indicators","crowdstrike_delete_rtr_session","crowdstrike_execute_rtr_command","crowdstrike_get_alert_details","crowdstrike_get_case_details","crowdstrike_get_host_group_details","crowdstrike_get_indicator_details","crowdstrike_get_rtr_command_status","crowdstrike_get_sensor_aggregates","crowdstrike_get_sensor_details","crowdstrike_get_vulnerability_details","crowdstrike_init_rtr_session","crowdstrike_perform_host_action","crowdstrike_perform_host_group_action","crowdstrike_query_alerts","crowdstrike_query_cases","crowdstrike_query_host_groups","crowdstrike_query_indicators","crowdstrike_query_sensors","crowdstrike_query_vulnerabilities","crowdstrike_update_alerts","crowdstrike_update_indicators","crunchbase_autocomplete","crunchbase_get_acquisition","crunchbase_get_entity","crunchbase_get_entity_card","crunchbase_get_fields_metadata","crunchbase_get_funding_round","crunchbase_get_organization","crunchbase_get_person","crunchbase_list_deleted_entities","crunchbase_search_acquisitions","crunchbase_search_entities","crunchbase_search_funding_rounds","crunchbase_search_organizations","crunchbase_search_people","cursor_add_followup","cursor_add_followup_v2","cursor_delete_agent","cursor_delete_agent_v2","cursor_download_artifact","cursor_download_artifact_v2","cursor_get_agent","cursor_get_agent_v2","cursor_get_api_key_info","cursor_get_api_key_info_v2","cursor_get_conversation","cursor_get_conversation_v2","cursor_launch_agent","cursor_launch_agent_v2","cursor_list_agents","cursor_list_agents_v2","cursor_list_artifacts","cursor_list_artifacts_v2","cursor_list_models","cursor_list_models_v2","cursor_list_repositories","cursor_list_repositories_v2","cursor_stop_agent","cursor_stop_agent_v2","dagster_delete_run","dagster_get_asset","dagster_get_run","dagster_get_run_logs","dagster_launch_run","dagster_list_assets","dagster_list_jobs","dagster_list_runs","dagster_list_schedules","dagster_list_sensors","dagster_materialize_assets","dagster_reexecute_run","dagster_report_asset_materialization","dagster_start_schedule","dagster_start_sensor","dagster_stop_schedule","dagster_stop_sensor","dagster_terminate_run","dagster_wipe_asset","databricks_cancel_all_runs","databricks_cancel_run","databricks_cancel_statement","databricks_create_cluster","databricks_create_job","databricks_create_warehouse","databricks_delete_cluster","databricks_delete_job","databricks_delete_run","databricks_delete_warehouse","databricks_edit_cluster","databricks_edit_warehouse","databricks_execute_sql","databricks_genie_agent_ask","databricks_genie_agent_cancel","databricks_genie_agent_list_items","databricks_genie_ask","databricks_genie_create_space","databricks_genie_delete_conversation","databricks_genie_delete_message","databricks_genie_delete_space","databricks_genie_download_visualization","databricks_genie_execute_query","databricks_genie_get_message","databricks_genie_get_query_result","databricks_genie_get_space","databricks_genie_list_conversations","databricks_genie_list_messages","databricks_genie_list_spaces","databricks_genie_send_feedback","databricks_genie_update_space","databricks_get_cluster","databricks_get_job","databricks_get_run","databricks_get_run_output","databricks_get_statement","databricks_get_statement_chunk","databricks_get_warehouse","databricks_list_clusters","databricks_list_jobs","databricks_list_runs","databricks_list_warehouses","databricks_repair_run","databricks_reset_job","databricks_resize_cluster","databricks_restart_cluster","databricks_run_job","databricks_start_cluster","databricks_start_warehouse","databricks_stop_warehouse","databricks_submit_run","databricks_terminate_cluster","databricks_update_job","datadog_add_incident_todo","datadog_cancel_downtime","datadog_create_dashboard","datadog_create_downtime","datadog_create_event","datadog_create_incident","datadog_create_monitor","datadog_create_slo","datadog_delete_dashboard","datadog_delete_slo","datadog_get_browser_synthetics_results","datadog_get_dashboard","datadog_get_incident","datadog_get_monitor","datadog_get_security_signal","datadog_get_slo","datadog_get_slo_history","datadog_get_synthetics_results","datadog_get_synthetics_test","datadog_list_dashboards","datadog_list_downtimes","datadog_list_incidents","datadog_list_monitors","datadog_list_security_rules","datadog_list_security_signals","datadog_list_services","datadog_list_slos","datadog_list_synthetics_tests","datadog_mute_monitor","datadog_query_logs","datadog_query_timeseries","datadog_search_spans","datadog_send_logs","datadog_submit_metrics","datadog_trigger_synthetics_tests","datadog_unmute_monitor","datadog_update_incident","datadog_update_security_signal_assignee","datadog_update_security_signal_state","datadog_update_slo","datadog_update_synthetics_status","datagma_enrich_company","datagma_enrich_person","datagma_find_email","datagma_find_phone","datagma_get_credits","daytona_create_sandbox","daytona_delete_sandbox","daytona_download_file","daytona_execute_command","daytona_get_sandbox","daytona_git_clone","daytona_list_files","daytona_list_sandboxes","daytona_run_code","daytona_start_sandbox","daytona_stop_sandbox","daytona_upload_file","deployed_block_executor","deployments_deploy","deployments_get_version","deployments_list_versions","deployments_promote","deployments_undeploy","devin_append_session_tags","devin_archive_session","devin_create_session","devin_get_session","devin_get_session_tags","devin_list_session_attachments","devin_list_session_messages","devin_list_sessions","devin_replace_session_tags","devin_send_message","devin_terminate_session","discord_add_reaction","discord_archive_thread","discord_assign_role","discord_ban_member","discord_bulk_delete_messages","discord_create_channel","discord_create_invite","discord_create_role","discord_create_thread","discord_create_webhook","discord_delete_channel","discord_delete_invite","discord_delete_message","discord_delete_role","discord_delete_webhook","discord_edit_message","discord_execute_webhook","discord_get_channel","discord_get_invite","discord_get_member","discord_get_messages","discord_get_pinned_messages","discord_get_server","discord_get_user","discord_get_webhook","discord_join_thread","discord_kick_member","discord_leave_thread","discord_list_channels","discord_list_roles","discord_pin_message","discord_remove_reaction","discord_remove_role","discord_send_message","discord_unban_member","discord_unpin_message","discord_update_channel","discord_update_member","discord_update_role","docusign_create_from_template","docusign_download_document","docusign_get_envelope","docusign_list_envelopes","docusign_list_recipients","docusign_list_templates","docusign_send_envelope","docusign_void_envelope","downdetector_get_company","downdetector_get_company_attribution","downdetector_get_company_baseline","downdetector_get_company_events","downdetector_get_company_incidents","downdetector_get_company_indicators","downdetector_get_company_last_15","downdetector_get_company_status","downdetector_get_provider","downdetector_get_reports","downdetector_get_site_companies","downdetector_list_categories","downdetector_list_incidents","downdetector_list_sites","downdetector_search_companies","dropbox_copy","dropbox_create_folder","dropbox_create_shared_link","dropbox_delete","dropbox_download","dropbox_download_v2","dropbox_get_metadata","dropbox_list_folder","dropbox_list_revisions","dropbox_list_shared_links","dropbox_move","dropbox_restore","dropbox_search","dropbox_upload","dropcontact_enrich_contact","dspy_chain_of_thought","dspy_predict","dspy_react","dub_bulk_create_links","dub_bulk_delete_links","dub_bulk_update_links","dub_create_link","dub_create_tag","dub_delete_link","dub_get_analytics","dub_get_events","dub_get_link","dub_get_links_count","dub_get_qr_code","dub_get_qr_code_v2","dub_list_domains","dub_list_folders","dub_list_links","dub_list_tags","dub_update_link","dub_upsert_link","duckduckgo_search","dynamodb_delete","dynamodb_get","dynamodb_introspect","dynamodb_put","dynamodb_query","dynamodb_scan","dynamodb_update","dynatrace_add_problem_comment","dynatrace_add_tags","dynatrace_close_problem","dynatrace_create_settings_object","dynatrace_create_slo","dynatrace_delete_problem_comment","dynatrace_delete_settings_object","dynatrace_delete_slo","dynatrace_delete_tag","dynatrace_execute_synthetic_monitors","dynatrace_get_attack","dynatrace_get_audit_logs","dynatrace_get_entity","dynatrace_get_event","dynatrace_get_metric","dynatrace_get_problem","dynatrace_get_problem_comment","dynatrace_get_security_problem","dynatrace_get_settings_object","dynatrace_get_slo","dynatrace_get_synthetic_batch","dynatrace_ingest_event","dynatrace_ingest_logs","dynatrace_ingest_metrics","dynatrace_list_attacks","dynatrace_list_entities","dynatrace_list_entity_types","dynatrace_list_events","dynatrace_list_metrics","dynatrace_list_problem_comments","dynatrace_list_problems","dynatrace_list_remediation_items","dynatrace_list_security_problems","dynatrace_list_settings_objects","dynatrace_list_settings_schemas","dynatrace_list_slos","dynatrace_list_synthetic_monitors","dynatrace_list_tags","dynatrace_mute_security_problem","dynatrace_mute_security_problems","dynatrace_query_metrics","dynatrace_search_logs","dynatrace_unmute_security_problem","dynatrace_unmute_security_problems","dynatrace_update_problem_comment","dynatrace_update_settings_object","dynatrace_update_slo","elasticsearch_bulk","elasticsearch_cluster_health","elasticsearch_cluster_stats","elasticsearch_count","elasticsearch_create_index","elasticsearch_delete_document","elasticsearch_delete_index","elasticsearch_get_document","elasticsearch_get_index","elasticsearch_index_document","elasticsearch_list_indices","elasticsearch_search","elasticsearch_update_document","elevenlabs_audio_isolation","elevenlabs_edit_voice_settings","elevenlabs_get_user","elevenlabs_get_voice","elevenlabs_get_voice_settings","elevenlabs_list_models","elevenlabs_list_voices","elevenlabs_sound_effects","elevenlabs_speech_to_speech","elevenlabs_tts","emailbison_attach_leads_to_campaign","emailbison_attach_tags_to_leads","emailbison_create_campaign","emailbison_create_lead","emailbison_create_tag","emailbison_get_lead","emailbison_list_campaigns","emailbison_list_leads","emailbison_list_replies","emailbison_list_tags","emailbison_update_campaign","emailbison_update_campaign_status","emailbison_update_lead","embeddings_cohere","embeddings_gemini","embeddings_mistral","embeddings_ollama","embeddings_openai","embeddings_openrouter","enrich_check_credits","enrich_company_funding","enrich_company_lookup","enrich_company_revenue","enrich_disposable_email_check","enrich_email_to_ip","enrich_email_to_person_lite","enrich_email_to_phone","enrich_email_to_profile","enrich_find_email","enrich_get_post_details","enrich_ip_to_company","enrich_linkedin_profile","enrich_linkedin_to_personal_email","enrich_linkedin_to_work_email","enrich_phone_finder","enrich_reverse_hash_lookup","enrich_sales_pointer_people","enrich_search_company","enrich_search_company_activities","enrich_search_company_employees","enrich_search_jobs","enrich_search_logo","enrich_search_people","enrich_search_people_activities","enrich_search_post_comments","enrich_search_post_comments_by_url","enrich_search_post_reactions","enrich_search_post_reactions_by_url","enrich_search_posts","enrich_search_similar_companies","enrich_verify_email","enrichment_run","enrow_find_email","enrow_verify_email","exa_agent","exa_answer","exa_find_similar_links","exa_get_contents","exa_search","extend_parser","extend_parser_v2","fathom_get_summary","fathom_get_transcript","fathom_list_meeting_types","fathom_list_meetings","fathom_list_team_members","fathom_list_teams","file_append","file_compress","file_create_folder","file_decompress","file_delete_folder","file_edit","file_fetch","file_get","file_get_content","file_list","file_manage_sharing","file_move","file_parser","file_parser_v2","file_parser_v3","file_read","file_restore_folder","file_search","file_update_folder","file_write","findymail_find_email_from_linkedin","findymail_find_email_from_name","findymail_find_emails_by_domain","findymail_find_employees","findymail_find_phone","findymail_get_company","findymail_get_credits","findymail_lookup_technologies","findymail_reverse_email_lookup","findymail_search_technologies","findymail_verify_email","firecrawl_agent","firecrawl_batch_scrape","firecrawl_batch_scrape_status","firecrawl_cancel_crawl","firecrawl_crawl","firecrawl_crawl_status","firecrawl_credit_usage","firecrawl_extract","firecrawl_extract_status","firecrawl_map","firecrawl_parse","firecrawl_scrape","firecrawl_search","fireflies_add_to_live_meeting","fireflies_create_bite","fireflies_delete_transcript","fireflies_get_transcript","fireflies_get_user","fireflies_list_bites","fireflies_list_contacts","fireflies_list_transcripts","fireflies_list_users","fireflies_upload_audio","fivetran_cancel_transformation","fivetran_create_connect_card","fivetran_create_connection","fivetran_create_destination","fivetran_create_group","fivetran_delete_connection","fivetran_get_account_info","fivetran_get_connection","fivetran_get_connection_schema_config","fivetran_get_connection_warnings","fivetran_get_connector_type","fivetran_get_destination","fivetran_get_group","fivetran_get_sync_history","fivetran_get_transformation","fivetran_list_connections","fivetran_list_connector_types","fivetran_list_destinations","fivetran_list_groups","fivetran_list_transformations","fivetran_list_users","fivetran_reload_connection_schema","fivetran_resync_connection","fivetran_resync_tables","fivetran_run_connection_setup_tests","fivetran_run_destination_setup_tests","fivetran_run_transformation","fivetran_sync_connection","fivetran_update_connection","fivetran_update_connection_schema","fivetran_update_connection_table","fivetran_update_schema_config","flint_create_task","flint_generate_pages","flint_get_task","function_execute","gamma_check_status","gamma_generate","gamma_generate_from_template","gamma_list_folders","gamma_list_themes","github_add_assignees","github_add_assignees_v2","github_add_labels","github_add_labels_v2","github_cancel_workflow_run","github_cancel_workflow_run_v2","github_check_star","github_check_star_v2","github_close_issue","github_close_issue_v2","github_close_pr","github_close_pr_v2","github_comment","github_comment_v2","github_compare_commits","github_compare_commits_v2","github_create_branch","github_create_branch_v2","github_create_comment_reaction","github_create_comment_reaction_v2","github_create_file","github_create_file_v2","github_create_gist","github_create_gist_v2","github_create_issue","github_create_issue_reaction","github_create_issue_reaction_v2","github_create_issue_v2","github_create_milestone","github_create_milestone_v2","github_create_pr","github_create_pr_review","github_create_pr_review_v2","github_create_pr_v2","github_create_project","github_create_project_v2","github_create_release","github_create_release_v2","github_delete_branch","github_delete_branch_v2","github_delete_comment","github_delete_comment_reaction","github_delete_comment_reaction_v2","github_delete_comment_v2","github_delete_file","github_delete_file_v2","github_delete_gist","github_delete_gist_v2","github_delete_issue_reaction","github_delete_issue_reaction_v2","github_delete_milestone","github_delete_milestone_v2","github_delete_project","github_delete_project_v2","github_delete_release","github_delete_release_v2","github_fork_gist","github_fork_gist_v2","github_fork_repo","github_fork_repo_v2","github_get_branch","github_get_branch_protection","github_get_branch_protection_v2","github_get_branch_v2","github_get_commit","github_get_commit_v2","github_get_file_content","github_get_file_content_v2","github_get_gist","github_get_gist_v2","github_get_issue","github_get_issue_v2","github_get_latest_release","github_get_latest_release_v2","github_get_milestone","github_get_milestone_v2","github_get_pr_files","github_get_pr_files_v2","github_get_project","github_get_project_v2","github_get_readme","github_get_readme_v2","github_get_release","github_get_release_v2","github_get_tree","github_get_tree_v2","github_get_workflow","github_get_workflow_run","github_get_workflow_run_v2","github_get_workflow_v2","github_issue_comment","github_issue_comment_v2","github_job_logs","github_latest_commit","github_latest_commit_v2","github_list_branches","github_list_branches_v2","github_list_commits","github_list_commits_v2","github_list_forks","github_list_forks_v2","github_list_gists","github_list_gists_v2","github_list_issue_comments","github_list_issue_comments_v2","github_list_issues","github_list_issues_v2","github_list_milestones","github_list_milestones_v2","github_list_pr_comments","github_list_pr_comments_v2","github_list_projects","github_list_projects_v2","github_list_prs","github_list_prs_v2","github_list_releases","github_list_releases_v2","github_list_review_threads","github_list_stargazers","github_list_stargazers_v2","github_list_tags","github_list_tags_v2","github_list_workflow_runs","github_list_workflow_runs_v2","github_list_workflows","github_list_workflows_v2","github_merge_pr","github_merge_pr_v2","github_pr","github_pr_v2","github_remove_label","github_remove_label_v2","github_reply_review_thread","github_repo_info","github_repo_info_v2","github_request_reviewers","github_request_reviewers_v2","github_rerun_workflow","github_rerun_workflow_v2","github_resolve_review_thread","github_search_code","github_search_code_v2","github_search_commits","github_search_commits_v2","github_search_issues","github_search_issues_v2","github_search_repos","github_search_repos_v2","github_search_users","github_search_users_v2","github_star_gist","github_star_gist_v2","github_star_repo","github_star_repo_v2","github_status_check_rollup","github_trigger_workflow","github_trigger_workflow_v2","github_unstar_gist","github_unstar_gist_v2","github_unstar_repo","github_unstar_repo_v2","github_update_branch_protection","github_update_branch_protection_v2","github_update_comment","github_update_comment_v2","github_update_file","github_update_file_v2","github_update_gist","github_update_gist_v2","github_update_issue","github_update_issue_v2","github_update_milestone","github_update_milestone_v2","github_update_pr","github_update_pr_v2","github_update_project","github_update_project_v2","github_update_release","github_update_release_v2","gitlab_activate_user","gitlab_add_member","gitlab_add_saml_group_link","gitlab_approve_access_request","gitlab_approve_merge_request","gitlab_approve_user","gitlab_ban_user","gitlab_block_user","gitlab_cancel_pipeline","gitlab_compare_branches","gitlab_create_branch","gitlab_create_file","gitlab_create_issue","gitlab_create_issue_note","gitlab_create_merge_request","gitlab_create_merge_request_note","gitlab_create_pipeline","gitlab_create_release","gitlab_create_user","gitlab_deactivate_user","gitlab_delete_branch","gitlab_delete_issue","gitlab_delete_saml_group_link","gitlab_delete_user","gitlab_delete_user_identity","gitlab_deny_access_request","gitlab_get_file","gitlab_get_group","gitlab_get_issue","gitlab_get_job_log","gitlab_get_merge_request","gitlab_get_merge_request_changes","gitlab_get_pipeline","gitlab_get_project","gitlab_invite_member","gitlab_list_access_requests","gitlab_list_branches","gitlab_list_commits","gitlab_list_groups","gitlab_list_invitations","gitlab_list_issues","gitlab_list_members","gitlab_list_merge_requests","gitlab_list_pipeline_jobs","gitlab_list_pipelines","gitlab_list_projects","gitlab_list_releases","gitlab_list_repository_tree","gitlab_list_saml_group_links","gitlab_list_user_memberships","gitlab_merge_merge_request","gitlab_play_job","gitlab_reject_user","gitlab_remove_member","gitlab_retry_pipeline","gitlab_revoke_invitation","gitlab_search_users","gitlab_unban_user","gitlab_unblock_user","gitlab_update_file","gitlab_update_invitation","gitlab_update_issue","gitlab_update_member","gitlab_update_merge_request","gitlab_update_user","gmail_add_label","gmail_add_label_v2","gmail_archive","gmail_archive_v2","gmail_create_label_v2","gmail_delete","gmail_delete_draft_v2","gmail_delete_label_v2","gmail_delete_v2","gmail_draft","gmail_draft_v2","gmail_edit_draft_v2","gmail_get_draft_v2","gmail_get_thread_v2","gmail_list_drafts_v2","gmail_list_labels_v2","gmail_list_threads_v2","gmail_mark_read","gmail_mark_read_v2","gmail_mark_unread","gmail_mark_unread_v2","gmail_move","gmail_move_v2","gmail_read","gmail_read_v2","gmail_remove_label","gmail_remove_label_v2","gmail_search","gmail_search_v2","gmail_send","gmail_send_v2","gmail_trash_thread_v2","gmail_unarchive","gmail_unarchive_v2","gmail_untrash_thread_v2","gmail_update_label_v2","gong_aggregate_activity","gong_aggregate_by_period","gong_answered_scorecards","gong_ask_anything","gong_assign_flow_prospects","gong_create_call","gong_day_by_day_activity","gong_get_brief","gong_get_call","gong_get_call_transcript","gong_get_coaching","gong_get_extensive_calls","gong_get_folder_content","gong_get_logs","gong_get_prospect_flows","gong_get_user","gong_interaction_stats","gong_list_calls","gong_list_flows","gong_list_library_folders","gong_list_scorecards","gong_list_trackers","gong_list_users","gong_list_workspaces","gong_lookup_email","gong_lookup_phone","gong_purge_email_address","gong_purge_phone_number","gong_unassign_flow_prospects","google_ads_ad_performance","google_ads_campaign_performance","google_ads_list_ad_groups","google_ads_list_campaigns","google_ads_list_customers","google_ads_search","google_appsheet_add_rows","google_appsheet_delete_rows","google_appsheet_edit_rows","google_appsheet_find_rows","google_bigquery_create_dataset","google_bigquery_create_table","google_bigquery_delete_dataset","google_bigquery_delete_table","google_bigquery_get_query_results","google_bigquery_get_table","google_bigquery_insert_rows","google_bigquery_list_datasets","google_bigquery_list_table_data","google_bigquery_list_tables","google_bigquery_query","google_books_volume_details","google_books_volume_search","google_calendar_create","google_calendar_create_calendar","google_calendar_create_calendar_v2","google_calendar_create_v2","google_calendar_delete","google_calendar_delete_calendar","google_calendar_delete_calendar_v2","google_calendar_delete_v2","google_calendar_freebusy","google_calendar_freebusy_v2","google_calendar_get","google_calendar_get_v2","google_calendar_instances","google_calendar_instances_v2","google_calendar_invite","google_calendar_invite_v2","google_calendar_list","google_calendar_list_acl","google_calendar_list_acl_v2","google_calendar_list_calendars","google_calendar_list_calendars_v2","google_calendar_list_v2","google_calendar_move","google_calendar_move_v2","google_calendar_quick_add","google_calendar_quick_add_v2","google_calendar_respond","google_calendar_respond_v2","google_calendar_share_calendar","google_calendar_share_calendar_v2","google_calendar_unshare_calendar","google_calendar_unshare_calendar_v2","google_calendar_update","google_calendar_update_acl","google_calendar_update_acl_v2","google_calendar_update_calendar","google_calendar_update_calendar_v2","google_calendar_update_v2","google_contacts_create","google_contacts_delete","google_contacts_get","google_contacts_list","google_contacts_search","google_contacts_update","google_docs_create","google_docs_create_named_range","google_docs_create_paragraph_bullets","google_docs_delete_content_range","google_docs_delete_named_range","google_docs_delete_paragraph_bullets","google_docs_insert_image","google_docs_insert_page_break","google_docs_insert_table","google_docs_insert_text","google_docs_read","google_docs_replace_text","google_docs_update_paragraph_style","google_docs_update_text_style","google_docs_write","google_drive_copy","google_drive_create_comment","google_drive_create_folder","google_drive_delete","google_drive_delete_comment","google_drive_download","google_drive_export","google_drive_get_about","google_drive_get_content","google_drive_get_file","google_drive_get_revision","google_drive_list","google_drive_list_comments","google_drive_list_permissions","google_drive_list_revisions","google_drive_move","google_drive_search","google_drive_share","google_drive_trash","google_drive_unshare","google_drive_untrash","google_drive_update","google_drive_upload","google_forms_batch_update","google_forms_create_form","google_forms_create_watch","google_forms_delete_watch","google_forms_get_form","google_forms_get_responses","google_forms_list_watches","google_forms_renew_watch","google_forms_set_publish_settings","google_groups_add_alias","google_groups_add_member","google_groups_create_group","google_groups_delete_group","google_groups_get_group","google_groups_get_member","google_groups_get_settings","google_groups_has_member","google_groups_list_aliases","google_groups_list_groups","google_groups_list_members","google_groups_remove_alias","google_groups_remove_member","google_groups_update_group","google_groups_update_member","google_groups_update_settings","google_maps_air_quality","google_maps_directions","google_maps_distance_matrix","google_maps_elevation","google_maps_geocode","google_maps_geolocate","google_maps_place_details","google_maps_places_nearby","google_maps_places_search","google_maps_pollen","google_maps_reverse_geocode","google_maps_snap_to_roads","google_maps_solar","google_maps_speed_limits","google_maps_timezone","google_maps_validate_address","google_meet_create_space","google_meet_end_conference","google_meet_get_conference_record","google_meet_get_space","google_meet_list_conference_records","google_meet_list_participants","google_pagespeed_analyze","google_search","google_sheets_append","google_sheets_append_v2","google_sheets_batch_clear_v2","google_sheets_batch_get_v2","google_sheets_batch_update_v2","google_sheets_clear_v2","google_sheets_copy_sheet_v2","google_sheets_create_spreadsheet_v2","google_sheets_delete_rows_v2","google_sheets_delete_sheet_v2","google_sheets_delete_spreadsheet_v2","google_sheets_get_spreadsheet_v2","google_sheets_read","google_sheets_read_v2","google_sheets_update","google_sheets_update_v2","google_sheets_write","google_sheets_write_v2","google_slides_add_image","google_slides_add_slide","google_slides_batch_update","google_slides_copy_presentation","google_slides_create","google_slides_create_line","google_slides_create_paragraph_bullets","google_slides_create_shape","google_slides_create_sheets_chart","google_slides_create_table","google_slides_create_video","google_slides_delete_object","google_slides_delete_paragraph_bullets","google_slides_delete_table_column","google_slides_delete_table_row","google_slides_delete_text","google_slides_duplicate_object","google_slides_export_presentation","google_slides_get_page","google_slides_get_thumbnail","google_slides_group_objects","google_slides_insert_table_columns","google_slides_insert_table_rows","google_slides_insert_text","google_slides_merge_table_cells","google_slides_read","google_slides_refresh_sheets_chart","google_slides_replace_all_shapes_with_image","google_slides_replace_all_shapes_with_sheets_chart","google_slides_replace_all_text","google_slides_replace_image","google_slides_reroute_line","google_slides_ungroup_objects","google_slides_unmerge_table_cells","google_slides_update_image_properties","google_slides_update_line_category","google_slides_update_line_properties","google_slides_update_page_element_alt_text","google_slides_update_page_element_transform","google_slides_update_page_elements_z_order","google_slides_update_page_properties","google_slides_update_paragraph_style","google_slides_update_shape_properties","google_slides_update_slide_properties","google_slides_update_slides_position","google_slides_update_table_border_properties","google_slides_update_table_cell_properties","google_slides_update_table_column_properties","google_slides_update_table_row_properties","google_slides_update_text_style","google_slides_update_video_properties","google_slides_write","google_tasks_create","google_tasks_delete","google_tasks_get","google_tasks_list","google_tasks_list_task_lists","google_tasks_update","google_translate_detect","google_translate_text","google_vault_add_held_accounts","google_vault_add_matters_permissions","google_vault_close_matters","google_vault_create_matters","google_vault_create_matters_export","google_vault_create_matters_holds","google_vault_create_saved_query","google_vault_delete_matters","google_vault_delete_matters_export","google_vault_delete_matters_holds","google_vault_delete_saved_query","google_vault_download_export_file","google_vault_list_matters","google_vault_list_matters_export","google_vault_list_matters_holds","google_vault_list_saved_queries","google_vault_remove_held_accounts","google_vault_remove_matters_permissions","google_vault_reopen_matters","google_vault_undelete_matters","google_vault_update_matters","google_vault_update_matters_holds","grafana_check_data_source_health","grafana_create_alert_rule","grafana_create_annotation","grafana_create_contact_point","grafana_create_dashboard","grafana_create_folder","grafana_delete_alert_rule","grafana_delete_annotation","grafana_delete_contact_point","grafana_delete_dashboard","grafana_delete_folder","grafana_get_alert_rule","grafana_get_alert_rule_group","grafana_get_dashboard","grafana_get_data_source","grafana_get_folder","grafana_get_health","grafana_list_alert_rules","grafana_list_annotations","grafana_list_contact_points","grafana_list_dashboards","grafana_list_data_sources","grafana_list_folders","grafana_move_folder","grafana_query_data_source","grafana_update_alert_rule","grafana_update_annotation","grafana_update_contact_point","grafana_update_dashboard","grafana_update_folder","grain_create_hook","grain_create_hook_v2","grain_delete_hook","grain_delete_hook_v2","grain_get_recording","grain_get_transcript","grain_list_hooks","grain_list_hooks_v2","grain_list_meeting_types","grain_list_recordings","grain_list_teams","grain_list_views","granola_create_webhook_endpoint","granola_delete_webhook_endpoint","granola_get_note","granola_get_transcript","granola_list_audit_events","granola_list_folders","granola_list_notes","granola_list_webhook_endpoints","granola_update_webhook_endpoint","greenhouse_apply_candidate_tag_v2","greenhouse_convert_prospect_v2","greenhouse_create_application_v2","greenhouse_create_attachment_v2","greenhouse_create_candidate_tag_v2","greenhouse_create_candidate_v2","greenhouse_create_note_v2","greenhouse_delete_application_v2","greenhouse_delete_attachment_v2","greenhouse_delete_candidate_v2","greenhouse_get_application","greenhouse_get_application_v2","greenhouse_get_candidate","greenhouse_get_candidate_v2","greenhouse_get_job","greenhouse_get_job_v2","greenhouse_get_user","greenhouse_get_user_v2","greenhouse_hire_application_v2","greenhouse_list_application_stages_v2","greenhouse_list_applications","greenhouse_list_applications_v2","greenhouse_list_applied_candidate_tags_v2","greenhouse_list_attachments_v2","greenhouse_list_candidate_educations_v2","greenhouse_list_candidate_employments_v2","greenhouse_list_candidate_tags_v2","greenhouse_list_candidates","greenhouse_list_candidates_v2","greenhouse_list_close_reasons_v2","greenhouse_list_custom_field_options_v2","greenhouse_list_custom_fields_v2","greenhouse_list_departments","greenhouse_list_departments_v2","greenhouse_list_email_templates_v2","greenhouse_list_interviews_v2","greenhouse_list_job_hiring_managers_v2","greenhouse_list_job_interview_stages_v2","greenhouse_list_job_owners_v2","greenhouse_list_job_stages","greenhouse_list_jobs","greenhouse_list_jobs_v2","greenhouse_list_notes_v2","greenhouse_list_offers_v2","greenhouse_list_offices","greenhouse_list_offices_v2","greenhouse_list_openings_v2","greenhouse_list_prospect_pool_stages_v2","greenhouse_list_prospect_pools_v2","greenhouse_list_referrers_v2","greenhouse_list_rejection_reasons_v2","greenhouse_list_scorecards_v2","greenhouse_list_sources_v2","greenhouse_list_users","greenhouse_list_users_v2","greenhouse_move_application_v2","greenhouse_reject_application_v2","greenhouse_remove_candidate_tag_v2","greenhouse_unreject_application_v2","greenhouse_update_application_v2","greenhouse_update_candidate_v2","greptile_index_repo","greptile_query","greptile_search","greptile_status","guardrails_validate","harmonic_batch_get_people","harmonic_clear_people_saved_search_net_new_results","harmonic_enrich_person","harmonic_get_company_employees","harmonic_get_email_enrichment_job","harmonic_get_email_enrichment_usage","harmonic_get_enrichment_status","harmonic_get_people_saved_search_net_new_results","harmonic_get_people_saved_search_results","harmonic_get_person","harmonic_list_people_saved_searches","harmonic_search_people_scout","harmonic_submit_email_enrichment_job","helpscout_assign_conversation","helpscout_create_conversation","helpscout_create_customer","helpscout_create_customer_thread","helpscout_create_note","helpscout_create_reply","helpscout_delete_conversation","helpscout_get_conversation","helpscout_get_current_user","helpscout_get_customer","helpscout_get_organization","helpscout_get_saved_reply","helpscout_list_conversations","helpscout_list_custom_fields","helpscout_list_customer_properties","helpscout_list_customers","helpscout_list_folders","helpscout_list_mailboxes","helpscout_list_organizations","helpscout_list_saved_replies","helpscout_list_tags","helpscout_list_teams","helpscout_list_threads","helpscout_list_users","helpscout_list_workflows","helpscout_move_conversation","helpscout_run_workflow","helpscout_set_conversation_tags","helpscout_snooze_conversation","helpscout_unassign_conversation","helpscout_unsnooze_conversation","helpscout_update_conversation_customer","helpscout_update_conversation_status","helpscout_update_conversation_subject","helpscout_update_custom_fields","helpscout_update_customer","helpscout_update_customer_properties","hex_cancel_run","hex_create_collection","hex_create_group","hex_deactivate_user","hex_delete_group","hex_get_collection","hex_get_data_connection","hex_get_group","hex_get_project","hex_get_project_runs","hex_get_queried_tables","hex_get_run_status","hex_list_collections","hex_list_data_connections","hex_list_groups","hex_list_projects","hex_list_users","hex_run_project","hex_update_collection","hex_update_group","hex_update_project","http_request","hubspot_add_list_memberships","hubspot_create_appointment","hubspot_create_association","hubspot_create_company","hubspot_create_contact","hubspot_create_deal","hubspot_create_email","hubspot_create_line_item","hubspot_create_list","hubspot_create_note","hubspot_create_ticket","hubspot_delete_association","hubspot_delete_company","hubspot_delete_contact","hubspot_delete_deal","hubspot_delete_line_item","hubspot_delete_ticket","hubspot_get_appointment","hubspot_get_association_labels","hubspot_get_cart","hubspot_get_company","hubspot_get_contact","hubspot_get_deal","hubspot_get_email","hubspot_get_line_item","hubspot_get_list","hubspot_get_list_memberships","hubspot_get_marketing_event","hubspot_get_note","hubspot_get_properties","hubspot_get_quote","hubspot_get_ticket","hubspot_get_users","hubspot_list_appointments","hubspot_list_associations","hubspot_list_carts","hubspot_list_companies","hubspot_list_contacts","hubspot_list_deals","hubspot_list_emails","hubspot_list_line_items","hubspot_list_lists","hubspot_list_marketing_events","hubspot_list_notes","hubspot_list_owners","hubspot_list_quotes","hubspot_list_tickets","hubspot_remove_list_memberships","hubspot_search_companies","hubspot_search_contacts","hubspot_search_deals","hubspot_search_emails","hubspot_search_line_items","hubspot_search_notes","hubspot_search_quotes","hubspot_search_tickets","hubspot_update_appointment","hubspot_update_company","hubspot_update_contact","hubspot_update_deal","hubspot_update_line_item","hubspot_update_ticket","huggingface_chat","hunter_companies_find","hunter_discover","hunter_domain_search","hunter_email_count","hunter_email_finder","hunter_email_verifier","iam_add_user_to_group","iam_attach_role_policy","iam_attach_user_policy","iam_create_access_key","iam_create_role","iam_create_user","iam_delete_access_key","iam_delete_role","iam_delete_user","iam_detach_role_policy","iam_detach_user_policy","iam_get_policy","iam_get_role","iam_get_user","iam_list_access_keys","iam_list_attached_role_policies","iam_list_attached_user_policies","iam_list_groups","iam_list_policies","iam_list_roles","iam_list_users","iam_remove_user_from_group","iam_simulate_principal_policy","iam_update_access_key","icypeas_find_email","icypeas_verify_email","identity_center_check_assignment_deletion_status","identity_center_check_assignment_status","identity_center_create_account_assignment","identity_center_delete_account_assignment","identity_center_describe_account","identity_center_describe_group","identity_center_describe_user","identity_center_get_group","identity_center_get_user","identity_center_list_account_assignments","identity_center_list_accounts","identity_center_list_assignments_for_account","identity_center_list_group_memberships","identity_center_list_groups","identity_center_list_instances","identity_center_list_permission_sets","image_generate","incidentio_actions_create","incidentio_actions_list","incidentio_actions_show","incidentio_actions_update","incidentio_alert_events_create","incidentio_alerts_list","incidentio_alerts_resolve","incidentio_alerts_show","incidentio_catalog_entries_list","incidentio_catalog_types_list","incidentio_custom_fields_create","incidentio_custom_fields_delete","incidentio_custom_fields_list","incidentio_custom_fields_show","incidentio_custom_fields_update","incidentio_escalation_paths_create","incidentio_escalation_paths_delete","incidentio_escalation_paths_list","incidentio_escalation_paths_show","incidentio_escalation_paths_update","incidentio_escalations_cancel","incidentio_escalations_create","incidentio_escalations_list","incidentio_escalations_show","incidentio_follow_ups_create","incidentio_follow_ups_list","incidentio_follow_ups_show","incidentio_follow_ups_update","incidentio_incident_alerts_list","incidentio_incident_memberships_create","incidentio_incident_memberships_revoke","incidentio_incident_participants_list","incidentio_incident_roles_create","incidentio_incident_roles_delete","incidentio_incident_roles_list","incidentio_incident_roles_show","incidentio_incident_roles_update","incidentio_incident_statuses_list","incidentio_incident_timestamps_list","incidentio_incident_timestamps_show","incidentio_incident_types_list","incidentio_incident_updates_list","incidentio_incidents_create","incidentio_incidents_list","incidentio_incidents_show","incidentio_incidents_update","incidentio_on_call_now","incidentio_schedule_entries_list","incidentio_schedule_overrides_create","incidentio_schedule_overrides_list","incidentio_schedules_create","incidentio_schedules_delete","incidentio_schedules_list","incidentio_schedules_show","incidentio_schedules_update","incidentio_severities_list","incidentio_teams_list","incidentio_teams_show","incidentio_users_list","incidentio_users_show","incidentio_workflows_create","incidentio_workflows_delete","incidentio_workflows_list","incidentio_workflows_show","incidentio_workflows_update","infisical_create_secret","infisical_delete_secret","infisical_get_secret","infisical_list_secrets","infisical_update_secret","instagram_delete_comment","instagram_download_media","instagram_get_account_insights","instagram_get_container_status","instagram_get_conversation_messages","instagram_get_media","instagram_get_media_insights","instagram_get_message","instagram_get_profile","instagram_get_publishing_limit","instagram_hide_comment","instagram_list_comments","instagram_list_conversations","instagram_list_media","instagram_list_stories","instagram_private_reply","instagram_publish_carousel","instagram_publish_image","instagram_publish_reel","instagram_publish_story","instagram_publish_video","instagram_reply_to_comment","instagram_send_text_message","instagram_set_comments_enabled","instantly_activate_campaign","instantly_create_campaign","instantly_create_lead","instantly_create_lead_list","instantly_delete_campaign","instantly_delete_leads","instantly_get_lead","instantly_list_campaigns","instantly_list_emails","instantly_list_lead_lists","instantly_list_leads","instantly_patch_campaign","instantly_patch_lead","instantly_pause_campaign","instantly_reply_to_email","instantly_update_lead_interest_status","intercom_assign_conversation_v2","intercom_attach_contact_to_company_v2","intercom_close_conversation_v2","intercom_create_company","intercom_create_company_v2","intercom_create_contact","intercom_create_contact_v2","intercom_create_event_v2","intercom_create_message","intercom_create_message_v2","intercom_create_note_v2","intercom_create_tag_v2","intercom_create_ticket","intercom_create_ticket_v2","intercom_delete_contact","intercom_delete_contact_v2","intercom_detach_contact_from_company_v2","intercom_get_company","intercom_get_company_v2","intercom_get_contact","intercom_get_contact_v2","intercom_get_conversation","intercom_get_conversation_v2","intercom_get_ticket","intercom_get_ticket_v2","intercom_list_admins_v2","intercom_list_companies","intercom_list_companies_v2","intercom_list_contacts","intercom_list_contacts_v2","intercom_list_conversations","intercom_list_conversations_v2","intercom_list_tags_v2","intercom_open_conversation_v2","intercom_reply_conversation","intercom_reply_conversation_v2","intercom_search_contacts","intercom_search_contacts_v2","intercom_search_conversations","intercom_search_conversations_v2","intercom_snooze_conversation_v2","intercom_tag_contact_v2","intercom_tag_conversation_v2","intercom_untag_contact_v2","intercom_update_contact","intercom_update_contact_v2","intercom_update_ticket_v2","intune_get_compliance_policy","intune_get_detected_app","intune_get_device","intune_get_device_configuration","intune_list_app_devices","intune_list_compliance_policies","intune_list_compliance_policy_device_statuses","intune_list_detected_apps","intune_list_device_configurations","intune_list_devices","intune_reboot_device","intune_remote_lock_device","intune_retire_device","intune_sync_device","jina_read_url","jina_search","jira_add_attachment","jira_add_comment","jira_add_watcher","jira_add_worklog","jira_assign_issue","jira_bulk_read","jira_create_issue_link","jira_delete_attachment","jira_delete_comment","jira_delete_issue","jira_delete_issue_link","jira_delete_worklog","jira_get_attachments","jira_get_comments","jira_get_fields","jira_get_project","jira_get_transitions","jira_get_users","jira_get_worklogs","jira_list_issue_types","jira_list_projects","jira_remove_watcher","jira_retrieve","jira_search_issues","jira_search_users","jira_transition_issue","jira_update","jira_update_comment","jira_update_worklog","jira_write","jotform_add_label_resources","jotform_clone_form","jotform_create_form","jotform_create_label","jotform_create_question","jotform_create_questions","jotform_create_report","jotform_create_submission","jotform_create_submissions","jotform_create_webhook","jotform_delete_form","jotform_delete_label","jotform_delete_question","jotform_delete_report","jotform_delete_submission","jotform_delete_webhook","jotform_get_form","jotform_get_form_properties","jotform_get_history","jotform_get_label","jotform_get_question","jotform_get_report","jotform_get_settings","jotform_get_submission","jotform_get_usage","jotform_get_user","jotform_list_form_files","jotform_list_form_reports","jotform_list_form_submissions","jotform_list_forms","jotform_list_label_resources","jotform_list_labels","jotform_list_questions","jotform_list_reports","jotform_list_submissions","jotform_list_subusers","jotform_list_webhooks","jotform_remove_label_resources","jotform_update_form_properties","jotform_update_label","jotform_update_question","jotform_update_settings","jotform_update_submission","jsm_add_comment","jsm_add_customer","jsm_add_organization","jsm_add_participants","jsm_answer_approval","jsm_attach_form","jsm_copy_forms","jsm_create_object","jsm_create_organization","jsm_create_request","jsm_delete_form","jsm_delete_object","jsm_externalise_form","jsm_get_approvals","jsm_get_comments","jsm_get_customers","jsm_get_form","jsm_get_form_answers","jsm_get_form_structure","jsm_get_form_templates","jsm_get_issue_forms","jsm_get_object","jsm_get_object_schema","jsm_get_object_type_attributes","jsm_get_organizations","jsm_get_participants","jsm_get_queues","jsm_get_request","jsm_get_request_type_fields","jsm_get_request_types","jsm_get_requests","jsm_get_service_desks","jsm_get_sla","jsm_get_transitions","jsm_internalise_form","jsm_list_object_schemas","jsm_list_object_types","jsm_reopen_form","jsm_save_form_answers","jsm_search_objects_aql","jsm_submit_form","jsm_transition_request","jsm_update_object","jupyter_copy_content","jupyter_create_file","jupyter_create_session","jupyter_delete_content","jupyter_delete_session","jupyter_get_content","jupyter_get_content_v2","jupyter_interrupt_kernel","jupyter_list_contents","jupyter_list_kernels","jupyter_list_kernelspecs","jupyter_list_sessions","jupyter_rename_content","jupyter_restart_kernel","jupyter_start_kernel","jupyter_stop_kernel","jupyter_upload_file","kalshi_amend_order","kalshi_amend_order_v2","kalshi_cancel_order","kalshi_cancel_order_v2","kalshi_create_order","kalshi_create_order_v2","kalshi_get_balance","kalshi_get_balance_v2","kalshi_get_candlesticks","kalshi_get_candlesticks_v2","kalshi_get_event","kalshi_get_event_candlesticks","kalshi_get_event_candlesticks_v2","kalshi_get_event_v2","kalshi_get_events","kalshi_get_events_v2","kalshi_get_exchange_announcements","kalshi_get_exchange_announcements_v2","kalshi_get_exchange_schedule","kalshi_get_exchange_schedule_v2","kalshi_get_exchange_status","kalshi_get_exchange_status_v2","kalshi_get_fills","kalshi_get_fills_v2","kalshi_get_market","kalshi_get_market_v2","kalshi_get_markets","kalshi_get_markets_v2","kalshi_get_order","kalshi_get_order_v2","kalshi_get_orderbook","kalshi_get_orderbook_v2","kalshi_get_orders","kalshi_get_orders_v2","kalshi_get_positions","kalshi_get_positions_v2","kalshi_get_series_by_ticker","kalshi_get_series_by_ticker_v2","kalshi_get_series_list","kalshi_get_series_list_v2","kalshi_get_settlements","kalshi_get_settlements_v2","kalshi_get_trades","kalshi_get_trades_v2","ketch_get_consent","ketch_get_subscriptions","ketch_invoke_right","ketch_set_consent","ketch_set_subscriptions","knowledge_create_document","knowledge_delete_chunk","knowledge_delete_document","knowledge_get_connector","knowledge_get_document","knowledge_list_chunks","knowledge_list_connectors","knowledge_list_documents","knowledge_list_tags","knowledge_search","knowledge_trigger_sync","knowledge_update_chunk","knowledge_upload_chunk","knowledge_upsert_document","lambda_add_permission","lambda_create_alias","lambda_create_event_source_mapping","lambda_create_function","lambda_create_function_url_config","lambda_delete_alias","lambda_delete_event_source_mapping","lambda_delete_function","lambda_delete_function_concurrency","lambda_delete_function_event_invoke_config","lambda_delete_function_url_config","lambda_delete_provisioned_concurrency_config","lambda_get_account_settings","lambda_get_alias","lambda_get_event_source_mapping","lambda_get_function","lambda_get_function_concurrency","lambda_get_function_configuration","lambda_get_function_event_invoke_config","lambda_get_function_recursion_config","lambda_get_function_url_config","lambda_get_layer_version","lambda_get_policy","lambda_get_provisioned_concurrency_config","lambda_get_runtime_management_config","lambda_invoke","lambda_list_aliases","lambda_list_event_source_mappings","lambda_list_function_event_invoke_configs","lambda_list_function_url_configs","lambda_list_functions","lambda_list_layer_versions","lambda_list_layers","lambda_list_provisioned_concurrency_configs","lambda_list_tags","lambda_list_versions_by_function","lambda_publish_version","lambda_put_function_concurrency","lambda_put_function_event_invoke_config","lambda_put_function_recursion_config","lambda_put_provisioned_concurrency_config","lambda_put_runtime_management_config","lambda_remove_permission","lambda_tag_resource","lambda_untag_resource","lambda_update_alias","lambda_update_event_source_mapping","lambda_update_function_code","lambda_update_function_configuration","lambda_update_function_url_config","langsmith_create_feedback","langsmith_create_run","langsmith_create_runs_batch","langsmith_get_run","langsmith_update_run","latex_compile","latex_get_package","latex_list_fonts","latex_search_packages","launchdarkly_create_flag","launchdarkly_delete_flag","launchdarkly_get_audit_log","launchdarkly_get_flag","launchdarkly_get_flag_status","launchdarkly_list_environments","launchdarkly_list_flags","launchdarkly_list_members","launchdarkly_list_projects","launchdarkly_list_segments","launchdarkly_toggle_flag","launchdarkly_update_flag","leadmagic_company_search","leadmagic_email_to_profile","leadmagic_find_email","leadmagic_find_mobile","leadmagic_get_credits","leadmagic_profile_search","leadmagic_profile_to_email","leadmagic_role_finder","leadmagic_validate_email","lemlist_get_activities","lemlist_get_lead","lemlist_send_email","linear_add_label_to_issue","linear_add_label_to_project","linear_archive_issue","linear_archive_label","linear_archive_project","linear_create_attachment","linear_create_comment","linear_create_customer","linear_create_customer_request","linear_create_customer_status","linear_create_customer_tier","linear_create_cycle","linear_create_favorite","linear_create_issue","linear_create_issue_relation","linear_create_label","linear_create_project","linear_create_project_label","linear_create_project_milestone","linear_create_project_status","linear_create_project_update","linear_create_workflow_state","linear_delete_attachment","linear_delete_comment","linear_delete_customer","linear_delete_customer_status","linear_delete_customer_tier","linear_delete_issue","linear_delete_issue_relation","linear_delete_project","linear_delete_project_label","linear_delete_project_milestone","linear_delete_project_status","linear_get_active_cycle","linear_get_customer","linear_get_cycle","linear_get_issue","linear_get_project","linear_get_viewer","linear_list_attachments","linear_list_comments","linear_list_customer_requests","linear_list_customer_statuses","linear_list_customer_tiers","linear_list_customers","linear_list_cycles","linear_list_favorites","linear_list_issue_relations","linear_list_labels","linear_list_notifications","linear_list_project_labels","linear_list_project_milestones","linear_list_project_statuses","linear_list_project_updates","linear_list_projects","linear_list_teams","linear_list_users","linear_list_workflow_states","linear_merge_customers","linear_read_issues","linear_remove_label_from_issue","linear_remove_label_from_project","linear_search_issues","linear_unarchive_issue","linear_update_attachment","linear_update_comment","linear_update_customer","linear_update_customer_request","linear_update_customer_status","linear_update_customer_tier","linear_update_issue","linear_update_label","linear_update_notification","linear_update_project","linear_update_project_label","linear_update_project_milestone","linear_update_project_status","linear_update_workflow_state","linkedin_get_profile","linkedin_share_post","linkup_search","linq_add_participant","linq_check_imessage","linq_check_rcs","linq_create_attachment","linq_create_chat","linq_create_contact_card","linq_create_webhook_subscription","linq_delete_attachment","linq_delete_message","linq_delete_webhook_subscription","linq_edit_message","linq_get_attachment","linq_get_chat","linq_get_contact_card","linq_get_message","linq_get_webhook_subscription","linq_leave_chat","linq_list_chats","linq_list_messages","linq_list_phone_numbers","linq_list_thread","linq_list_webhook_events","linq_list_webhook_subscriptions","linq_mark_chat_read","linq_react_to_message","linq_remove_participant","linq_send_message","linq_send_voice_memo","linq_share_contact_card","linq_start_typing","linq_stop_typing","linq_update_chat","linq_update_contact_card","linq_update_webhook_subscription","llm_chat","logfire_get_token_info","logfire_get_trace","logfire_query","logfire_search_records","logrocket_create_release","logrocket_get_audit_logs","logrocket_get_highlights","logrocket_identify_user","logrocket_list_exported_sessions","logrocket_request_highlights","logs_get","logs_get_execution","logs_get_run_details","logs_query","logs_query_runs","loops_check_contact_suppression","loops_create_contact","loops_create_contact_property","loops_delete_contact","loops_find_contact","loops_get_transactional_email","loops_list_contact_properties","loops_list_mailing_lists","loops_list_transactional_emails","loops_remove_contact_suppression","loops_send_event","loops_send_transactional_email","loops_update_contact","luma_add_guests","luma_cancel_event","luma_create_event","luma_get_event","luma_get_guest","luma_get_guests","luma_list_events","luma_lookup_event","luma_send_invites","luma_update_event","luma_update_guest_status","mailchimp_add_member","mailchimp_add_member_tags","mailchimp_add_or_update_member","mailchimp_add_segment_member","mailchimp_add_subscriber_to_automation","mailchimp_archive_member","mailchimp_create_audience","mailchimp_create_batch_operation","mailchimp_create_campaign","mailchimp_create_interest","mailchimp_create_interest_category","mailchimp_create_landing_page","mailchimp_create_merge_field","mailchimp_create_segment","mailchimp_create_template","mailchimp_delete_audience","mailchimp_delete_batch_operation","mailchimp_delete_campaign","mailchimp_delete_interest","mailchimp_delete_interest_category","mailchimp_delete_landing_page","mailchimp_delete_member","mailchimp_delete_merge_field","mailchimp_delete_segment","mailchimp_delete_template","mailchimp_get_audience","mailchimp_get_audiences","mailchimp_get_automation","mailchimp_get_automations","mailchimp_get_batch_operation","mailchimp_get_batch_operations","mailchimp_get_campaign","mailchimp_get_campaign_content","mailchimp_get_campaign_report","mailchimp_get_campaign_reports","mailchimp_get_campaigns","mailchimp_get_interest","mailchimp_get_interest_categories","mailchimp_get_interest_category","mailchimp_get_interests","mailchimp_get_landing_page","mailchimp_get_landing_pages","mailchimp_get_member","mailchimp_get_member_tags","mailchimp_get_members","mailchimp_get_merge_field","mailchimp_get_merge_fields","mailchimp_get_segment","mailchimp_get_segment_members","mailchimp_get_segments","mailchimp_get_template","mailchimp_get_templates","mailchimp_pause_automation","mailchimp_publish_landing_page","mailchimp_remove_member_tags","mailchimp_remove_segment_member","mailchimp_replicate_campaign","mailchimp_schedule_campaign","mailchimp_send_campaign","mailchimp_set_campaign_content","mailchimp_start_automation","mailchimp_unarchive_member","mailchimp_unpublish_landing_page","mailchimp_unschedule_campaign","mailchimp_update_audience","mailchimp_update_campaign","mailchimp_update_interest","mailchimp_update_interest_category","mailchimp_update_landing_page","mailchimp_update_member","mailchimp_update_merge_field","mailchimp_update_segment","mailchimp_update_template","mailgun_add_list_member","mailgun_create_mailing_list","mailgun_get_domain","mailgun_get_mailing_list","mailgun_get_message","mailgun_list_domains","mailgun_list_messages","mailgun_send_message","managed_agent_archive_session","managed_agent_create_session","managed_agent_delete_session","managed_agent_get_session","managed_agent_interrupt_session","managed_agent_list_events","managed_agent_respond_custom_tool","managed_agent_respond_tool_confirmation","managed_agent_run_session","managed_agent_send_message","managed_agent_update_session","manageengine_sdp_add_change_note","manageengine_sdp_add_problem_note","manageengine_sdp_add_request_note","manageengine_sdp_create_asset","manageengine_sdp_create_change","manageengine_sdp_create_problem","manageengine_sdp_create_request","manageengine_sdp_create_solution","manageengine_sdp_delete_asset","manageengine_sdp_delete_change","manageengine_sdp_delete_problem","manageengine_sdp_delete_request","manageengine_sdp_delete_solution","manageengine_sdp_get_asset","manageengine_sdp_get_change","manageengine_sdp_get_problem","manageengine_sdp_get_request","manageengine_sdp_get_solution","manageengine_sdp_list_assets","manageengine_sdp_list_change_notes","manageengine_sdp_list_changes","manageengine_sdp_list_problem_notes","manageengine_sdp_list_problems","manageengine_sdp_list_request_notes","manageengine_sdp_list_requests","manageengine_sdp_list_solutions","manageengine_sdp_update_asset","manageengine_sdp_update_change","manageengine_sdp_update_problem","manageengine_sdp_update_request","manageengine_sdp_update_solution","mcp_list_operations","mcp_run_operation","mem0_add_memories","mem0_get_memories","mem0_search_memories","memory_add","memory_delete","memory_get","memory_get_all","microsoft_ad_add_directory_role_member","microsoft_ad_add_group_member","microsoft_ad_add_user_app_role_assignment","microsoft_ad_assign_license","microsoft_ad_create_group","microsoft_ad_create_user","microsoft_ad_delete_group","microsoft_ad_delete_user","microsoft_ad_get_conditional_access_policy","microsoft_ad_get_device","microsoft_ad_get_group","microsoft_ad_get_user","microsoft_ad_list_authentication_methods","microsoft_ad_list_conditional_access_policies","microsoft_ad_list_devices","microsoft_ad_list_directory_audits","microsoft_ad_list_directory_role_members","microsoft_ad_list_directory_roles","microsoft_ad_list_group_members","microsoft_ad_list_groups","microsoft_ad_list_service_principal_app_role_assignments","microsoft_ad_list_service_principals","microsoft_ad_list_sign_ins","microsoft_ad_list_subscribed_skus","microsoft_ad_list_user_app_role_assignments","microsoft_ad_list_user_devices","microsoft_ad_list_user_licenses","microsoft_ad_list_users","microsoft_ad_remove_directory_role_member","microsoft_ad_remove_group_member","microsoft_ad_remove_user_app_role_assignment","microsoft_ad_reset_password","microsoft_ad_revoke_sign_in_sessions","microsoft_ad_set_password","microsoft_ad_update_group","microsoft_ad_update_user","microsoft_dataverse_associate","microsoft_dataverse_create_multiple","microsoft_dataverse_create_record","microsoft_dataverse_delete_record","microsoft_dataverse_disassociate","microsoft_dataverse_download_file","microsoft_dataverse_download_file_v2","microsoft_dataverse_execute_action","microsoft_dataverse_execute_function","microsoft_dataverse_fetchxml_query","microsoft_dataverse_get_entity_metadata","microsoft_dataverse_get_record","microsoft_dataverse_list_records","microsoft_dataverse_search","microsoft_dataverse_update_multiple","microsoft_dataverse_update_record","microsoft_dataverse_upload_file","microsoft_dataverse_upsert_record","microsoft_dataverse_whoami","microsoft_dynamics_365_close_case","microsoft_dynamics_365_close_opportunity","microsoft_dynamics_365_create_record","microsoft_dynamics_365_get_record","microsoft_dynamics_365_list_records","microsoft_dynamics_365_qualify_lead","microsoft_dynamics_365_search_records","microsoft_dynamics_365_update_record","microsoft_excel_calculate","microsoft_excel_clear_range","microsoft_excel_close_session","microsoft_excel_create_session","microsoft_excel_create_table","microsoft_excel_delete_table","microsoft_excel_delete_table_row","microsoft_excel_delete_worksheet","microsoft_excel_format_range","microsoft_excel_get_table","microsoft_excel_get_table_row","microsoft_excel_get_worksheet","microsoft_excel_list_table_rows","microsoft_excel_list_tables","microsoft_excel_list_worksheets","microsoft_excel_read","microsoft_excel_read_v2","microsoft_excel_refresh_session","microsoft_excel_sort_range","microsoft_excel_table_add","microsoft_excel_update_table","microsoft_excel_update_table_row","microsoft_excel_update_worksheet","microsoft_excel_worksheet_add","microsoft_excel_write","microsoft_excel_write_v2","microsoft_planner_create_bucket","microsoft_planner_create_plan","microsoft_planner_create_task","microsoft_planner_delete_bucket","microsoft_planner_delete_plan","microsoft_planner_delete_task","microsoft_planner_get_plan_details","microsoft_planner_get_task_details","microsoft_planner_list_buckets","microsoft_planner_list_plans","microsoft_planner_read_bucket","microsoft_planner_read_plan","microsoft_planner_read_task","microsoft_planner_update_bucket","microsoft_planner_update_plan","microsoft_planner_update_plan_details","microsoft_planner_update_task","microsoft_planner_update_task_details","microsoft_teams_delete_channel_message","microsoft_teams_delete_chat_message","microsoft_teams_get_message","microsoft_teams_list_channel_members","microsoft_teams_list_channels","microsoft_teams_list_chat_members","microsoft_teams_list_chats","microsoft_teams_list_team_members","microsoft_teams_list_teams","microsoft_teams_read_channel","microsoft_teams_read_chat","microsoft_teams_reply_to_message","microsoft_teams_set_reaction","microsoft_teams_unset_reaction","microsoft_teams_update_channel_message","microsoft_teams_update_chat_message","microsoft_teams_write_channel","microsoft_teams_write_chat","microsoft_word_append","microsoft_word_create","microsoft_word_create_from_template","microsoft_word_export_pdf","microsoft_word_list","microsoft_word_read","microsoft_word_replace_text","microsoft_word_update","millionverifier_get_credits","millionverifier_verify_email","mintlify_create_agent_job","mintlify_create_assistant_message","mintlify_detect_ai_prose","mintlify_get_agent_job","mintlify_get_assistant_caller_stats","mintlify_get_assistant_conversations","mintlify_get_feedback","mintlify_get_feedback_by_page","mintlify_get_page_content","mintlify_get_searches","mintlify_get_update_status","mintlify_get_views","mintlify_get_visitors","mintlify_search","mintlify_send_agent_message","mintlify_trigger_automation","mintlify_trigger_preview","mintlify_trigger_update","mistral_parser","mistral_parser_v2","mistral_parser_v3","modal_call_function","modal_chat_completion","modal_list_models","monday_archive_item","monday_change_column_value","monday_create_board","monday_create_column","monday_create_group","monday_create_item","monday_create_subitem","monday_create_update","monday_delete_item","monday_duplicate_item","monday_get_board","monday_get_groups","monday_get_item","monday_get_items","monday_list_boards","monday_move_item_to_group","monday_search_items","monday_update_item","mongodb_delete","mongodb_execute","mongodb_insert","mongodb_introspect","mongodb_query","mongodb_update","mssql_delete","mssql_execute","mssql_insert","mssql_introspect","mssql_query","mssql_update","mysql_delete","mysql_execute","mysql_insert","mysql_introspect","mysql_query","mysql_update","neo4j_create","neo4j_delete","neo4j_execute","neo4j_introspect","neo4j_merge","neo4j_query","neo4j_update","netsuite_attach_record","netsuite_batch_create_records","netsuite_batch_delete_records","netsuite_batch_get_records","netsuite_batch_update_records","netsuite_batch_upsert_records","netsuite_create_record","netsuite_delete_record","netsuite_detach_record","netsuite_execute_action","netsuite_execute_dataset","netsuite_execute_suiteql","netsuite_get_async_result","netsuite_get_async_status","netsuite_get_governance_limits","netsuite_get_record","netsuite_get_record_form","netsuite_get_record_metadata","netsuite_get_select_options","netsuite_get_server_time","netsuite_get_subresource","netsuite_list_datasets","netsuite_list_record_types","netsuite_list_records","netsuite_transform_record","netsuite_update_record","netsuite_upsert_record","neverbounce_get_credits","neverbounce_verify_email","new_relic_create_deployment_event","new_relic_get_entity","new_relic_nrql_query","new_relic_search_entities","notion_add_database_row","notion_add_database_row_v2","notion_append_blocks","notion_append_blocks_v2","notion_create_comment","notion_create_comment_v2","notion_create_database","notion_create_database_v2","notion_create_page","notion_create_page_v2","notion_delete_block","notion_delete_block_v2","notion_list_comments","notion_list_comments_v2","notion_list_users","notion_list_users_v2","notion_query_database","notion_query_database_v2","notion_read","notion_read_database","notion_read_database_v2","notion_read_v2","notion_retrieve_block","notion_retrieve_block_children","notion_retrieve_block_children_v2","notion_retrieve_block_v2","notion_retrieve_user","notion_retrieve_user_v2","notion_search","notion_search_v2","notion_update_block","notion_update_block_v2","notion_update_page","notion_update_page_v2","notion_write","notion_write_v2","obsidian_append_active","obsidian_append_note","obsidian_append_periodic_note","obsidian_create_note","obsidian_delete_note","obsidian_execute_command","obsidian_get_active","obsidian_get_note","obsidian_get_periodic_note","obsidian_list_commands","obsidian_list_files","obsidian_open_file","obsidian_patch_active","obsidian_patch_note","obsidian_search","okta_activate_group_rule","okta_activate_user","okta_add_user_to_group","okta_assign_group_to_app","okta_assign_user_role","okta_assign_user_to_app","okta_clear_user_sessions","okta_create_group","okta_create_group_rule","okta_create_user","okta_deactivate_group_rule","okta_deactivate_user","okta_delete_group","okta_delete_group_rule","okta_delete_user","okta_enroll_factor","okta_get_app","okta_get_factor","okta_get_group","okta_get_group_rule","okta_get_logs","okta_get_session","okta_get_user","okta_list_app_groups","okta_list_app_users","okta_list_apps","okta_list_factors","okta_list_group_members","okta_list_group_rules","okta_list_groups","okta_list_user_roles","okta_list_users","okta_remove_group_from_app","okta_remove_user_from_app","okta_remove_user_from_group","okta_remove_user_role","okta_reset_all_factors","okta_reset_factor","okta_reset_password","okta_revoke_session","okta_suspend_user","okta_unsuspend_user","okta_update_group","okta_update_user","onedrive_copy","onedrive_create_folder","onedrive_create_share_link","onedrive_delete","onedrive_download","onedrive_get_drive_info","onedrive_get_item","onedrive_list","onedrive_move","onedrive_search","onedrive_upload","onepassword_create_item","onepassword_delete_item","onepassword_get_item","onepassword_get_item_file","onepassword_get_vault","onepassword_list_items","onepassword_list_vaults","onepassword_replace_item","onepassword_resolve_secret","onepassword_update_item","openai_embeddings","openai_image","oracle_fusion_financials_apply_receivables_receipt","oracle_fusion_financials_approve_receivables_invoice","oracle_fusion_financials_create_expense_line","oracle_fusion_financials_create_expense_report","oracle_fusion_financials_create_receivables_credit_memo","oracle_fusion_financials_create_receivables_invoice","oracle_fusion_financials_create_receivables_receipt","oracle_fusion_financials_get_expense_line","oracle_fusion_financials_get_expense_report","oracle_fusion_financials_get_gl_journal_batch","oracle_fusion_financials_get_gl_ledger","oracle_fusion_financials_get_payables_invoice","oracle_fusion_financials_get_payables_invoice_line","oracle_fusion_financials_get_payables_payment","oracle_fusion_financials_get_receivables_credit_memo","oracle_fusion_financials_get_receivables_invoice","oracle_fusion_financials_get_receivables_invoice_installment","oracle_fusion_financials_get_receivables_invoice_line","oracle_fusion_financials_get_receivables_receipt","oracle_fusion_financials_list_expense_lines","oracle_fusion_financials_list_expense_reports","oracle_fusion_financials_list_gl_balances","oracle_fusion_financials_list_gl_journal_batches","oracle_fusion_financials_list_gl_ledgers","oracle_fusion_financials_list_payables_invoice_lines","oracle_fusion_financials_list_payables_invoices","oracle_fusion_financials_list_payables_payments","oracle_fusion_financials_list_receivables_credit_memos","oracle_fusion_financials_list_receivables_invoice_installments","oracle_fusion_financials_list_receivables_invoice_lines","oracle_fusion_financials_list_receivables_invoices","oracle_fusion_financials_list_receivables_receipts","oracle_fusion_financials_submit_expense_report","oracle_fusion_financials_update_expense_line","oracle_fusion_financials_update_expense_report","oracle_fusion_financials_update_receivables_invoice","oracledb_delete","oracledb_execute","oracledb_insert","oracledb_introspect","oracledb_query","oracledb_update","otter_create_conversation","otter_get_conversation","otter_get_conversation_audio","otter_get_workspace","otter_list_channel_members","otter_list_channels","otter_list_conversations","otter_list_workspace_conversations","outlook_calendar_create_event","outlook_calendar_delete_event","outlook_calendar_get_event","outlook_calendar_list_events","outlook_calendar_respond","outlook_calendar_update_event","outlook_copy","outlook_create_folder","outlook_delete","outlook_draft","outlook_forward","outlook_get_attachment","outlook_list_attachments","outlook_list_folders","outlook_mark_read","outlook_mark_unread","outlook_move","outlook_read","outlook_reply","outlook_reply_all","outlook_search","outlook_send","outlook_update_message","pagerduty_add_note","pagerduty_create_incident","pagerduty_get_incident","pagerduty_get_service","pagerduty_list_escalation_policies","pagerduty_list_incident_alerts","pagerduty_list_incidents","pagerduty_list_oncalls","pagerduty_list_schedules","pagerduty_list_services","pagerduty_list_users","pagerduty_merge_incidents","pagerduty_send_event","pagerduty_snooze_incident","pagerduty_update_incident","parallel_deep_research","parallel_extract","parallel_search","pdl_autocomplete","pdl_bulk_company_enrich","pdl_bulk_person_enrich","pdl_clean_company","pdl_clean_location","pdl_clean_school","pdl_company_enrich","pdl_company_search","pdl_person_enrich","pdl_person_identify","pdl_person_search","perplexity_chat","perplexity_search","persona_approve_inquiry","persona_create_account","persona_create_inquiry","persona_create_report","persona_decline_inquiry","persona_expire_inquiry","persona_generate_inquiry_link","persona_get_account","persona_get_case","persona_get_document","persona_get_inquiry","persona_get_report","persona_get_verification","persona_import_accounts","persona_list_accounts","persona_list_cases","persona_list_inquiries","persona_list_inquiry_templates","persona_list_reports","persona_mark_inquiry_for_review","persona_print_inquiry_pdf","persona_redact_account","persona_redact_inquiry","persona_resume_inquiry","persona_update_account","persona_update_inquiry","pinecone_delete_vectors","pinecone_describe_index","pinecone_describe_index_stats","pinecone_fetch","pinecone_generate_embeddings","pinecone_list_indexes","pinecone_list_vector_ids","pinecone_search_text","pinecone_search_vector","pinecone_update_vector","pinecone_upsert_text","pipedrive_create_activity","pipedrive_create_deal","pipedrive_create_lead","pipedrive_create_project","pipedrive_delete_lead","pipedrive_get_activities","pipedrive_get_all_deals","pipedrive_get_deal","pipedrive_get_files","pipedrive_get_leads","pipedrive_get_mail_messages","pipedrive_get_mail_thread","pipedrive_get_pipeline_deals","pipedrive_get_pipelines","pipedrive_get_projects","pipedrive_update_activity","pipedrive_update_deal","pipedrive_update_lead","pitchbook_company_active_investors","pitchbook_company_bio","pitchbook_company_deal_service_providers","pitchbook_company_deals","pitchbook_company_financials","pitchbook_company_general_service_providers","pitchbook_company_industries","pitchbook_company_investors","pitchbook_company_most_recent_debt_financing","pitchbook_company_most_recent_financials","pitchbook_company_most_recent_financing","pitchbook_company_search","pitchbook_company_similar_companies","pitchbook_company_social_analytics","pitchbook_company_updates","pitchbook_company_vc_exit_predictions","pitchbook_contracts_history","pitchbook_cost_of_calls","pitchbook_credit_history","pitchbook_credit_news","pitchbook_credit_news_bulk","pitchbook_credit_news_most_recent","pitchbook_credit_news_search","pitchbook_deal_bio","pitchbook_deal_cap_table_history","pitchbook_deal_debt_lenders","pitchbook_deal_detailed","pitchbook_deal_investors","pitchbook_deal_multiples","pitchbook_deal_search","pitchbook_deal_service_providers","pitchbook_deal_stock_info","pitchbook_deal_tranche_info","pitchbook_deal_updates","pitchbook_deal_valuation","pitchbook_entity_affiliates","pitchbook_entity_locations","pitchbook_entity_news","pitchbook_entity_people","pitchbook_entity_updates","pitchbook_fund_active_investments","pitchbook_fund_benchmark","pitchbook_fund_bio","pitchbook_fund_cash_flows","pitchbook_fund_commitments","pitchbook_fund_investment_preferences","pitchbook_fund_investments","pitchbook_fund_performance","pitchbook_fund_search","pitchbook_fund_team","pitchbook_fund_updates","pitchbook_investor_active_investments","pitchbook_investor_bio","pitchbook_investor_board_seats","pitchbook_investor_deal_service_providers","pitchbook_investor_funds","pitchbook_investor_general_service_providers","pitchbook_investor_investments","pitchbook_investor_last_closed_fund","pitchbook_investor_preferences","pitchbook_investor_search","pitchbook_investor_updates","pitchbook_limited_partner_actual_allocations","pitchbook_limited_partner_bio","pitchbook_limited_partner_commitment_aggregates","pitchbook_limited_partner_commitment_preferences","pitchbook_limited_partner_commitments_detailed","pitchbook_limited_partner_search","pitchbook_limited_partner_service_providers","pitchbook_limited_partner_target_allocations","pitchbook_limited_partner_updates","pitchbook_lookup_table_structure","pitchbook_lookup_tables","pitchbook_patent_detailed","pitchbook_patent_search","pitchbook_people_search","pitchbook_person_bio","pitchbook_person_contact","pitchbook_person_education_work","pitchbook_sandbox_entities","pitchbook_search","pitchbook_service_provider_bio","pitchbook_service_provider_search","pitchbook_service_provider_updates","pitchbook_serviced_companies","pitchbook_serviced_deals","pitchbook_serviced_funds","pitchbook_serviced_investors","pitchbook_serviced_limited_partners","pitchbook_shared_search","pitchbook_usage_report","plane_archive_project","plane_archive_work_item","plane_confirm_attachment_upload","plane_create_attachment_upload","plane_create_comment","plane_create_cycle","plane_create_label","plane_create_link","plane_create_module","plane_create_project","plane_create_project_page","plane_create_state","plane_create_webhook","plane_create_work_item","plane_delete_attachment","plane_delete_comment","plane_delete_cycle","plane_delete_label","plane_delete_link","plane_delete_module","plane_delete_project","plane_delete_project_page","plane_delete_state","plane_delete_webhook","plane_delete_work_item","plane_get_attachment","plane_get_comment","plane_get_current_user","plane_get_cycle","plane_get_label","plane_get_link","plane_get_module","plane_get_project","plane_get_project_page","plane_get_project_summary","plane_get_state","plane_get_webhook","plane_get_work_item","plane_get_work_item_by_identifier","plane_list_attachments","plane_list_comments","plane_list_cycles","plane_list_labels","plane_list_links","plane_list_modules","plane_list_project_pages","plane_list_projects","plane_list_states","plane_list_webhooks","plane_list_work_items","plane_list_workspace_work_items","plane_manage_cycle_work_items","plane_manage_module_work_items","plane_regenerate_webhook_secret","plane_transfer_cycle_work_items","plane_unarchive_project","plane_unarchive_work_item","plane_update_comment","plane_update_cycle","plane_update_label","plane_update_link","plane_update_module","plane_update_project","plane_update_project_page","plane_update_state","plane_update_webhook","plane_update_work_item","planetscale_close_deploy_request","planetscale_create_backup","planetscale_create_branch","planetscale_create_deploy_request","planetscale_delete_branch","planetscale_get_backup","planetscale_get_branch","planetscale_get_database","planetscale_get_deploy_request","planetscale_list_backups","planetscale_list_branches","planetscale_list_databases","planetscale_list_deploy_requests","planetscale_queue_deploy_request","planetscale_review_deploy_request","polymarket_get_activity","polymarket_get_event","polymarket_get_events","polymarket_get_holders","polymarket_get_last_trade_price","polymarket_get_leaderboard","polymarket_get_market","polymarket_get_markets","polymarket_get_midpoint","polymarket_get_orderbook","polymarket_get_positions","polymarket_get_price","polymarket_get_price_history","polymarket_get_series","polymarket_get_series_by_id","polymarket_get_spread","polymarket_get_tags","polymarket_get_tick_size","polymarket_get_trades","polymarket_search","postgresql_delete","postgresql_execute","postgresql_insert","postgresql_introspect","postgresql_query","postgresql_update","posthog_batch_events","posthog_capture_event","posthog_create_annotation","posthog_create_cohort","posthog_create_dashboard","posthog_create_experiment","posthog_create_feature_flag","posthog_create_insight","posthog_create_survey","posthog_delete_feature_flag","posthog_delete_person","posthog_delete_survey","posthog_evaluate_flags","posthog_get_cohort","posthog_get_dashboard","posthog_get_event_definition","posthog_get_experiment","posthog_get_feature_flag","posthog_get_insight","posthog_get_organization","posthog_get_person","posthog_get_project","posthog_get_property_definition","posthog_get_session_recording","posthog_get_survey","posthog_list_actions","posthog_list_annotations","posthog_list_cohorts","posthog_list_dashboards","posthog_list_event_definitions","posthog_list_experiments","posthog_list_feature_flags","posthog_list_insights","posthog_list_organizations","posthog_list_persons","posthog_list_projects","posthog_list_property_definitions","posthog_list_recording_playlists","posthog_list_session_recordings","posthog_list_surveys","posthog_query","posthog_update_cohort","posthog_update_event_definition","posthog_update_experiment","posthog_update_feature_flag","posthog_update_insight","posthog_update_property_definition","posthog_update_survey","powerbi_execute_query","powerbi_get_dataset","powerbi_get_refresh_history","powerbi_get_report","powerbi_list_datasets","powerbi_list_reports","powerbi_list_workspaces","powerbi_refresh_dataset","profound_bot_logs","profound_bots_report","profound_category_assets","profound_category_personas","profound_category_prompts","profound_category_tags","profound_category_topics","profound_citation_prompts","profound_citations_report","profound_list_assets","profound_list_categories","profound_list_domains","profound_list_models","profound_list_optimizations","profound_list_personas","profound_list_regions","profound_optimization_analysis","profound_prompt_answers","profound_prompt_volume","profound_query_fanouts","profound_raw_logs","profound_referrals_report","profound_sentiment_report","profound_visibility_report","prospeo_account_information","prospeo_bulk_enrich_company","prospeo_bulk_enrich_person","prospeo_enrich_company","prospeo_enrich_person","prospeo_search_company","prospeo_search_person","prospeo_search_suggestions","pulse_parser","pulse_parser_v2","qdrant_fetch_points","qdrant_search_vector","qdrant_upsert_points","quartr_get_audio","quartr_get_company","quartr_get_event","quartr_get_event_summary","quartr_get_report","quartr_get_slide_deck","quartr_get_transcript","quartr_list_audio","quartr_list_companies","quartr_list_document_types","quartr_list_documents","quartr_list_event_types","quartr_list_events","quartr_list_live_events","quartr_list_reports","quartr_list_slide_decks","quartr_list_transcripts","quickbooks_add_attachment","quickbooks_create_bill","quickbooks_create_bill_payment","quickbooks_create_credit_memo","quickbooks_create_customer","quickbooks_create_customer_payment","quickbooks_create_deposit","quickbooks_create_employee","quickbooks_create_estimate","quickbooks_create_invoice","quickbooks_create_item","quickbooks_create_journal_entry","quickbooks_create_purchase","quickbooks_create_purchase_order","quickbooks_create_refund_receipt","quickbooks_create_sales_receipt","quickbooks_create_vendor","quickbooks_create_vendor_credit","quickbooks_download_attachment","quickbooks_download_transaction_pdf","quickbooks_email_transaction","quickbooks_get_company_info","quickbooks_read_accounting_transactions","quickbooks_read_attachments","quickbooks_read_master_data","quickbooks_read_purchasing_transactions","quickbooks_read_sales_transactions","quickbooks_run_financial_report","quickbooks_update_bill","quickbooks_update_bill_payment","quickbooks_update_credit_memo","quickbooks_update_customer","quickbooks_update_customer_payment","quickbooks_update_deposit","quickbooks_update_employee","quickbooks_update_estimate","quickbooks_update_invoice","quickbooks_update_item","quickbooks_update_journal_entry","quickbooks_update_purchase","quickbooks_update_purchase_order","quickbooks_update_refund_receipt","quickbooks_update_sales_receipt","quickbooks_update_vendor","quickbooks_update_vendor_credit","quickbooks_void_bill_payment","quickbooks_void_customer_payment","quickbooks_void_invoice","quickbooks_void_sales_receipt","quiver_image_to_svg","quiver_image_to_svg_v2","quiver_list_models","quiver_text_to_svg","quiver_text_to_svg_v2","rabbitmq_create_binding","rabbitmq_create_exchange","rabbitmq_create_policy","rabbitmq_create_queue","rabbitmq_delete_binding","rabbitmq_delete_exchange","rabbitmq_delete_policy","rabbitmq_delete_queue","rabbitmq_get_exchange","rabbitmq_get_messages","rabbitmq_get_overview","rabbitmq_get_queue","rabbitmq_health_check","rabbitmq_list_bindings","rabbitmq_list_channels","rabbitmq_list_connections","rabbitmq_list_consumers","rabbitmq_list_exchange_bindings","rabbitmq_list_exchanges","rabbitmq_list_nodes","rabbitmq_list_policies","rabbitmq_list_queues","rabbitmq_list_vhosts","rabbitmq_publish_message","rabbitmq_purge_queue","railway_create_environment","railway_create_project","railway_create_service","railway_delete_environment","railway_delete_project","railway_delete_service","railway_delete_variable","railway_deploy_service","railway_get_deployment","railway_get_deployment_logs","railway_get_project","railway_list_deployments","railway_list_project_members","railway_list_projects","railway_list_variables","railway_restart_deployment","railway_rollback_deployment","railway_transfer_project","railway_update_project","railway_upsert_variable","ramp_create_memo","ramp_get_balance","ramp_get_bill","ramp_get_business","ramp_get_memo","ramp_get_physical_card","ramp_get_reimbursement","ramp_get_transaction","ramp_get_user","ramp_get_vendor","ramp_get_virtual_card","ramp_list_bills","ramp_list_physical_cards","ramp_list_reimbursements","ramp_list_transactions","ramp_list_users","ramp_list_vendors","ramp_list_virtual_cards","rb2b_credit_check","rb2b_email_to_activity","rb2b_hem_to_best_linkedin","rb2b_hem_to_business_profile","rb2b_hem_to_linkedin","rb2b_hem_to_maid","rb2b_ip_to_company","rb2b_ip_to_hem","rb2b_ip_to_maid","rb2b_linkedin_slug_search","rb2b_linkedin_to_best_personal_email","rb2b_linkedin_to_business_profile","rb2b_linkedin_to_hashed_emails","rb2b_linkedin_to_mobile_phone","rb2b_linkedin_to_personal_email","rds_delete","rds_execute","rds_insert","rds_introspect","rds_query","rds_update","reddit_delete","reddit_edit","reddit_get_comments","reddit_get_controversial","reddit_get_info","reddit_get_me","reddit_get_messages","reddit_get_posts","reddit_get_saved","reddit_get_subreddit_info","reddit_get_subreddit_rules","reddit_get_user","reddit_get_user_comments","reddit_get_user_posts","reddit_hide","reddit_hot_posts","reddit_list_my_subreddits","reddit_lock","reddit_mark_all_read","reddit_mark_read","reddit_marknsfw","reddit_mod_approve","reddit_mod_distinguish","reddit_mod_remove","reddit_mod_sticky","reddit_reply","reddit_report","reddit_save","reddit_search","reddit_search_subreddits","reddit_send_message","reddit_submit_post","reddit_subscribe","reddit_unhide","reddit_unlock","reddit_unmarknsfw","reddit_unsave","reddit_vote","redis_command","redis_delete","redis_exists","redis_expire","redis_get","redis_hdel","redis_hget","redis_hgetall","redis_hset","redis_incr","redis_incrby","redis_keys","redis_llen","redis_lpop","redis_lpush","redis_lrange","redis_persist","redis_rpop","redis_rpush","redis_set","redis_setnx","redis_ttl","reducto_parser","reducto_parser_v2","resend_cancel_email","resend_create_audience","resend_create_broadcast","resend_create_contact","resend_delete_audience","resend_delete_contact","resend_get_audience","resend_get_broadcast","resend_get_contact","resend_get_email","resend_list_audiences","resend_list_contacts","resend_list_domains","resend_send","resend_send_broadcast","resend_update_contact","revenuecat_create_purchase","revenuecat_defer_google_subscription","revenuecat_delete_customer","revenuecat_get_customer","revenuecat_grant_entitlement","revenuecat_list_offerings","revenuecat_refund_google_subscription","revenuecat_revoke_entitlement","revenuecat_revoke_google_subscription","revenuecat_update_subscriber_attributes","rippling_bulk_create_custom_object_records","rippling_bulk_delete_custom_object_records","rippling_bulk_update_custom_object_records","rippling_create_business_partner","rippling_create_business_partner_group","rippling_create_custom_app","rippling_create_custom_object","rippling_create_custom_object_field","rippling_create_custom_object_record","rippling_create_custom_page","rippling_create_custom_setting","rippling_create_department","rippling_create_draft_hires","rippling_create_object_category","rippling_create_title","rippling_create_work_location","rippling_delete_business_partner","rippling_delete_business_partner_group","rippling_delete_custom_app","rippling_delete_custom_object","rippling_delete_custom_object_field","rippling_delete_custom_object_record","rippling_delete_custom_page","rippling_delete_custom_setting","rippling_delete_object_category","rippling_delete_title","rippling_delete_work_location","rippling_get_business_partner","rippling_get_business_partner_group","rippling_get_current_user","rippling_get_custom_app","rippling_get_custom_object","rippling_get_custom_object_field","rippling_get_custom_object_record","rippling_get_custom_object_record_by_external_id","rippling_get_custom_page","rippling_get_custom_setting","rippling_get_department","rippling_get_employment_type","rippling_get_job_function","rippling_get_object_category","rippling_get_report_run","rippling_get_supergroup","rippling_get_team","rippling_get_title","rippling_get_user","rippling_get_work_location","rippling_get_worker","rippling_list_business_partner_groups","rippling_list_business_partners","rippling_list_companies","rippling_list_custom_apps","rippling_list_custom_fields","rippling_list_custom_object_fields","rippling_list_custom_object_records","rippling_list_custom_objects","rippling_list_custom_pages","rippling_list_custom_settings","rippling_list_departments","rippling_list_employment_types","rippling_list_entitlements","rippling_list_job_functions","rippling_list_object_categories","rippling_list_supergroup_exclusion_members","rippling_list_supergroup_inclusion_members","rippling_list_supergroup_members","rippling_list_supergroups","rippling_list_teams","rippling_list_titles","rippling_list_users","rippling_list_work_locations","rippling_list_workers","rippling_query_custom_object_records","rippling_trigger_report_run","rippling_update_custom_app","rippling_update_custom_object","rippling_update_custom_object_field","rippling_update_custom_object_record","rippling_update_custom_page","rippling_update_custom_setting","rippling_update_department","rippling_update_object_category","rippling_update_supergroup_exclusion_members","rippling_update_supergroup_inclusion_members","rippling_update_title","rippling_update_work_location","rocketlane_add_field_option","rocketlane_add_project_members","rocketlane_add_task_assignees","rocketlane_add_task_dependencies","rocketlane_add_task_followers","rocketlane_archive_project","rocketlane_assign_placeholders","rocketlane_create_field","rocketlane_create_phase","rocketlane_create_project","rocketlane_create_space","rocketlane_create_space_document","rocketlane_create_task","rocketlane_create_time_entry","rocketlane_create_time_off","rocketlane_delete_field","rocketlane_delete_phase","rocketlane_delete_project","rocketlane_delete_space","rocketlane_delete_space_document","rocketlane_delete_task","rocketlane_delete_time_entry","rocketlane_delete_time_off","rocketlane_get_field","rocketlane_get_invoice","rocketlane_get_invoice_line_items","rocketlane_get_invoice_payments","rocketlane_get_phase","rocketlane_get_project","rocketlane_get_space","rocketlane_get_space_document","rocketlane_get_task","rocketlane_get_time_entry","rocketlane_get_time_off","rocketlane_get_user","rocketlane_import_template","rocketlane_list_fields","rocketlane_list_invoices","rocketlane_list_phases","rocketlane_list_placeholders","rocketlane_list_projects","rocketlane_list_resource_allocations","rocketlane_list_space_documents","rocketlane_list_spaces","rocketlane_list_tasks","rocketlane_list_time_entries","rocketlane_list_time_entry_categories","rocketlane_list_time_offs","rocketlane_list_users","rocketlane_move_task_to_phase","rocketlane_remove_project_members","rocketlane_remove_task_assignees","rocketlane_remove_task_dependencies","rocketlane_remove_task_followers","rocketlane_search_time_entries","rocketlane_unassign_placeholders","rocketlane_update_field","rocketlane_update_field_option","rocketlane_update_phase","rocketlane_update_project","rocketlane_update_space","rocketlane_update_space_document","rocketlane_update_task","rocketlane_update_time_entry","rootly_acknowledge_alert","rootly_add_incident_event","rootly_add_subscribers","rootly_assign_incident_role","rootly_create_action_item","rootly_create_alert","rootly_create_incident","rootly_create_status_page_event","rootly_delete_action_item","rootly_delete_incident","rootly_escalate_alert","rootly_get_alert","rootly_get_incident","rootly_list_action_items","rootly_list_alerts","rootly_list_causes","rootly_list_environments","rootly_list_escalation_policies","rootly_list_functionalities","rootly_list_incident_events","rootly_list_incident_roles","rootly_list_incident_types","rootly_list_incidents","rootly_list_on_calls","rootly_list_playbooks","rootly_list_retrospectives","rootly_list_schedules","rootly_list_services","rootly_list_severities","rootly_list_teams","rootly_list_users","rootly_mitigate_incident","rootly_remove_subscribers","rootly_resolve_alert","rootly_resolve_incident","rootly_run_workflow","rootly_snooze_alert","rootly_unassign_incident_role","rootly_update_action_item","rootly_update_alert","rootly_update_incident","s3_copy_object","s3_create_bucket","s3_delete_bucket","s3_delete_object","s3_delete_objects","s3_get_object","s3_head_object","s3_list_buckets","s3_list_objects","s3_presigned_url","s3_put_object","sailpoint_approve_access_request","sailpoint_cancel_access_request","sailpoint_decide_certification_review_items","sailpoint_get_access_profile","sailpoint_get_access_profile_entitlements","sailpoint_get_access_request_config","sailpoint_get_access_request_status","sailpoint_get_account","sailpoint_get_account_activity","sailpoint_get_account_entitlements","sailpoint_get_account_selections","sailpoint_get_campaign","sailpoint_get_certification","sailpoint_get_entitlement","sailpoint_get_entitlement_request_config","sailpoint_get_identity","sailpoint_get_role","sailpoint_get_role_entitlements","sailpoint_get_source","sailpoint_get_task_status","sailpoint_list_access_profiles","sailpoint_list_account_activities","sailpoint_list_accounts","sailpoint_list_campaigns","sailpoint_list_certification_review_items","sailpoint_list_certifications","sailpoint_list_entitlements","sailpoint_list_identities","sailpoint_list_identity_entitlements","sailpoint_list_pending_access_request_approvals","sailpoint_list_roles","sailpoint_list_sources","sailpoint_load_accounts","sailpoint_load_entitlements","sailpoint_reject_access_request","sailpoint_request_access","sailpoint_search","sailpoint_search_aggregate","sailpoint_search_count","sailpoint_sign_off_certification","salesforce_create_account","salesforce_create_case","salesforce_create_contact","salesforce_create_custom_field","salesforce_create_custom_object","salesforce_create_lead","salesforce_create_opportunity","salesforce_create_task","salesforce_delete_account","salesforce_delete_case","salesforce_delete_contact","salesforce_delete_custom_field","salesforce_delete_lead","salesforce_delete_opportunity","salesforce_delete_task","salesforce_describe_object","salesforce_get_accounts","salesforce_get_cases","salesforce_get_contacts","salesforce_get_dashboard","salesforce_get_leads","salesforce_get_opportunities","salesforce_get_report","salesforce_get_tasks","salesforce_list_dashboards","salesforce_list_objects","salesforce_list_report_types","salesforce_list_reports","salesforce_query","salesforce_query_more","salesforce_refresh_dashboard","salesforce_run_report","salesforce_tooling_query","salesforce_update_account","salesforce_update_case","salesforce_update_contact","salesforce_update_custom_field","salesforce_update_lead","salesforce_update_opportunity","salesforce_update_task","sap_concur_approve_expense_report","sap_concur_associate_attendees","sap_concur_create_cash_advance","sap_concur_create_expected_expense","sap_concur_create_expense_report","sap_concur_create_list_item","sap_concur_create_purchase_request","sap_concur_create_quick_expense","sap_concur_create_quick_expense_with_image","sap_concur_create_report_comment","sap_concur_create_travel_request","sap_concur_create_user","sap_concur_delete_expected_expense","sap_concur_delete_expense","sap_concur_delete_expense_report","sap_concur_delete_list_item","sap_concur_delete_travel_request","sap_concur_delete_user","sap_concur_get_allocation","sap_concur_get_budget","sap_concur_get_cash_advance","sap_concur_get_expected_expense","sap_concur_get_expense","sap_concur_get_expense_report","sap_concur_get_itemizations","sap_concur_get_itinerary","sap_concur_get_list","sap_concur_get_list_item","sap_concur_get_purchase_request","sap_concur_get_receipt","sap_concur_get_receipt_status","sap_concur_get_request_cash_advance","sap_concur_get_travel_profile","sap_concur_get_travel_request","sap_concur_get_user","sap_concur_issue_cash_advance","sap_concur_list_allocations","sap_concur_list_attendee_associations","sap_concur_list_budget_categories","sap_concur_list_budgets","sap_concur_list_exceptions","sap_concur_list_expected_expenses","sap_concur_list_expense_reports","sap_concur_list_expenses","sap_concur_list_itineraries","sap_concur_list_list_items","sap_concur_list_lists","sap_concur_list_receipts","sap_concur_list_report_comments","sap_concur_list_reports_to_approve","sap_concur_list_travel_profiles_summary","sap_concur_list_travel_request_comments","sap_concur_list_travel_requests","sap_concur_list_users","sap_concur_move_travel_request","sap_concur_recall_expense_report","sap_concur_remove_all_attendees","sap_concur_search_locations","sap_concur_search_users","sap_concur_send_back_expense_report","sap_concur_submit_expense_report","sap_concur_update_allocation","sap_concur_update_expected_expense","sap_concur_update_expense","sap_concur_update_expense_report","sap_concur_update_list_item","sap_concur_update_travel_request","sap_concur_update_user","sap_concur_upload_exchange_rates","sap_concur_upload_receipt_image","sap_s4hana_create_business_partner","sap_s4hana_create_purchase_order","sap_s4hana_create_purchase_requisition","sap_s4hana_create_sales_order","sap_s4hana_delete_sales_order","sap_s4hana_get_billing_document","sap_s4hana_get_business_partner","sap_s4hana_get_customer","sap_s4hana_get_inbound_delivery","sap_s4hana_get_material_document","sap_s4hana_get_outbound_delivery","sap_s4hana_get_product","sap_s4hana_get_purchase_order","sap_s4hana_get_purchase_requisition","sap_s4hana_get_sales_order","sap_s4hana_get_supplier","sap_s4hana_get_supplier_invoice","sap_s4hana_list_billing_documents","sap_s4hana_list_business_partners","sap_s4hana_list_customers","sap_s4hana_list_inbound_deliveries","sap_s4hana_list_material_documents","sap_s4hana_list_material_stock","sap_s4hana_list_outbound_deliveries","sap_s4hana_list_products","sap_s4hana_list_purchase_orders","sap_s4hana_list_purchase_requisitions","sap_s4hana_list_sales_orders","sap_s4hana_list_supplier_invoices","sap_s4hana_list_suppliers","sap_s4hana_odata_query","sap_s4hana_update_business_partner","sap_s4hana_update_customer","sap_s4hana_update_product","sap_s4hana_update_purchase_order","sap_s4hana_update_purchase_requisition","sap_s4hana_update_sales_order","sap_s4hana_update_supplier","search_tool","secrets_manager_create_secret","secrets_manager_delete_secret","secrets_manager_describe_secret","secrets_manager_get_secret","secrets_manager_list_secrets","secrets_manager_restore_secret","secrets_manager_rotate_secret","secrets_manager_tag_resource","secrets_manager_untag_resource","secrets_manager_update_secret","semrush_backlinks","semrush_backlinks_anchors","semrush_backlinks_competitors","semrush_backlinks_geo_distribution","semrush_backlinks_indexed_pages","semrush_backlinks_overview","semrush_backlinks_tld_distribution","semrush_batch_keyword_overview","semrush_broad_match_keywords","semrush_domain_ad_copies","semrush_domain_ad_history","semrush_domain_organic_competitors","semrush_domain_organic_keywords","semrush_domain_overview","semrush_domain_overview_all","semrush_domain_overview_history","semrush_domain_paid_competitors","semrush_domain_paid_keywords","semrush_domain_pla_copies","semrush_domain_pla_keywords","semrush_domain_vs_domain","semrush_keyword_ad_history","semrush_keyword_difficulty","semrush_keyword_overview","semrush_keyword_overview_all","semrush_keyword_questions","semrush_organic_results","semrush_paid_results","semrush_referring_domains","semrush_referring_ips","semrush_related_keywords","semrush_subdomain_ad_copies","semrush_subdomain_organic_keywords","semrush_subdomain_overview","semrush_subdomain_overview_all","semrush_subdomain_overview_history","semrush_subdomain_paid_keywords","semrush_top_domains","semrush_url_organic_keywords","semrush_url_overview","semrush_url_overview_all","semrush_url_overview_history","semrush_url_paid_keywords","semrush_winners_and_losers","sendblue_evaluate_service","sendblue_get_message","sendblue_send_group_message","sendblue_send_message","sendblue_send_typing_indicator","sendgrid_add_contact","sendgrid_add_contacts_to_list","sendgrid_create_list","sendgrid_create_template","sendgrid_create_template_version","sendgrid_delete_contacts","sendgrid_delete_list","sendgrid_delete_template","sendgrid_get_contact","sendgrid_get_list","sendgrid_get_template","sendgrid_list_all_lists","sendgrid_list_templates","sendgrid_remove_contacts_from_list","sendgrid_search_contacts","sendgrid_send_mail","sentry_events_get","sentry_events_list","sentry_issues_get","sentry_issues_list","sentry_issues_update","sentry_projects_create","sentry_projects_get","sentry_projects_list","sentry_projects_update","sentry_releases_create","sentry_releases_deploy","sentry_releases_list","sentry_teams_list","serper_search","servicenow_add_incident_comment","servicenow_aggregate","servicenow_close_incident","servicenow_create_change_request","servicenow_create_incident","servicenow_create_record","servicenow_delete_record","servicenow_download_attachment","servicenow_download_attachment_v2","servicenow_find_user","servicenow_get_change_next_states","servicenow_get_change_request","servicenow_get_ci","servicenow_get_incident","servicenow_get_knowledge_article","servicenow_get_requested_item","servicenow_list_approvals","servicenow_list_attachments","servicenow_list_catalog_items","servicenow_list_change_requests","servicenow_list_change_tasks","servicenow_list_ci_relationships","servicenow_list_group_members","servicenow_list_incidents","servicenow_list_requested_items","servicenow_order_catalog_item","servicenow_read_record","servicenow_resolve_incident","servicenow_search_cis","servicenow_search_knowledge","servicenow_update_approval","servicenow_update_change_request","servicenow_update_change_state","servicenow_update_incident","servicenow_update_record","servicenow_upload_attachment","ses_create_configuration_set","ses_create_email_identity","ses_create_template","ses_delete_email_identity","ses_delete_suppressed_destination","ses_delete_template","ses_get_account","ses_get_email_identity","ses_get_suppressed_destination","ses_get_template","ses_list_identities","ses_list_suppressed_destinations","ses_list_templates","ses_put_suppressed_destination","ses_send_bulk_email","ses_send_custom_verification_email","ses_send_email","ses_send_templated_email","ses_update_template","sftp_delete","sftp_download","sftp_download_v2","sftp_list","sftp_mkdir","sftp_upload","sharepoint_add_list_items","sharepoint_create_list","sharepoint_create_page","sharepoint_delete_file","sharepoint_delete_list_item","sharepoint_delete_page","sharepoint_download_file","sharepoint_get_drive_item","sharepoint_get_list","sharepoint_get_list_item","sharepoint_list_sites","sharepoint_publish_page","sharepoint_read_page","sharepoint_update_list","sharepoint_update_page","sharepoint_upload_file","shopify_adjust_inventory","shopify_cancel_order","shopify_create_customer","shopify_create_fulfillment","shopify_create_product","shopify_create_product_variants","shopify_delete_customer","shopify_delete_product","shopify_get_collection","shopify_get_customer","shopify_get_fulfillment","shopify_get_fulfillment_order","shopify_get_inventory_level","shopify_get_job","shopify_get_order","shopify_get_product","shopify_list_collections","shopify_list_customers","shopify_list_fulfillment_orders","shopify_list_inventory_items","shopify_list_locations","shopify_list_orders","shopify_list_products","shopify_update_customer","shopify_update_fulfillment_tracking","shopify_update_order","shopify_update_product","shopify_update_product_variants","similarweb_bounce_rate","similarweb_page_views","similarweb_pages_per_visit","similarweb_traffic_visits","similarweb_visit_duration","similarweb_website_overview","sixtyfour_enrich_company","sixtyfour_enrich_lead","sixtyfour_find_email","sixtyfour_find_phone","slack_add_bookmark","slack_add_reaction","slack_archive_conversation","slack_canvas","slack_close_conversation","slack_create_channel_canvas","slack_create_conversation","slack_create_user_group","slack_delete_canvas","slack_delete_file","slack_delete_message","slack_delete_scheduled_message","slack_disable_user_group","slack_download","slack_edit_bookmark","slack_edit_canvas","slack_enable_user_group","slack_ephemeral_message","slack_get_canvas","slack_get_channel_history","slack_get_channel_info","slack_get_dnd_info","slack_get_file_info","slack_get_message","slack_get_permalink","slack_get_reactions","slack_get_team_dnd_info","slack_get_team_info","slack_get_team_profile","slack_get_thread","slack_get_thread_replies","slack_get_user","slack_get_user_presence","slack_get_user_profile","slack_invite_to_conversation","slack_join_conversation","slack_kick_conversation","slack_leave_conversation","slack_list_bookmarks","slack_list_canvases","slack_list_channels","slack_list_emoji","slack_list_files","slack_list_members","slack_list_pins","slack_list_reactions","slack_list_scheduled_messages","slack_list_user_conversations","slack_list_user_group_members","slack_list_user_groups","slack_list_users","slack_lists_access_delete","slack_lists_access_set","slack_lists_create","slack_lists_download_get","slack_lists_download_start","slack_lists_items_create","slack_lists_items_delete","slack_lists_items_delete_multiple","slack_lists_items_info","slack_lists_items_list","slack_lists_items_update","slack_lists_update","slack_lookup_canvas_sections","slack_lookup_user_by_email","slack_mark_conversation_read","slack_message","slack_message_reader","slack_open_conversation","slack_open_view","slack_pin_message","slack_publish_view","slack_push_view","slack_remove_bookmark","slack_remove_reaction","slack_rename_agent_session_v2","slack_rename_conversation","slack_revoke_canvas_access","slack_schedule_message","slack_set_agent_session_status_v2","slack_set_conversation_purpose","slack_set_conversation_topic","slack_set_status","slack_set_suggested_prompts","slack_set_suggested_prompts_v2","slack_set_title","slack_set_user_presence","slack_share_canvas","slack_unarchive_conversation","slack_unfurl_links","slack_unpin_message","slack_update_message","slack_update_user_group","slack_update_user_group_members","slack_update_view","smartlead_add_email_accounts_to_campaign","smartlead_add_leads_to_campaign","smartlead_create_campaign","smartlead_create_lead_list","smartlead_delete_campaign","smartlead_delete_campaign_webhook","smartlead_delete_lead_from_campaign","smartlead_delete_lead_list","smartlead_duplicate_campaign","smartlead_export_campaign_leads","smartlead_get_campaign","smartlead_get_campaign_analytics","smartlead_get_campaign_analytics_by_date","smartlead_get_campaign_lead_statistics","smartlead_get_campaign_mailbox_statistics","smartlead_get_campaign_sequences","smartlead_get_campaign_statistics","smartlead_get_campaign_top_level_analytics_by_date","smartlead_get_campaign_webhook_summary","smartlead_get_lead_by_email","smartlead_get_lead_by_id","smartlead_get_lead_list","smartlead_get_lead_message_history","smartlead_list_campaign_email_accounts","smartlead_list_campaign_leads","smartlead_list_campaign_webhooks","smartlead_list_campaigns","smartlead_list_clients","smartlead_list_email_accounts","smartlead_list_inbox_replies","smartlead_list_lead_activities","smartlead_list_lead_categories","smartlead_list_lead_lists","smartlead_mark_lead_complete","smartlead_pause_lead","smartlead_remove_email_accounts_from_campaign","smartlead_resume_lead","smartlead_save_campaign_sequences","smartlead_unsubscribe_lead_from_campaign","smartlead_unsubscribe_lead_globally","smartlead_update_campaign_schedule","smartlead_update_campaign_settings","smartlead_update_campaign_status","smartlead_update_lead","smartlead_update_lead_category","smartlead_update_lead_list","smartlead_upsert_campaign_webhook","sms_send","smtp_send_mail","snowflake_alter_warehouse","snowflake_call_procedure","snowflake_cancel_statement","snowflake_cancel_task_run","snowflake_cortex_analyst_ask","snowflake_cortex_analyst_feedback","snowflake_delete_rows","snowflake_execute_sql","snowflake_get_statement","snowflake_get_task","snowflake_get_task_run","snowflake_get_task_run_output","snowflake_get_warehouse","snowflake_insert_rows","snowflake_introspect_schema","snowflake_list_copy_history","snowflake_list_databases","snowflake_list_query_history","snowflake_list_schemas","snowflake_list_tables","snowflake_list_task_runs","snowflake_list_tasks","snowflake_list_warehouses","snowflake_load_data","snowflake_resume_task","snowflake_resume_warehouse","snowflake_run_task","snowflake_suspend_task","snowflake_suspend_warehouse","snowflake_unload_data","snowflake_update_rows","snowflake_upsert_rows","splunk_cancel_search_job","splunk_create_search_job","splunk_dispatch_saved_search","splunk_get_fired_alerts","splunk_get_saved_search","splunk_get_search_job","splunk_get_search_results","splunk_list_apps","splunk_list_fired_alerts","splunk_list_indexes","splunk_list_saved_searches","splunk_run_search","sportmonks_core_get_cities","sportmonks_core_get_city","sportmonks_core_get_continent","sportmonks_core_get_continents","sportmonks_core_get_countries","sportmonks_core_get_country","sportmonks_core_get_entity_filters","sportmonks_core_get_my_usage","sportmonks_core_get_region","sportmonks_core_get_regions","sportmonks_core_get_timezones","sportmonks_core_get_type","sportmonks_core_get_type_by_entity","sportmonks_core_get_types","sportmonks_core_search_cities","sportmonks_core_search_countries","sportmonks_core_search_regions","sportmonks_football_expected_by_player","sportmonks_football_expected_by_team","sportmonks_football_get_all_commentaries","sportmonks_football_get_all_fixtures","sportmonks_football_get_all_players","sportmonks_football_get_all_rivals","sportmonks_football_get_all_teams","sportmonks_football_get_all_transfer_rumours","sportmonks_football_get_all_transfers","sportmonks_football_get_brackets_by_season","sportmonks_football_get_coach","sportmonks_football_get_coaches","sportmonks_football_get_coaches_by_country","sportmonks_football_get_commentaries_by_fixture","sportmonks_football_get_current_leagues_by_team","sportmonks_football_get_expected_lineups_by_player","sportmonks_football_get_expected_lineups_by_team","sportmonks_football_get_extended_team_squad","sportmonks_football_get_fixture","sportmonks_football_get_fixtures_by_date","sportmonks_football_get_fixtures_by_date_range","sportmonks_football_get_fixtures_by_date_range_for_team","sportmonks_football_get_fixtures_by_ids","sportmonks_football_get_grouped_standings_by_round","sportmonks_football_get_head_to_head","sportmonks_football_get_inplay_livescores","sportmonks_football_get_latest_coaches","sportmonks_football_get_latest_fixtures","sportmonks_football_get_latest_livescores","sportmonks_football_get_latest_players","sportmonks_football_get_latest_totw","sportmonks_football_get_latest_transfers","sportmonks_football_get_league","sportmonks_football_get_leagues","sportmonks_football_get_leagues_by_country","sportmonks_football_get_leagues_by_date","sportmonks_football_get_leagues_by_team","sportmonks_football_get_live_leagues","sportmonks_football_get_live_probabilities","sportmonks_football_get_live_probabilities_by_fixture","sportmonks_football_get_live_standings_by_league","sportmonks_football_get_livescores","sportmonks_football_get_match_facts","sportmonks_football_get_match_facts_by_date_range","sportmonks_football_get_match_facts_by_fixture","sportmonks_football_get_match_facts_by_league","sportmonks_football_get_past_fixtures_by_tv_station","sportmonks_football_get_player","sportmonks_football_get_players_by_country","sportmonks_football_get_postmatch_news","sportmonks_football_get_postmatch_news_by_season","sportmonks_football_get_predictability_by_league","sportmonks_football_get_prematch_news","sportmonks_football_get_prematch_news_by_season","sportmonks_football_get_prematch_news_upcoming","sportmonks_football_get_probabilities","sportmonks_football_get_probabilities_by_fixture","sportmonks_football_get_referee","sportmonks_football_get_referees","sportmonks_football_get_referees_by_country","sportmonks_football_get_referees_by_season","sportmonks_football_get_rivals_by_team","sportmonks_football_get_round","sportmonks_football_get_round_statistics","sportmonks_football_get_rounds","sportmonks_football_get_rounds_by_season","sportmonks_football_get_schedules_by_season","sportmonks_football_get_schedules_by_season_and_team","sportmonks_football_get_schedules_by_team","sportmonks_football_get_season","sportmonks_football_get_seasons","sportmonks_football_get_seasons_by_team","sportmonks_football_get_stage","sportmonks_football_get_stage_statistics","sportmonks_football_get_stages","sportmonks_football_get_stages_by_season","sportmonks_football_get_standing_corrections_by_season","sportmonks_football_get_standings","sportmonks_football_get_standings_by_round","sportmonks_football_get_standings_by_season","sportmonks_football_get_state","sportmonks_football_get_states","sportmonks_football_get_team","sportmonks_football_get_team_rankings","sportmonks_football_get_team_rankings_by_date","sportmonks_football_get_team_rankings_by_team","sportmonks_football_get_team_squad","sportmonks_football_get_team_squad_by_season","sportmonks_football_get_teams_by_country","sportmonks_football_get_teams_by_season","sportmonks_football_get_topscorers_by_season","sportmonks_football_get_topscorers_by_stage","sportmonks_football_get_totw","sportmonks_football_get_totw_by_round","sportmonks_football_get_transfer","sportmonks_football_get_transfer_rumour","sportmonks_football_get_transfer_rumours_between_dates","sportmonks_football_get_transfer_rumours_by_player","sportmonks_football_get_transfer_rumours_by_team","sportmonks_football_get_transfers_between_dates","sportmonks_football_get_transfers_by_player","sportmonks_football_get_transfers_by_team","sportmonks_football_get_tv_station","sportmonks_football_get_tv_stations","sportmonks_football_get_tv_stations_by_fixture","sportmonks_football_get_upcoming_fixtures_by_market","sportmonks_football_get_upcoming_fixtures_by_tv_station","sportmonks_football_get_value_bets","sportmonks_football_get_value_bets_by_fixture","sportmonks_football_get_venue","sportmonks_football_get_venues","sportmonks_football_get_venues_by_season","sportmonks_football_search_coaches","sportmonks_football_search_fixtures","sportmonks_football_search_leagues","sportmonks_football_search_players","sportmonks_football_search_referees","sportmonks_football_search_rounds","sportmonks_football_search_seasons","sportmonks_football_search_stages","sportmonks_football_search_teams","sportmonks_football_search_venues","sportmonks_motorsport_get_all_fixtures","sportmonks_motorsport_get_current_leagues_by_team","sportmonks_motorsport_get_driver","sportmonks_motorsport_get_driver_standings","sportmonks_motorsport_get_driver_standings_by_season","sportmonks_motorsport_get_drivers","sportmonks_motorsport_get_drivers_by_country","sportmonks_motorsport_get_drivers_by_season","sportmonks_motorsport_get_fixture","sportmonks_motorsport_get_fixtures_by_date","sportmonks_motorsport_get_fixtures_by_date_range","sportmonks_motorsport_get_fixtures_by_ids","sportmonks_motorsport_get_laps_by_fixture","sportmonks_motorsport_get_laps_by_fixture_and_driver","sportmonks_motorsport_get_laps_by_fixture_and_lap","sportmonks_motorsport_get_latest_laps_by_fixture","sportmonks_motorsport_get_latest_pitstops_by_fixture","sportmonks_motorsport_get_latest_stints_by_fixture","sportmonks_motorsport_get_latest_updated_drivers","sportmonks_motorsport_get_latest_updated_fixtures","sportmonks_motorsport_get_league","sportmonks_motorsport_get_leagues","sportmonks_motorsport_get_leagues_by_country","sportmonks_motorsport_get_leagues_by_date","sportmonks_motorsport_get_leagues_by_live","sportmonks_motorsport_get_leagues_by_team","sportmonks_motorsport_get_livescores","sportmonks_motorsport_get_pitstops_by_fixture","sportmonks_motorsport_get_pitstops_by_fixture_and_driver","sportmonks_motorsport_get_pitstops_by_fixture_and_lap","sportmonks_motorsport_get_race_results_by_season_and_driver","sportmonks_motorsport_get_race_results_by_season_and_team","sportmonks_motorsport_get_schedules_by_season","sportmonks_motorsport_get_season","sportmonks_motorsport_get_seasons","sportmonks_motorsport_get_stage","sportmonks_motorsport_get_stages","sportmonks_motorsport_get_stages_by_season","sportmonks_motorsport_get_state","sportmonks_motorsport_get_states","sportmonks_motorsport_get_stints_by_fixture","sportmonks_motorsport_get_stints_by_fixture_and_driver","sportmonks_motorsport_get_stints_by_fixture_and_stint","sportmonks_motorsport_get_team","sportmonks_motorsport_get_team_standings","sportmonks_motorsport_get_team_standings_by_season","sportmonks_motorsport_get_teams","sportmonks_motorsport_get_teams_by_country","sportmonks_motorsport_get_teams_by_season","sportmonks_motorsport_get_venue","sportmonks_motorsport_get_venues","sportmonks_motorsport_get_venues_by_season","sportmonks_motorsport_search_drivers","sportmonks_motorsport_search_leagues","sportmonks_motorsport_search_stages","sportmonks_motorsport_search_teams","sportmonks_motorsport_search_venues","sportmonks_odds_get_all_historical_odds","sportmonks_odds_get_all_inplay_odds","sportmonks_odds_get_all_pre_match_odds","sportmonks_odds_get_all_premium_odds","sportmonks_odds_get_bookmaker","sportmonks_odds_get_bookmaker_event_ids_by_fixture","sportmonks_odds_get_bookmakers","sportmonks_odds_get_bookmakers_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture_and_bookmaker","sportmonks_odds_get_inplay_odds_by_fixture_and_market","sportmonks_odds_get_last_updated_inplay_odds","sportmonks_odds_get_last_updated_pre_match_odds","sportmonks_odds_get_market","sportmonks_odds_get_markets","sportmonks_odds_get_pre_match_odds_by_fixture","sportmonks_odds_get_pre_match_odds_by_fixture_and_bookmaker","sportmonks_odds_get_pre_match_odds_by_fixture_and_market","sportmonks_odds_get_premium_odds_by_fixture","sportmonks_odds_get_premium_odds_by_fixture_and_bookmaker","sportmonks_odds_get_premium_odds_by_fixture_and_market","sportmonks_odds_get_updated_historical_odds_between","sportmonks_odds_get_updated_premium_odds_between","sportmonks_odds_search_bookmakers","sportmonks_odds_search_markets","spotify_add_playlist_cover","spotify_add_to_queue","spotify_add_tracks_to_playlist","spotify_check_following","spotify_check_playlist_followers","spotify_check_saved_albums","spotify_check_saved_audiobooks","spotify_check_saved_episodes","spotify_check_saved_shows","spotify_check_saved_tracks","spotify_create_playlist","spotify_follow_artists","spotify_follow_playlist","spotify_get_album","spotify_get_album_tracks","spotify_get_albums","spotify_get_artist","spotify_get_artist_albums","spotify_get_artist_top_tracks","spotify_get_artists","spotify_get_audiobook","spotify_get_audiobook_chapters","spotify_get_audiobooks","spotify_get_categories","spotify_get_current_user","spotify_get_currently_playing","spotify_get_devices","spotify_get_episode","spotify_get_episodes","spotify_get_followed_artists","spotify_get_markets","spotify_get_new_releases","spotify_get_playback_state","spotify_get_playlist","spotify_get_playlist_cover","spotify_get_playlist_tracks","spotify_get_queue","spotify_get_recently_played","spotify_get_saved_albums","spotify_get_saved_audiobooks","spotify_get_saved_episodes","spotify_get_saved_shows","spotify_get_saved_tracks","spotify_get_show","spotify_get_show_episodes","spotify_get_shows","spotify_get_top_artists","spotify_get_top_tracks","spotify_get_track","spotify_get_tracks","spotify_get_user_playlists","spotify_get_user_profile","spotify_pause","spotify_play","spotify_remove_saved_albums","spotify_remove_saved_audiobooks","spotify_remove_saved_episodes","spotify_remove_saved_shows","spotify_remove_saved_tracks","spotify_remove_tracks_from_playlist","spotify_reorder_playlist_items","spotify_replace_playlist_items","spotify_save_albums","spotify_save_audiobooks","spotify_save_episodes","spotify_save_shows","spotify_save_tracks","spotify_search","spotify_seek","spotify_set_repeat","spotify_set_shuffle","spotify_set_volume","spotify_skip_next","spotify_skip_previous","spotify_transfer_playback","spotify_unfollow_artists","spotify_unfollow_playlist","spotify_update_playlist","sqs_cancel_message_move_task","sqs_change_message_visibility","sqs_change_message_visibility_batch","sqs_create_queue","sqs_delete_message","sqs_delete_message_batch","sqs_delete_queue","sqs_get_queue_attributes","sqs_get_queue_url","sqs_list_dead_letter_source_queues","sqs_list_message_move_tasks","sqs_list_queue_tags","sqs_list_queues","sqs_purge_queue","sqs_receive_message","sqs_send","sqs_send_message_batch","sqs_set_queue_attributes","sqs_start_message_move_task","sqs_tag_queue","sqs_untag_queue","square_batch_retrieve_inventory_counts","square_cancel_invoice","square_cancel_payment","square_complete_payment","square_create_catalog_image","square_create_customer","square_create_invoice","square_create_order","square_create_payment","square_delete_catalog_object","square_delete_customer","square_delete_invoice","square_get_catalog_object","square_get_customer","square_get_invoice","square_get_location","square_get_order","square_get_payment","square_get_refund","square_list_catalog","square_list_customers","square_list_invoices","square_list_locations","square_list_payments","square_list_refunds","square_pay_order","square_publish_invoice","square_refund_payment","square_search_catalog_objects","square_search_customers","square_search_invoices","square_search_orders","square_update_customer","square_upsert_catalog_object","ssh_check_command_exists","ssh_check_file_exists","ssh_create_directory","ssh_delete_file","ssh_download_file","ssh_download_file_v2","ssh_execute_command","ssh_execute_script","ssh_get_system_info","ssh_list_directory","ssh_move_rename","ssh_read_file_content","ssh_upload_file","ssh_write_file_content","ssm_cancel_command","ssm_delete_parameter","ssm_describe_automation_executions","ssm_describe_instance_information","ssm_describe_instance_patch_states","ssm_describe_instance_patches","ssm_describe_parameters","ssm_get_automation_execution","ssm_get_command_invocation","ssm_get_document","ssm_get_parameter","ssm_get_parameters","ssm_get_parameters_by_path","ssm_list_command_invocations","ssm_list_commands","ssm_list_compliance_items","ssm_list_compliance_summaries","ssm_list_documents","ssm_put_parameter","ssm_send_command","ssm_start_automation_execution","ssm_stop_automation_execution","stagehand_agent","stagehand_extract","stripe_cancel_payment_intent","stripe_cancel_subscription","stripe_capture_charge","stripe_capture_payment_intent","stripe_confirm_payment_intent","stripe_create_charge","stripe_create_customer","stripe_create_invoice","stripe_create_payment_intent","stripe_create_price","stripe_create_product","stripe_create_subscription","stripe_delete_customer","stripe_delete_invoice","stripe_delete_product","stripe_finalize_invoice","stripe_list_charges","stripe_list_customers","stripe_list_events","stripe_list_invoices","stripe_list_payment_intents","stripe_list_prices","stripe_list_products","stripe_list_subscriptions","stripe_pay_invoice","stripe_resume_subscription","stripe_retrieve_charge","stripe_retrieve_customer","stripe_retrieve_event","stripe_retrieve_invoice","stripe_retrieve_payment_intent","stripe_retrieve_price","stripe_retrieve_product","stripe_retrieve_subscription","stripe_search_charges","stripe_search_customers","stripe_search_invoices","stripe_search_payment_intents","stripe_search_prices","stripe_search_products","stripe_search_subscriptions","stripe_send_invoice","stripe_update_charge","stripe_update_customer","stripe_update_invoice","stripe_update_payment_intent","stripe_update_price","stripe_update_product","stripe_update_subscription","stripe_void_invoice","sts_assume_role","sts_assume_role_with_saml","sts_assume_role_with_web_identity","sts_get_access_key_info","sts_get_caller_identity","sts_get_session_token","stt_assemblyai","stt_assemblyai_v2","stt_deepgram","stt_deepgram_v2","stt_elevenlabs","stt_elevenlabs_v2","stt_gemini","stt_gemini_v2","stt_whisper","stt_whisper_v2","supabase_count","supabase_delete","supabase_get_row","supabase_insert","supabase_introspect","supabase_invoke_function","supabase_query","supabase_rpc","supabase_storage_copy","supabase_storage_create_bucket","supabase_storage_create_signed_upload_url","supabase_storage_create_signed_url","supabase_storage_delete","supabase_storage_delete_bucket","supabase_storage_download","supabase_storage_empty_bucket","supabase_storage_get_public_url","supabase_storage_list","supabase_storage_list_buckets","supabase_storage_move","supabase_storage_update_bucket","supabase_storage_upload","supabase_text_search","supabase_update","supabase_upsert","supabase_vector_search","table_batch_insert_rows","table_create","table_delete_row","table_delete_rows_by_filter","table_get_row","table_get_schema","table_insert_row","table_list","table_query_rows","table_query_rows_v2","table_update_row","table_update_rows_by_filter","table_upsert_row","tailscale_authorize_device","tailscale_create_auth_key","tailscale_delete_auth_key","tailscale_delete_device","tailscale_delete_user","tailscale_expire_device_key","tailscale_get_acl","tailscale_get_auth_key","tailscale_get_device","tailscale_get_device_routes","tailscale_get_dns_preferences","tailscale_get_dns_searchpaths","tailscale_list_auth_keys","tailscale_list_devices","tailscale_list_dns_nameservers","tailscale_list_users","tailscale_set_acl","tailscale_set_device_routes","tailscale_set_device_tags","tailscale_set_dns_nameservers","tailscale_set_dns_preferences","tailscale_set_dns_searchpaths","tailscale_suspend_user","tailscale_update_device_key","tavily_crawl","tavily_extract","tavily_map","tavily_search","telegram_copy_message","telegram_delete_message","telegram_edit_message_text","telegram_forward_message","telegram_get_chat","telegram_get_chat_member","telegram_message","telegram_pin_message","telegram_send_animation","telegram_send_audio","telegram_send_chat_action","telegram_send_contact","telegram_send_document","telegram_send_location","telegram_send_photo","telegram_send_poll","telegram_send_video","telegram_set_message_reaction","telegram_unpin_message","temporal_cancel_workflow","temporal_count_workflows","temporal_create_schedule","temporal_delete_schedule","temporal_describe_schedule","temporal_describe_task_queue","temporal_describe_workflow","temporal_get_workflow_history","temporal_list_schedules","temporal_list_workflows","temporal_pause_schedule","temporal_query_workflow","temporal_reset_workflow","temporal_signal_with_start","temporal_signal_workflow","temporal_start_workflow","temporal_terminate_workflow","temporal_trigger_schedule","temporal_unpause_schedule","temporal_update_workflow","textract_analyze_expense","textract_analyze_id","textract_parser","textract_parser_v2","thinking_tool","thrive_add_audience_managers","thrive_add_audience_members","thrive_add_user_tags","thrive_create_assignment","thrive_create_audience","thrive_create_completion","thrive_create_user","thrive_delete_assignment","thrive_delete_audience","thrive_delete_user","thrive_get_activity","thrive_get_assignment","thrive_get_audience","thrive_get_completion","thrive_get_content","thrive_get_cpd_category","thrive_get_cpd_entry","thrive_get_cpd_requirement","thrive_get_enrolment","thrive_get_skill_levels","thrive_get_tag","thrive_get_user_by_id","thrive_get_user_by_ref","thrive_list_assignments","thrive_list_audience_managers","thrive_list_audience_members","thrive_list_audiences","thrive_list_completions","thrive_list_enrolments","thrive_list_tags","thrive_query_activities","thrive_query_content","thrive_query_cpd_categories","thrive_query_cpd_entries","thrive_query_cpd_requirements","thrive_query_cpd_user_summaries","thrive_remove_audience_manager","thrive_remove_audience_member","thrive_remove_user_tags","thrive_replace_audience_managers","thrive_replace_audience_members","thrive_search_users","thrive_suspend_user","thrive_update_assignment","thrive_update_audience","thrive_update_user","thrive_update_user_skills","tiktok_get_post_status","tiktok_get_user","tiktok_list_videos","tiktok_query_videos","tiktok_upload_video_draft","tinybird_append_datasource","tinybird_delete_datasource_rows","tinybird_events","tinybird_get_job","tinybird_query","tinybird_query_pipe","tinybird_truncate_datasource","tinyfish_cancel_run","tinyfish_fetch","tinyfish_get_run","tinyfish_list_profiles","tinyfish_list_runs","tinyfish_list_vault_items","tinyfish_run","tinyfish_run_async","tinyfish_search","trello_add_checklist","trello_add_checklist_item","trello_add_comment","trello_add_label","trello_add_member","trello_create_board","trello_create_card","trello_create_list","trello_delete_card","trello_get_actions","trello_get_board","trello_get_card","trello_list_cards","trello_list_lists","trello_list_members","trello_remove_label","trello_remove_member","trello_search","trello_update_card","trello_update_checklist_item","trello_update_list","trigger_dev_activate_schedule","trigger_dev_add_run_tags","trigger_dev_batch_trigger_task","trigger_dev_cancel_run","trigger_dev_complete_waitpoint_token","trigger_dev_create_env_var","trigger_dev_create_schedule","trigger_dev_create_waitpoint_token","trigger_dev_deactivate_schedule","trigger_dev_delete_env_var","trigger_dev_delete_schedule","trigger_dev_execute_query","trigger_dev_get_batch","trigger_dev_get_batch_results","trigger_dev_get_deployment","trigger_dev_get_env_var","trigger_dev_get_latest_deployment","trigger_dev_get_query_schema","trigger_dev_get_queue","trigger_dev_get_run","trigger_dev_get_run_events","trigger_dev_get_run_result","trigger_dev_get_run_trace","trigger_dev_get_schedule","trigger_dev_get_waitpoint_token","trigger_dev_import_env_vars","trigger_dev_list_deployments","trigger_dev_list_env_vars","trigger_dev_list_queues","trigger_dev_list_runs","trigger_dev_list_schedules","trigger_dev_list_timezones","trigger_dev_list_waitpoint_tokens","trigger_dev_override_queue_concurrency","trigger_dev_pause_queue","trigger_dev_promote_deployment","trigger_dev_replay_run","trigger_dev_reschedule_run","trigger_dev_reset_queue_concurrency","trigger_dev_resume_queue","trigger_dev_trigger_task","trigger_dev_update_env_var","trigger_dev_update_run_metadata","trigger_dev_update_schedule","tts_azure","tts_cartesia","tts_deepgram","tts_elevenlabs","tts_google","tts_openai","tts_playht","twilio_send_sms","twilio_voice_get_recording","twilio_voice_list_calls","twilio_voice_make_call","typeform_create_form","typeform_delete_form","typeform_files","typeform_get_form","typeform_insights","typeform_list_forms","typeform_responses","typeform_update_form","upstash_redis_command","upstash_redis_delete","upstash_redis_exists","upstash_redis_expire","upstash_redis_get","upstash_redis_hget","upstash_redis_hgetall","upstash_redis_hset","upstash_redis_incr","upstash_redis_incrby","upstash_redis_keys","upstash_redis_lpush","upstash_redis_lrange","upstash_redis_set","upstash_redis_setnx","upstash_redis_ttl","uptimerobot_create_alert_contact","uptimerobot_create_maintenance_window","uptimerobot_create_monitor","uptimerobot_create_psp","uptimerobot_delete_alert_contact","uptimerobot_delete_maintenance_window","uptimerobot_delete_monitor","uptimerobot_delete_psp","uptimerobot_get_account","uptimerobot_get_alert_contact","uptimerobot_get_incident","uptimerobot_get_maintenance_window","uptimerobot_get_monitor","uptimerobot_get_psp","uptimerobot_list_alert_contacts","uptimerobot_list_incidents","uptimerobot_list_maintenance_windows","uptimerobot_list_monitors","uptimerobot_list_psps","uptimerobot_pause_monitor","uptimerobot_start_monitor","uptimerobot_update_maintenance_window","uptimerobot_update_monitor","uptimerobot_update_psp","vanta_download_document_file","vanta_get_control","vanta_get_document","vanta_get_framework","vanta_get_person","vanta_get_policy","vanta_get_risk_scenario","vanta_get_test","vanta_get_vendor","vanta_get_vulnerable_asset","vanta_list_control_documents","vanta_list_control_tests","vanta_list_controls","vanta_list_document_uploads","vanta_list_documents","vanta_list_framework_controls","vanta_list_frameworks","vanta_list_monitored_computers","vanta_list_people","vanta_list_policies","vanta_list_risk_scenarios","vanta_list_test_entities","vanta_list_tests","vanta_list_vendors","vanta_list_vulnerabilities","vanta_list_vulnerability_remediations","vanta_list_vulnerable_assets","vanta_submit_document","vanta_upload_document_file","vercel_add_domain","vercel_add_project_domain","vercel_cancel_deployment","vercel_create_alias","vercel_create_check","vercel_create_deployment","vercel_create_dns_record","vercel_create_edge_config","vercel_create_env_var","vercel_create_project","vercel_create_webhook","vercel_delete_alias","vercel_delete_deployment","vercel_delete_dns_record","vercel_delete_domain","vercel_delete_edge_config","vercel_delete_env_var","vercel_delete_project","vercel_delete_webhook","vercel_get_alias","vercel_get_check","vercel_get_deployment","vercel_get_deployment_events","vercel_get_domain","vercel_get_domain_config","vercel_get_edge_config","vercel_get_edge_config_items","vercel_get_env_vars","vercel_get_project","vercel_get_team","vercel_get_user","vercel_get_webhook","vercel_list_aliases","vercel_list_checks","vercel_list_deployment_files","vercel_list_deployments","vercel_list_dns_records","vercel_list_domains","vercel_list_edge_configs","vercel_list_project_domains","vercel_list_projects","vercel_list_team_members","vercel_list_teams","vercel_list_webhooks","vercel_pause_project","vercel_promote_deployment","vercel_remove_project_domain","vercel_rerequest_check","vercel_unpause_project","vercel_update_check","vercel_update_dns_record","vercel_update_edge_config_items","vercel_update_env_var","vercel_update_project","vercel_update_project_domain","vercel_verify_project_domain","video_falai","video_luma","video_minimax","video_runway","video_veo","vision_tool","vision_tool_v2","wealthbox_read_contact","wealthbox_read_note","wealthbox_read_task","wealthbox_write_contact","wealthbox_write_note","wealthbox_write_task","webflow_create_item","webflow_delete_item","webflow_get_item","webflow_list_items","webflow_update_item","webhook_request","whatsapp_get_media","whatsapp_mark_read","whatsapp_send_interactive","whatsapp_send_media","whatsapp_send_message","whatsapp_send_reaction","whatsapp_send_template","whatsapp_upload_media","wikipedia_content","wikipedia_random","wikipedia_search","wikipedia_summary","windchill_check_in_document","windchill_check_in_documents","windchill_check_out_document","windchill_check_out_documents","windchill_create_document","windchill_create_documents","windchill_delete_document","windchill_delete_documents","windchill_download_attachment","windchill_download_primary_content","windchill_get_document","windchill_get_document_structure","windchill_get_primary_content","windchill_get_valid_state_transitions","windchill_list_attachments","windchill_list_documents","windchill_revise_document","windchill_revise_documents","windchill_set_lifecycle_state","windchill_undo_check_out_document","windchill_undo_check_out_documents","windchill_update_common_properties","windchill_update_document","windchill_update_document_security_labels","windchill_update_documents","windchill_upload_attachments","windchill_upload_primary_content","wiza_company_enrichment","wiza_get_credits","wiza_individual_reveal","wiza_prospect_search","wordpress_create_category","wordpress_create_comment","wordpress_create_page","wordpress_create_post","wordpress_create_tag","wordpress_delete_category","wordpress_delete_comment","wordpress_delete_media","wordpress_delete_page","wordpress_delete_post","wordpress_delete_tag","wordpress_get_category","wordpress_get_current_user","wordpress_get_media","wordpress_get_page","wordpress_get_post","wordpress_get_tag","wordpress_get_user","wordpress_list_categories","wordpress_list_comments","wordpress_list_media","wordpress_list_pages","wordpress_list_posts","wordpress_list_tags","wordpress_list_users","wordpress_search_content","wordpress_update_category","wordpress_update_comment","wordpress_update_page","wordpress_update_post","wordpress_update_tag","wordpress_upload_media","workday_assign_onboarding","workday_change_job","workday_create_prehire","workday_get_compensation","workday_get_organizations","workday_get_worker","workday_hire_employee","workday_list_workers","workday_terminate_worker","workday_update_worker","workflow_executor","x_create_bookmark","x_create_tweet","x_delete_bookmark","x_delete_tweet","x_get_blocking","x_get_bookmarks","x_get_followers","x_get_following","x_get_liked_tweets","x_get_liking_users","x_get_me","x_get_personalized_trends","x_get_quote_tweets","x_get_retweeted_by","x_get_trends_by_woeid","x_get_tweets_by_ids","x_get_usage","x_get_user_mentions","x_get_user_timeline","x_get_user_tweets","x_hide_reply","x_manage_block","x_manage_follow","x_manage_like","x_manage_mute","x_manage_retweet","x_read","x_search","x_search_tweets","x_search_users","x_user","x_write","youcom_answer","youcom_finance_research","youcom_get_account_balance","youcom_get_contents","youcom_get_research_task","youcom_research","youcom_search","youcom_search_images","youtube_channel_info","youtube_channel_playlists","youtube_channel_videos","youtube_comments","youtube_playlist_items","youtube_search","youtube_trending","youtube_video_categories","youtube_video_details","zendesk_autocomplete_organizations","zendesk_create_organization","zendesk_create_organizations_bulk","zendesk_create_ticket","zendesk_create_tickets_bulk","zendesk_create_user","zendesk_create_users_bulk","zendesk_delete_organization","zendesk_delete_ticket","zendesk_delete_user","zendesk_get_current_user","zendesk_get_organization","zendesk_get_organizations","zendesk_get_ticket","zendesk_get_tickets","zendesk_get_user","zendesk_get_users","zendesk_merge_tickets","zendesk_search","zendesk_search_count","zendesk_search_users","zendesk_update_organization","zendesk_update_ticket","zendesk_update_tickets_bulk","zendesk_update_user","zendesk_update_users_bulk","zep_add_messages","zep_add_user","zep_create_thread","zep_delete_thread","zep_get_context","zep_get_messages","zep_get_threads","zep_get_user","zep_get_user_threads","zerobounce_get_credits","zerobounce_verify_email","zoho_desk_add_comment","zoho_desk_create_account","zoho_desk_create_contact","zoho_desk_create_ticket","zoho_desk_delete_comment","zoho_desk_get_account","zoho_desk_get_agent","zoho_desk_get_attachment","zoho_desk_get_comment","zoho_desk_get_contact","zoho_desk_get_department","zoho_desk_get_thread","zoho_desk_get_ticket","zoho_desk_list_accounts","zoho_desk_list_agents","zoho_desk_list_comments","zoho_desk_list_contacts","zoho_desk_list_departments","zoho_desk_list_organizations","zoho_desk_list_threads","zoho_desk_list_tickets","zoho_desk_move_ticket","zoho_desk_search_accounts","zoho_desk_search_contacts","zoho_desk_search_tickets","zoho_desk_send_reply","zoho_desk_update_account","zoho_desk_update_comment","zoho_desk_update_contact","zoho_desk_update_ticket","zoom_create_meeting","zoom_delete_meeting","zoom_delete_recording","zoom_get_meeting","zoom_get_meeting_invitation","zoom_get_meeting_recordings","zoom_list_meetings","zoom_list_past_participants","zoom_list_recordings","zoom_update_meeting","zoominfo_enrich_companies","zoominfo_enrich_contacts","zoominfo_search_companies","zoominfo_search_contacts","zoominfo_search_intent","zoominfo_search_news"]' + '["a2a_cancel_task","a2a_get_agent_card","a2a_get_task","a2a_send_message","affinity_batch_update_entity_fields","affinity_batch_update_list_entry_fields","affinity_create_list","affinity_create_list_field_dropdown_option","affinity_create_merge","affinity_create_note","affinity_create_reminder","affinity_delete_list_field_dropdown_option","affinity_delete_note","affinity_get_company","affinity_get_current_user","affinity_get_entity_field_value","affinity_get_list","affinity_get_list_entry","affinity_get_list_entry_field","affinity_get_list_field_dropdown_option","affinity_get_merge","affinity_get_merge_task","affinity_get_note","affinity_get_opportunity","affinity_get_person","affinity_get_saved_view","affinity_get_transcript","affinity_get_user","affinity_list_calls","affinity_list_chat_messages","affinity_list_companies","affinity_list_coworker_connections","affinity_list_emails","affinity_list_entity_field_values","affinity_list_entity_list_entries","affinity_list_entity_lists","affinity_list_entity_notes","affinity_list_entity_relationships","affinity_list_field_dropdown_options","affinity_list_field_metadata","affinity_list_field_value_changes","affinity_list_investor_executive_connections","affinity_list_list_entries","affinity_list_list_entry_field_value_changes","affinity_list_list_entry_fields","affinity_list_list_field_dropdown_options","affinity_list_list_fields","affinity_list_lists","affinity_list_meetings","affinity_list_merge_tasks","affinity_list_merges","affinity_list_note_attached_companies","affinity_list_note_attached_opportunities","affinity_list_note_attached_persons","affinity_list_note_replies","affinity_list_notes","affinity_list_opportunities","affinity_list_persons","affinity_list_reminders","affinity_list_saved_view_entries","affinity_list_saved_views","affinity_list_transcript_fragments","affinity_list_transcripts","affinity_list_users","affinity_search_companies","affinity_search_files","affinity_search_list_entries","affinity_search_notes","affinity_search_persons","affinity_semantic_search","affinity_update_entity_field_value","affinity_update_list_entry_field","affinity_update_list_field_dropdown_option","affinity_update_note","agentmail_create_draft","agentmail_create_inbox","agentmail_delete_draft","agentmail_delete_inbox","agentmail_delete_thread","agentmail_forward_message","agentmail_get_draft","agentmail_get_inbox","agentmail_get_message","agentmail_get_thread","agentmail_list_drafts","agentmail_list_inboxes","agentmail_list_messages","agentmail_list_threads","agentmail_reply_message","agentmail_send_draft","agentmail_send_message","agentmail_update_draft","agentmail_update_inbox","agentmail_update_message","agentmail_update_thread","agentphone_create_call","agentphone_create_contact","agentphone_create_number","agentphone_delete_contact","agentphone_get_call","agentphone_get_call_transcript","agentphone_get_contact","agentphone_get_conversation","agentphone_get_conversation_messages","agentphone_get_number_messages","agentphone_get_usage","agentphone_get_usage_daily","agentphone_get_usage_monthly","agentphone_list_calls","agentphone_list_contacts","agentphone_list_conversations","agentphone_list_numbers","agentphone_react_to_message","agentphone_release_number","agentphone_send_message","agentphone_update_contact","agentphone_update_conversation","agiloft_async_status","agiloft_attach_file","agiloft_attachment_info","agiloft_create_record","agiloft_delete_record","agiloft_get_choice_line_id","agiloft_list_tables","agiloft_lock_record","agiloft_nlp_search","agiloft_read_record","agiloft_remove_attachment","agiloft_retrieve_attachment","agiloft_run_action_button","agiloft_saved_search","agiloft_search_records","agiloft_select_records","agiloft_update_record","agiloft_upsert_record","ahrefs_anchors","ahrefs_backlinks","ahrefs_backlinks_stats","ahrefs_batch_analysis","ahrefs_broken_backlinks","ahrefs_domain_rating","ahrefs_domain_rating_history","ahrefs_keyword_overview","ahrefs_keywords_history","ahrefs_metrics","ahrefs_metrics_history","ahrefs_organic_competitors","ahrefs_organic_keywords","ahrefs_paid_pages","ahrefs_rank_tracker_competitors_overview","ahrefs_rank_tracker_competitors_stats","ahrefs_rank_tracker_overview","ahrefs_rank_tracker_serp_overview","ahrefs_refdomains_history","ahrefs_referring_domains","ahrefs_related_terms","ahrefs_site_audit_page_explorer","ahrefs_top_pages","airtable_create_records","airtable_delete_records","airtable_get_base_schema","airtable_get_record","airtable_list_bases","airtable_list_records","airtable_list_tables","airtable_update_multiple_records","airtable_update_record","airtable_upsert_records","algolia_add_record","algolia_batch_operations","algolia_browse_records","algolia_clear_records","algolia_copy_move_index","algolia_delete_by_filter","algolia_delete_index","algolia_delete_record","algolia_get_record","algolia_get_records","algolia_get_settings","algolia_get_task_status","algolia_list_indices","algolia_partial_update_record","algolia_search","algolia_update_settings","amplitude_event_segmentation","amplitude_funnels","amplitude_get_active_users","amplitude_get_revenue","amplitude_group_identify","amplitude_identify_user","amplitude_list_events","amplitude_realtime_active_users","amplitude_retention","amplitude_send_event","amplitude_user_activity","amplitude_user_profile","amplitude_user_search","apify_get_dataset_items","apify_get_run","apify_run_actor_async","apify_run_actor_sync","apify_run_task","apollo_account_bulk_create","apollo_account_bulk_update","apollo_account_create","apollo_account_search","apollo_account_update","apollo_contact_bulk_create","apollo_contact_bulk_update","apollo_contact_create","apollo_contact_search","apollo_contact_update","apollo_email_accounts","apollo_opportunity_create","apollo_opportunity_get","apollo_opportunity_search","apollo_opportunity_update","apollo_organization_bulk_enrich","apollo_organization_enrich","apollo_organization_search","apollo_people_bulk_enrich","apollo_people_enrich","apollo_people_search","apollo_sequence_add_contacts","apollo_sequence_search","apollo_task_create","apollo_task_search","appconfig_create_application","appconfig_create_configuration_profile","appconfig_create_environment","appconfig_create_hosted_configuration_version","appconfig_delete_application","appconfig_delete_configuration_profile","appconfig_delete_environment","appconfig_delete_hosted_configuration_version","appconfig_get_application","appconfig_get_configuration","appconfig_get_configuration_profile","appconfig_get_deployment","appconfig_get_environment","appconfig_get_hosted_configuration_version","appconfig_list_applications","appconfig_list_configuration_profiles","appconfig_list_deployment_strategies","appconfig_list_deployments","appconfig_list_environments","appconfig_list_hosted_configuration_versions","appconfig_start_deployment","appconfig_stop_deployment","appconfig_update_application","appconfig_update_configuration_profile","appconfig_update_environment","arxiv_get_author_papers","arxiv_get_paper","arxiv_search","asana_add_comment","asana_add_followers","asana_create_project","asana_create_section","asana_create_subtask","asana_create_task","asana_delete_task","asana_get_project","asana_get_projects","asana_get_task","asana_list_sections","asana_list_workspaces","asana_search_tasks","asana_update_task","ashby_add_candidate_tag","ashby_anonymize_candidate","ashby_change_application_source","ashby_change_application_stage","ashby_create_application","ashby_create_candidate","ashby_create_note","ashby_delete_application","ashby_get_application","ashby_get_candidate","ashby_get_job","ashby_get_job_posting","ashby_get_offer","ashby_get_opening","ashby_list_application_feedback","ashby_list_application_history","ashby_list_applications","ashby_list_archive_reasons","ashby_list_candidate_tags","ashby_list_candidates","ashby_list_custom_fields","ashby_list_departments","ashby_list_interview_plans","ashby_list_interview_stages","ashby_list_interviews","ashby_list_job_postings","ashby_list_jobs","ashby_list_locations","ashby_list_notes","ashby_list_offers","ashby_list_openings","ashby_list_sources","ashby_list_users","ashby_remove_candidate_tag","ashby_search_candidates","ashby_search_jobs","ashby_search_openings","ashby_search_users","ashby_set_custom_field_value","ashby_set_custom_field_values","ashby_transfer_application","ashby_update_candidate","ashby_upload_candidate_file","ashby_upload_resume","athena_batch_get_named_query","athena_batch_get_prepared_statement","athena_batch_get_query_execution","athena_create_named_query","athena_create_prepared_statement","athena_delete_named_query","athena_delete_prepared_statement","athena_get_data_catalog","athena_get_database","athena_get_named_query","athena_get_prepared_statement","athena_get_query_execution","athena_get_query_results","athena_get_query_runtime_statistics","athena_get_table_metadata","athena_get_work_group","athena_list_data_catalogs","athena_list_databases","athena_list_named_queries","athena_list_prepared_statements","athena_list_query_executions","athena_list_table_metadata","athena_list_work_groups","athena_start_query","athena_stop_query","athena_update_named_query","athena_update_prepared_statement","attio_assert_record","attio_create_attribute","attio_create_comment","attio_create_list","attio_create_list_entry","attio_create_note","attio_create_object","attio_create_record","attio_create_task","attio_create_webhook","attio_delete_comment","attio_delete_list_entry","attio_delete_note","attio_delete_record","attio_delete_task","attio_delete_webhook","attio_get_attribute","attio_get_comment","attio_get_list","attio_get_list_entry","attio_get_member","attio_get_note","attio_get_object","attio_get_record","attio_get_task","attio_get_thread","attio_get_webhook","attio_list_attributes","attio_list_lists","attio_list_members","attio_list_notes","attio_list_objects","attio_list_records","attio_list_tasks","attio_list_threads","attio_list_webhooks","attio_query_list_entries","attio_search_records","attio_update_attribute","attio_update_list","attio_update_list_entry","attio_update_object","attio_update_record","attio_update_task","attio_update_webhook","azure_data_explorer_create_table","azure_data_explorer_drop_table","azure_data_explorer_ingest_from_query","azure_data_explorer_ingest_inline","azure_data_explorer_list_databases","azure_data_explorer_list_functions","azure_data_explorer_list_tables","azure_data_explorer_management","azure_data_explorer_query","azure_data_explorer_show_database_schema","azure_data_explorer_show_ingestion_failures","azure_data_explorer_show_operations","azure_data_explorer_show_table_details","azure_data_explorer_show_table_schema","azure_devops_add_comment","azure_devops_create_work_item","azure_devops_get_build_log","azure_devops_get_build_timeline","azure_devops_get_comments","azure_devops_get_pipeline","azure_devops_get_pipeline_run","azure_devops_get_work_item","azure_devops_get_work_items_batch","azure_devops_get_work_items_between_builds","azure_devops_list_build_logs","azure_devops_list_builds","azure_devops_list_pipeline_runs","azure_devops_list_pipelines","azure_devops_query_work_items","azure_devops_update_work_item","bitbucket_approve_pull_request","bitbucket_create_branch","bitbucket_create_pull_request","bitbucket_create_pull_request_comment","bitbucket_decline_pull_request","bitbucket_delete_branch","bitbucket_get_commit","bitbucket_get_file","bitbucket_get_file_metadata","bitbucket_get_pipeline","bitbucket_get_pipeline_step_log","bitbucket_get_pull_request","bitbucket_get_pull_request_diff","bitbucket_get_pull_request_diffstat","bitbucket_get_pull_request_merge_task_status","bitbucket_get_repository","bitbucket_list_branches","bitbucket_list_commits","bitbucket_list_directory","bitbucket_list_pipeline_steps","bitbucket_list_pipelines","bitbucket_list_pull_request_comments","bitbucket_list_pull_request_commit_statuses","bitbucket_list_pull_requests","bitbucket_list_repositories","bitbucket_list_workspaces","bitbucket_merge_pull_request","bitbucket_request_pull_request_changes","bitbucket_stop_pipeline","bitbucket_trigger_pipeline","box_copy_file","box_create_folder","box_delete_file","box_delete_folder","box_download_file","box_download_file_v2","box_get_file_info","box_list_folder_items","box_search","box_sign_cancel_request","box_sign_create_request","box_sign_get_request","box_sign_list_requests","box_sign_resend_request","box_update_file","box_upload_file","brandfetch_get_brand","brandfetch_search","brex_archive_budget","brex_create_budget","brex_create_spend_limit","brex_create_transfer","brex_create_vendor","brex_get_budget","brex_get_cash_account","brex_get_company","brex_get_current_user","brex_get_expense","brex_get_spend_limit","brex_get_transfer","brex_get_user","brex_get_vendor","brex_list_budgets","brex_list_card_accounts","brex_list_card_statements","brex_list_card_transactions","brex_list_cards","brex_list_cash_accounts","brex_list_cash_statements","brex_list_cash_transactions","brex_list_departments","brex_list_expenses","brex_list_locations","brex_list_spend_limits","brex_list_titles","brex_list_transfers","brex_list_users","brex_list_vendors","brex_match_receipt","brex_update_expense","brex_update_vendor","brex_upload_receipt","brightdata_cancel_snapshot","brightdata_discover","brightdata_download_snapshot","brightdata_scrape_dataset","brightdata_scrape_url","brightdata_serp_search","brightdata_snapshot_status","brightdata_sync_scrape","browser_use_run_task","buffer_create_idea","buffer_create_post","buffer_delete_post","buffer_edit_post","buffer_get_account","buffer_get_aggregated_post_metrics","buffer_get_channel","buffer_get_channels","buffer_get_daily_posting_limits","buffer_get_idea_groups","buffer_get_ideas","buffer_get_post","buffer_get_posts","calcom_cancel_booking","calcom_confirm_booking","calcom_create_booking","calcom_create_event_type","calcom_create_schedule","calcom_decline_booking","calcom_delete_event_type","calcom_delete_schedule","calcom_get_booking","calcom_get_default_schedule","calcom_get_event_type","calcom_get_schedule","calcom_get_slots","calcom_list_bookings","calcom_list_event_types","calcom_list_schedules","calcom_reschedule_booking","calcom_update_event_type","calcom_update_schedule","calendly_cancel_event","calendly_create_event_invitee","calendly_create_invitee_no_show","calendly_create_scheduling_link","calendly_create_webhook","calendly_delete_invitee_no_show","calendly_delete_webhook","calendly_get_current_user","calendly_get_event_invitee","calendly_get_event_type","calendly_get_scheduled_event","calendly_get_user","calendly_list_event_invitees","calendly_list_event_type_available_times","calendly_list_event_types","calendly_list_organization_memberships","calendly_list_routing_form_submissions","calendly_list_routing_forms","calendly_list_scheduled_events","calendly_list_user_availability_schedules","calendly_list_user_busy_times","calendly_list_webhooks","cbinsights_chat","cbinsights_get_commercial_maturity_history","cbinsights_get_exit_probability_history","cbinsights_get_mosaic_history","cbinsights_get_org_business_relationships","cbinsights_get_org_funding_window","cbinsights_get_org_fundings","cbinsights_get_org_investments","cbinsights_get_org_management_and_board","cbinsights_get_org_outlook","cbinsights_get_org_portfolio_exits","cbinsights_get_org_revenue","cbinsights_get_scouting_report","cbinsights_get_strategy_map","cbinsights_list_business_relationships","cbinsights_list_funding_window","cbinsights_list_fundings","cbinsights_list_investments","cbinsights_list_management_and_board","cbinsights_list_outlook","cbinsights_list_portfolio_exits","cbinsights_list_revenue","cbinsights_lookup_organizations","cbinsights_rag","cbinsights_search_firmographics","checkr_add_report_tag","checkr_apply_report_review_action","checkr_cancel_adverse_action","checkr_cancel_continuous_check","checkr_cancel_invitation","checkr_cancel_subscription","checkr_complete_report","checkr_create_adverse_action","checkr_create_candidate","checkr_create_continuous_check","checkr_create_geo","checkr_create_invitation","checkr_create_report","checkr_create_subscription","checkr_delete_candidate_pii","checkr_delete_geo","checkr_get_account","checkr_get_adverse_action","checkr_get_candidate","checkr_get_continuous_check","checkr_get_document","checkr_get_geo","checkr_get_invitation","checkr_get_node","checkr_get_package","checkr_get_program","checkr_get_report","checkr_get_report_eta","checkr_get_report_progressive_status","checkr_get_report_tags","checkr_get_screening","checkr_get_subscription","checkr_get_verification","checkr_list_adverse_actions","checkr_list_adverse_items","checkr_list_assessments","checkr_list_candidate_documents","checkr_list_candidates","checkr_list_continuous_checks","checkr_list_counties","checkr_list_geos","checkr_list_invitations","checkr_list_nodes","checkr_list_packages","checkr_list_programs","checkr_list_report_addresses","checkr_list_subscriptions","checkr_list_users","checkr_list_verifications","checkr_remove_report_tag","checkr_set_report_tags","checkr_update_candidate","checkr_update_continuous_check","checkr_update_geo","checkr_update_report","checkr_update_subscription","circleback_add_tag_to_meetings","circleback_create_tag","circleback_delete_action_item","circleback_delete_meeting","circleback_delete_tag","circleback_get_company","circleback_get_meeting","circleback_get_person","circleback_get_transcript","circleback_list_action_items","circleback_list_calendar_events","circleback_list_companies","circleback_list_meetings","circleback_list_people","circleback_list_tags","circleback_remove_tag_from_meetings","circleback_search_meetings","circleback_update_action_item","circleback_update_meeting","circleback_update_tag","clay_populate","clerk_add_organization_member","clerk_ban_user","clerk_create_actor_token","clerk_create_allowlist_identifier","clerk_create_blocklist_identifier","clerk_create_organization","clerk_create_organization_invitation","clerk_create_user","clerk_delete_allowlist_identifier","clerk_delete_blocklist_identifier","clerk_delete_organization","clerk_delete_user","clerk_get_jwt_template","clerk_get_organization","clerk_get_session","clerk_get_user","clerk_get_user_oauth_token","clerk_list_allowlist_identifiers","clerk_list_blocklist_identifiers","clerk_list_jwt_templates","clerk_list_organization_invitations","clerk_list_organization_memberships","clerk_list_organizations","clerk_list_sessions","clerk_list_users","clerk_lock_user","clerk_remove_organization_member","clerk_revoke_actor_token","clerk_revoke_session","clerk_unban_user","clerk_unlock_user","clerk_update_organization","clerk_update_organization_membership","clerk_update_user","clickhouse_count_rows","clickhouse_create_database","clickhouse_create_table","clickhouse_delete","clickhouse_describe_table","clickhouse_drop_database","clickhouse_drop_partition","clickhouse_drop_table","clickhouse_execute","clickhouse_insert","clickhouse_insert_rows","clickhouse_introspect","clickhouse_kill_query","clickhouse_list_clusters","clickhouse_list_databases","clickhouse_list_mutations","clickhouse_list_partitions","clickhouse_list_running_queries","clickhouse_list_tables","clickhouse_optimize_table","clickhouse_query","clickhouse_rename_table","clickhouse_show_create_table","clickhouse_table_stats","clickhouse_truncate_table","clickhouse_update","clickup_add_tag_to_task","clickup_create_checklist","clickup_create_checklist_item","clickup_create_comment","clickup_create_folder","clickup_create_list","clickup_create_task","clickup_create_time_entry","clickup_delete_checklist","clickup_delete_checklist_item","clickup_delete_comment","clickup_delete_task","clickup_delete_time_entry","clickup_get_comments","clickup_get_custom_fields","clickup_get_folders","clickup_get_list_members","clickup_get_lists","clickup_get_running_timer","clickup_get_space_tags","clickup_get_spaces","clickup_get_task","clickup_get_task_members","clickup_get_tasks","clickup_get_time_entries","clickup_get_workspaces","clickup_remove_custom_field_value","clickup_remove_tag_from_task","clickup_search_tasks","clickup_set_custom_field_value","clickup_start_timer","clickup_stop_timer","clickup_update_checklist","clickup_update_checklist_item","clickup_update_comment","clickup_update_task","clickup_update_time_entry","clickup_upload_attachment","cloudflare_create_access_application","cloudflare_create_access_group","cloudflare_create_access_policy","cloudflare_create_access_service_token","cloudflare_create_dns_record","cloudflare_create_r2_bucket","cloudflare_create_rate_limit_rule","cloudflare_create_ruleset","cloudflare_create_ruleset_rule","cloudflare_create_tunnel","cloudflare_create_worker_route","cloudflare_create_zone","cloudflare_delete_access_application","cloudflare_delete_access_group","cloudflare_delete_access_policy","cloudflare_delete_dns_record","cloudflare_delete_r2_bucket","cloudflare_delete_r2_bucket_cors","cloudflare_delete_ruleset","cloudflare_delete_ruleset_rule","cloudflare_delete_tunnel","cloudflare_delete_worker_route","cloudflare_delete_worker_script","cloudflare_delete_zone","cloudflare_dns_analytics","cloudflare_get_access_application","cloudflare_get_access_group","cloudflare_get_access_policy","cloudflare_get_access_service_token","cloudflare_get_dns_record","cloudflare_get_r2_bucket","cloudflare_get_r2_bucket_cors","cloudflare_get_r2_bucket_lifecycle","cloudflare_get_ruleset","cloudflare_get_ruleset_entrypoint","cloudflare_get_tunnel","cloudflare_get_tunnel_configuration","cloudflare_get_tunnel_token","cloudflare_get_worker_route","cloudflare_get_worker_script_settings","cloudflare_get_zone","cloudflare_get_zone_settings","cloudflare_list_access_applications","cloudflare_list_access_groups","cloudflare_list_access_identity_providers","cloudflare_list_access_policies","cloudflare_list_access_service_tokens","cloudflare_list_certificates","cloudflare_list_dns_records","cloudflare_list_managed_ruleset_overrides","cloudflare_list_r2_buckets","cloudflare_list_rate_limit_rules","cloudflare_list_rulesets","cloudflare_list_tunnels","cloudflare_list_worker_routes","cloudflare_list_worker_scripts","cloudflare_list_zones","cloudflare_purge_cache","cloudflare_refresh_access_service_token","cloudflare_revoke_access_service_token","cloudflare_rotate_access_service_token","cloudflare_update_access_application","cloudflare_update_access_group","cloudflare_update_access_policy","cloudflare_update_access_service_token","cloudflare_update_dns_record","cloudflare_update_r2_bucket_cors","cloudflare_update_r2_bucket_lifecycle","cloudflare_update_rate_limit_rule","cloudflare_update_ruleset","cloudflare_update_ruleset_rule","cloudflare_update_tunnel","cloudflare_update_tunnel_configuration","cloudflare_update_worker_route","cloudflare_update_zone","cloudflare_update_zone_setting","cloudformation_cancel_update_stack","cloudformation_create_change_set","cloudformation_create_stack","cloudformation_delete_stack","cloudformation_describe_change_set","cloudformation_describe_stack_drift_detection_status","cloudformation_describe_stack_events","cloudformation_describe_stacks","cloudformation_detect_stack_drift","cloudformation_execute_change_set","cloudformation_get_template","cloudformation_get_template_summary","cloudformation_list_stack_resources","cloudformation_update_stack","cloudformation_validate_template","cloudtrail_cancel_query","cloudtrail_describe_query","cloudtrail_describe_trails","cloudtrail_get_event_data_store","cloudtrail_get_event_selectors","cloudtrail_get_insight_selectors","cloudtrail_get_query_results","cloudtrail_get_trail","cloudtrail_get_trail_status","cloudtrail_list_event_data_stores","cloudtrail_list_tags","cloudtrail_list_trails","cloudtrail_lookup_events","cloudtrail_start_query","cloudwatch_describe_alarm_history","cloudwatch_describe_alarms","cloudwatch_describe_log_groups","cloudwatch_describe_log_streams","cloudwatch_filter_log_events","cloudwatch_get_log_events","cloudwatch_get_metric_statistics","cloudwatch_list_metrics","cloudwatch_mute_alarm","cloudwatch_put_log_group_retention","cloudwatch_put_metric_data","cloudwatch_query_logs","cloudwatch_unmute_alarm","coda_add_custom_domain","coda_add_permission","coda_change_user_role","coda_create_doc","coda_create_folder","coda_create_page","coda_delete_custom_domain","coda_delete_doc","coda_delete_folder","coda_delete_page","coda_delete_page_content","coda_delete_permission","coda_delete_row","coda_delete_rows","coda_export_page","coda_get_acl_settings","coda_get_analytics_last_updated","coda_get_column","coda_get_control","coda_get_custom_domain_provider","coda_get_doc","coda_get_doc_analytics_summary","coda_get_folder","coda_get_formula","coda_get_mutation_status","coda_get_page","coda_get_page_content","coda_get_page_export_status","coda_get_row","coda_get_sharing_metadata","coda_get_table","coda_list_categories","coda_list_columns","coda_list_controls","coda_list_custom_domains","coda_list_doc_analytics","coda_list_docs","coda_list_folder_children","coda_list_folders","coda_list_formulas","coda_list_page_analytics","coda_list_pages","coda_list_permissions","coda_list_rows","coda_list_tables","coda_list_workspace_members","coda_list_workspace_roles","coda_publish_doc","coda_push_button","coda_resolve_browser_link","coda_search_principals","coda_trigger_automation","coda_unpublish_doc","coda_update_acl_settings","coda_update_doc","coda_update_folder","coda_update_page","coda_update_row","coda_upsert_rows","coda_whoami","codepipeline_disable_stage_transition","codepipeline_enable_stage_transition","codepipeline_get_pipeline","codepipeline_get_pipeline_execution","codepipeline_get_pipeline_state","codepipeline_list_action_executions","codepipeline_list_pipeline_executions","codepipeline_list_pipelines","codepipeline_put_approval_result","codepipeline_retry_stage_execution","codepipeline_start_execution","codepipeline_stop_execution","confluence_add_label","confluence_create_blogpost","confluence_create_comment","confluence_create_page","confluence_create_page_property","confluence_create_space","confluence_create_space_property","confluence_delete_attachment","confluence_delete_blogpost","confluence_delete_comment","confluence_delete_label","confluence_delete_page","confluence_delete_page_property","confluence_delete_space","confluence_delete_space_property","confluence_get_blogpost","confluence_get_page_ancestors","confluence_get_page_children","confluence_get_page_descendants","confluence_get_page_version","confluence_get_pages_by_label","confluence_get_space","confluence_get_task","confluence_get_user","confluence_list_attachments","confluence_list_blogposts","confluence_list_blogposts_in_space","confluence_list_comments","confluence_list_labels","confluence_list_page_properties","confluence_list_page_versions","confluence_list_pages_in_space","confluence_list_space_labels","confluence_list_space_permissions","confluence_list_space_properties","confluence_list_spaces","confluence_list_tasks","confluence_retrieve","confluence_search","confluence_search_in_space","confluence_update","confluence_update_blogpost","confluence_update_comment","confluence_update_space","confluence_update_task","confluence_upload_attachment","context_dev_classify_naics","context_dev_classify_sic","context_dev_crawl","context_dev_extract","context_dev_extract_product","context_dev_extract_products","context_dev_get_brand","context_dev_get_brand_by_email","context_dev_get_brand_by_name","context_dev_get_brand_by_ticker","context_dev_identify_transaction","context_dev_map","context_dev_scrape_fonts","context_dev_scrape_html","context_dev_scrape_images","context_dev_scrape_markdown","context_dev_scrape_styleguide","context_dev_screenshot","context_dev_search","convex_action","convex_document_deltas","convex_list_documents","convex_list_tables","convex_mutation","convex_query","convex_run_function","crowdstrike_create_indicators","crowdstrike_delete_indicators","crowdstrike_delete_rtr_session","crowdstrike_execute_rtr_command","crowdstrike_get_alert_details","crowdstrike_get_case_details","crowdstrike_get_host_group_details","crowdstrike_get_indicator_details","crowdstrike_get_rtr_command_status","crowdstrike_get_sensor_aggregates","crowdstrike_get_sensor_details","crowdstrike_get_vulnerability_details","crowdstrike_init_rtr_session","crowdstrike_perform_host_action","crowdstrike_perform_host_group_action","crowdstrike_query_alerts","crowdstrike_query_cases","crowdstrike_query_host_groups","crowdstrike_query_indicators","crowdstrike_query_sensors","crowdstrike_query_vulnerabilities","crowdstrike_update_alerts","crowdstrike_update_indicators","crunchbase_autocomplete","crunchbase_get_acquisition","crunchbase_get_entity","crunchbase_get_entity_card","crunchbase_get_fields_metadata","crunchbase_get_funding_round","crunchbase_get_organization","crunchbase_get_person","crunchbase_list_deleted_entities","crunchbase_search_acquisitions","crunchbase_search_entities","crunchbase_search_funding_rounds","crunchbase_search_organizations","crunchbase_search_people","cursor_add_followup","cursor_add_followup_v2","cursor_delete_agent","cursor_delete_agent_v2","cursor_download_artifact","cursor_download_artifact_v2","cursor_get_agent","cursor_get_agent_v2","cursor_get_api_key_info","cursor_get_api_key_info_v2","cursor_get_conversation","cursor_get_conversation_v2","cursor_launch_agent","cursor_launch_agent_v2","cursor_list_agents","cursor_list_agents_v2","cursor_list_artifacts","cursor_list_artifacts_v2","cursor_list_models","cursor_list_models_v2","cursor_list_repositories","cursor_list_repositories_v2","cursor_stop_agent","cursor_stop_agent_v2","dagster_delete_run","dagster_get_asset","dagster_get_run","dagster_get_run_logs","dagster_launch_run","dagster_list_assets","dagster_list_jobs","dagster_list_runs","dagster_list_schedules","dagster_list_sensors","dagster_materialize_assets","dagster_reexecute_run","dagster_report_asset_materialization","dagster_start_schedule","dagster_start_sensor","dagster_stop_schedule","dagster_stop_sensor","dagster_terminate_run","dagster_wipe_asset","databricks_cancel_all_runs","databricks_cancel_run","databricks_cancel_statement","databricks_create_cluster","databricks_create_job","databricks_create_warehouse","databricks_delete_cluster","databricks_delete_job","databricks_delete_run","databricks_delete_warehouse","databricks_edit_cluster","databricks_edit_warehouse","databricks_execute_sql","databricks_genie_agent_ask","databricks_genie_agent_cancel","databricks_genie_agent_list_items","databricks_genie_ask","databricks_genie_create_space","databricks_genie_delete_conversation","databricks_genie_delete_message","databricks_genie_delete_space","databricks_genie_download_visualization","databricks_genie_execute_query","databricks_genie_get_message","databricks_genie_get_query_result","databricks_genie_get_space","databricks_genie_list_conversations","databricks_genie_list_messages","databricks_genie_list_spaces","databricks_genie_send_feedback","databricks_genie_update_space","databricks_get_cluster","databricks_get_job","databricks_get_run","databricks_get_run_output","databricks_get_statement","databricks_get_statement_chunk","databricks_get_warehouse","databricks_list_clusters","databricks_list_jobs","databricks_list_runs","databricks_list_warehouses","databricks_repair_run","databricks_reset_job","databricks_resize_cluster","databricks_restart_cluster","databricks_run_job","databricks_start_cluster","databricks_start_warehouse","databricks_stop_warehouse","databricks_submit_run","databricks_terminate_cluster","databricks_update_job","datadog_add_incident_todo","datadog_cancel_downtime","datadog_create_dashboard","datadog_create_downtime","datadog_create_event","datadog_create_incident","datadog_create_monitor","datadog_create_slo","datadog_delete_dashboard","datadog_delete_slo","datadog_get_browser_synthetics_results","datadog_get_dashboard","datadog_get_incident","datadog_get_monitor","datadog_get_security_signal","datadog_get_slo","datadog_get_slo_history","datadog_get_synthetics_results","datadog_get_synthetics_test","datadog_list_dashboards","datadog_list_downtimes","datadog_list_incidents","datadog_list_monitors","datadog_list_security_rules","datadog_list_security_signals","datadog_list_services","datadog_list_slos","datadog_list_synthetics_tests","datadog_mute_monitor","datadog_query_logs","datadog_query_timeseries","datadog_search_spans","datadog_send_logs","datadog_submit_metrics","datadog_trigger_synthetics_tests","datadog_unmute_monitor","datadog_update_incident","datadog_update_security_signal_assignee","datadog_update_security_signal_state","datadog_update_slo","datadog_update_synthetics_status","datagma_enrich_company","datagma_enrich_person","datagma_find_email","datagma_find_phone","datagma_get_credits","daytona_create_sandbox","daytona_delete_sandbox","daytona_download_file","daytona_execute_command","daytona_get_sandbox","daytona_git_clone","daytona_list_files","daytona_list_sandboxes","daytona_run_code","daytona_start_sandbox","daytona_stop_sandbox","daytona_upload_file","deployed_block_executor","deployments_deploy","deployments_get_version","deployments_list_versions","deployments_promote","deployments_undeploy","devin_append_session_tags","devin_archive_session","devin_create_session","devin_get_session","devin_get_session_tags","devin_list_session_attachments","devin_list_session_messages","devin_list_sessions","devin_replace_session_tags","devin_send_message","devin_terminate_session","discord_add_reaction","discord_archive_thread","discord_assign_role","discord_ban_member","discord_bulk_delete_messages","discord_create_channel","discord_create_invite","discord_create_role","discord_create_thread","discord_create_webhook","discord_delete_channel","discord_delete_invite","discord_delete_message","discord_delete_role","discord_delete_webhook","discord_edit_message","discord_execute_webhook","discord_get_channel","discord_get_invite","discord_get_member","discord_get_messages","discord_get_pinned_messages","discord_get_server","discord_get_user","discord_get_webhook","discord_join_thread","discord_kick_member","discord_leave_thread","discord_list_channels","discord_list_roles","discord_pin_message","discord_remove_reaction","discord_remove_role","discord_send_message","discord_unban_member","discord_unpin_message","discord_update_channel","discord_update_member","discord_update_role","docusign_create_from_template","docusign_download_document","docusign_get_envelope","docusign_list_envelopes","docusign_list_recipients","docusign_list_templates","docusign_send_envelope","docusign_void_envelope","downdetector_get_company","downdetector_get_company_attribution","downdetector_get_company_baseline","downdetector_get_company_events","downdetector_get_company_incidents","downdetector_get_company_indicators","downdetector_get_company_last_15","downdetector_get_company_status","downdetector_get_provider","downdetector_get_reports","downdetector_get_site_companies","downdetector_list_categories","downdetector_list_incidents","downdetector_list_sites","downdetector_search_companies","dropbox_copy","dropbox_create_folder","dropbox_create_shared_link","dropbox_delete","dropbox_download","dropbox_download_v2","dropbox_get_metadata","dropbox_list_folder","dropbox_list_revisions","dropbox_list_shared_links","dropbox_move","dropbox_restore","dropbox_search","dropbox_upload","dropcontact_enrich_contact","dspy_chain_of_thought","dspy_predict","dspy_react","dub_bulk_create_links","dub_bulk_delete_links","dub_bulk_update_links","dub_create_link","dub_create_tag","dub_delete_link","dub_get_analytics","dub_get_events","dub_get_link","dub_get_links_count","dub_get_qr_code","dub_get_qr_code_v2","dub_list_domains","dub_list_folders","dub_list_links","dub_list_tags","dub_update_link","dub_upsert_link","duckduckgo_search","dynamodb_delete","dynamodb_get","dynamodb_introspect","dynamodb_put","dynamodb_query","dynamodb_scan","dynamodb_update","dynatrace_add_problem_comment","dynatrace_add_tags","dynatrace_close_problem","dynatrace_create_settings_object","dynatrace_create_slo","dynatrace_delete_problem_comment","dynatrace_delete_settings_object","dynatrace_delete_slo","dynatrace_delete_tag","dynatrace_execute_synthetic_monitors","dynatrace_get_attack","dynatrace_get_audit_logs","dynatrace_get_entity","dynatrace_get_event","dynatrace_get_metric","dynatrace_get_problem","dynatrace_get_problem_comment","dynatrace_get_security_problem","dynatrace_get_settings_object","dynatrace_get_slo","dynatrace_get_synthetic_batch","dynatrace_ingest_event","dynatrace_ingest_logs","dynatrace_ingest_metrics","dynatrace_list_attacks","dynatrace_list_entities","dynatrace_list_entity_types","dynatrace_list_events","dynatrace_list_metrics","dynatrace_list_problem_comments","dynatrace_list_problems","dynatrace_list_remediation_items","dynatrace_list_security_problems","dynatrace_list_settings_objects","dynatrace_list_settings_schemas","dynatrace_list_slos","dynatrace_list_synthetic_monitors","dynatrace_list_tags","dynatrace_mute_security_problem","dynatrace_mute_security_problems","dynatrace_query_metrics","dynatrace_search_logs","dynatrace_unmute_security_problem","dynatrace_unmute_security_problems","dynatrace_update_problem_comment","dynatrace_update_settings_object","dynatrace_update_slo","ec2_allocate_address","ec2_associate_address","ec2_authorize_security_group_ingress","ec2_create_snapshot","ec2_create_tags","ec2_delete_snapshot","ec2_delete_tags","ec2_delete_volume","ec2_describe_addresses","ec2_describe_availability_zones","ec2_describe_images","ec2_describe_instance_status","ec2_describe_instances","ec2_describe_internet_gateways","ec2_describe_key_pairs","ec2_describe_nat_gateways","ec2_describe_network_acls","ec2_describe_network_interfaces","ec2_describe_regions","ec2_describe_route_tables","ec2_describe_security_groups","ec2_describe_snapshots","ec2_describe_subnets","ec2_describe_volumes","ec2_describe_vpc_endpoints","ec2_describe_vpc_peering_connections","ec2_describe_vpcs","ec2_disassociate_address","ec2_reboot_instances","ec2_release_address","ec2_revoke_security_group_ingress","ec2_start_instances","ec2_stop_instances","ec2_terminate_instances","elasticsearch_bulk","elasticsearch_cluster_health","elasticsearch_cluster_stats","elasticsearch_count","elasticsearch_create_index","elasticsearch_delete_document","elasticsearch_delete_index","elasticsearch_get_document","elasticsearch_get_index","elasticsearch_index_document","elasticsearch_list_indices","elasticsearch_search","elasticsearch_update_document","elevenlabs_audio_isolation","elevenlabs_edit_voice_settings","elevenlabs_get_user","elevenlabs_get_voice","elevenlabs_get_voice_settings","elevenlabs_list_models","elevenlabs_list_voices","elevenlabs_sound_effects","elevenlabs_speech_to_speech","elevenlabs_tts","emailbison_attach_leads_to_campaign","emailbison_attach_tags_to_leads","emailbison_create_campaign","emailbison_create_lead","emailbison_create_tag","emailbison_get_lead","emailbison_list_campaigns","emailbison_list_leads","emailbison_list_replies","emailbison_list_tags","emailbison_update_campaign","emailbison_update_campaign_status","emailbison_update_lead","embeddings_cohere","embeddings_gemini","embeddings_mistral","embeddings_ollama","embeddings_openai","embeddings_openrouter","enrich_check_credits","enrich_company_funding","enrich_company_lookup","enrich_company_revenue","enrich_disposable_email_check","enrich_email_to_ip","enrich_email_to_person_lite","enrich_email_to_phone","enrich_email_to_profile","enrich_find_email","enrich_get_post_details","enrich_ip_to_company","enrich_linkedin_profile","enrich_linkedin_to_personal_email","enrich_linkedin_to_work_email","enrich_phone_finder","enrich_reverse_hash_lookup","enrich_sales_pointer_people","enrich_search_company","enrich_search_company_activities","enrich_search_company_employees","enrich_search_jobs","enrich_search_logo","enrich_search_people","enrich_search_people_activities","enrich_search_post_comments","enrich_search_post_comments_by_url","enrich_search_post_reactions","enrich_search_post_reactions_by_url","enrich_search_posts","enrich_search_similar_companies","enrich_verify_email","enrichment_run","enrow_find_email","enrow_verify_email","exa_agent","exa_answer","exa_find_similar_links","exa_get_contents","exa_search","extend_parser","extend_parser_v2","fathom_get_summary","fathom_get_transcript","fathom_list_meeting_types","fathom_list_meetings","fathom_list_team_members","fathom_list_teams","file_append","file_compress","file_create_folder","file_decompress","file_delete_folder","file_edit","file_fetch","file_get","file_get_content","file_list","file_manage_sharing","file_move","file_parser","file_parser_v2","file_parser_v3","file_read","file_restore_folder","file_search","file_update_folder","file_write","findymail_find_email_from_linkedin","findymail_find_email_from_name","findymail_find_emails_by_domain","findymail_find_employees","findymail_find_phone","findymail_get_company","findymail_get_credits","findymail_lookup_technologies","findymail_reverse_email_lookup","findymail_search_technologies","findymail_verify_email","firecrawl_agent","firecrawl_batch_scrape","firecrawl_batch_scrape_status","firecrawl_cancel_crawl","firecrawl_crawl","firecrawl_crawl_status","firecrawl_credit_usage","firecrawl_extract","firecrawl_extract_status","firecrawl_map","firecrawl_parse","firecrawl_scrape","firecrawl_search","fireflies_add_to_live_meeting","fireflies_create_bite","fireflies_delete_transcript","fireflies_get_transcript","fireflies_get_user","fireflies_list_bites","fireflies_list_contacts","fireflies_list_transcripts","fireflies_list_users","fireflies_upload_audio","fivetran_cancel_transformation","fivetran_create_connect_card","fivetran_create_connection","fivetran_create_destination","fivetran_create_group","fivetran_delete_connection","fivetran_get_account_info","fivetran_get_connection","fivetran_get_connection_schema_config","fivetran_get_connection_warnings","fivetran_get_connector_type","fivetran_get_destination","fivetran_get_group","fivetran_get_sync_history","fivetran_get_transformation","fivetran_list_connections","fivetran_list_connector_types","fivetran_list_destinations","fivetran_list_groups","fivetran_list_transformations","fivetran_list_users","fivetran_reload_connection_schema","fivetran_resync_connection","fivetran_resync_tables","fivetran_run_connection_setup_tests","fivetran_run_destination_setup_tests","fivetran_run_transformation","fivetran_sync_connection","fivetran_update_connection","fivetran_update_connection_schema","fivetran_update_connection_table","fivetran_update_schema_config","flint_create_task","flint_generate_pages","flint_get_task","function_execute","gamma_check_status","gamma_generate","gamma_generate_from_template","gamma_list_folders","gamma_list_themes","github_add_assignees","github_add_assignees_v2","github_add_labels","github_add_labels_v2","github_cancel_workflow_run","github_cancel_workflow_run_v2","github_check_star","github_check_star_v2","github_close_issue","github_close_issue_v2","github_close_pr","github_close_pr_v2","github_comment","github_comment_v2","github_compare_commits","github_compare_commits_v2","github_create_branch","github_create_branch_v2","github_create_comment_reaction","github_create_comment_reaction_v2","github_create_file","github_create_file_v2","github_create_gist","github_create_gist_v2","github_create_issue","github_create_issue_reaction","github_create_issue_reaction_v2","github_create_issue_v2","github_create_milestone","github_create_milestone_v2","github_create_pr","github_create_pr_review","github_create_pr_review_v2","github_create_pr_v2","github_create_project","github_create_project_v2","github_create_release","github_create_release_v2","github_delete_branch","github_delete_branch_v2","github_delete_comment","github_delete_comment_reaction","github_delete_comment_reaction_v2","github_delete_comment_v2","github_delete_file","github_delete_file_v2","github_delete_gist","github_delete_gist_v2","github_delete_issue_reaction","github_delete_issue_reaction_v2","github_delete_milestone","github_delete_milestone_v2","github_delete_project","github_delete_project_v2","github_delete_release","github_delete_release_v2","github_fork_gist","github_fork_gist_v2","github_fork_repo","github_fork_repo_v2","github_get_branch","github_get_branch_protection","github_get_branch_protection_v2","github_get_branch_v2","github_get_commit","github_get_commit_v2","github_get_file_content","github_get_file_content_v2","github_get_gist","github_get_gist_v2","github_get_issue","github_get_issue_v2","github_get_latest_release","github_get_latest_release_v2","github_get_milestone","github_get_milestone_v2","github_get_pr_files","github_get_pr_files_v2","github_get_project","github_get_project_v2","github_get_readme","github_get_readme_v2","github_get_release","github_get_release_v2","github_get_tree","github_get_tree_v2","github_get_workflow","github_get_workflow_run","github_get_workflow_run_v2","github_get_workflow_v2","github_issue_comment","github_issue_comment_v2","github_job_logs","github_latest_commit","github_latest_commit_v2","github_list_branches","github_list_branches_v2","github_list_commits","github_list_commits_v2","github_list_forks","github_list_forks_v2","github_list_gists","github_list_gists_v2","github_list_issue_comments","github_list_issue_comments_v2","github_list_issues","github_list_issues_v2","github_list_milestones","github_list_milestones_v2","github_list_pr_comments","github_list_pr_comments_v2","github_list_projects","github_list_projects_v2","github_list_prs","github_list_prs_v2","github_list_releases","github_list_releases_v2","github_list_review_threads","github_list_stargazers","github_list_stargazers_v2","github_list_tags","github_list_tags_v2","github_list_workflow_runs","github_list_workflow_runs_v2","github_list_workflows","github_list_workflows_v2","github_merge_pr","github_merge_pr_v2","github_pr","github_pr_v2","github_remove_label","github_remove_label_v2","github_reply_review_thread","github_repo_info","github_repo_info_v2","github_request_reviewers","github_request_reviewers_v2","github_rerun_workflow","github_rerun_workflow_v2","github_resolve_review_thread","github_search_code","github_search_code_v2","github_search_commits","github_search_commits_v2","github_search_issues","github_search_issues_v2","github_search_repos","github_search_repos_v2","github_search_users","github_search_users_v2","github_star_gist","github_star_gist_v2","github_star_repo","github_star_repo_v2","github_status_check_rollup","github_trigger_workflow","github_trigger_workflow_v2","github_unstar_gist","github_unstar_gist_v2","github_unstar_repo","github_unstar_repo_v2","github_update_branch_protection","github_update_branch_protection_v2","github_update_comment","github_update_comment_v2","github_update_file","github_update_file_v2","github_update_gist","github_update_gist_v2","github_update_issue","github_update_issue_v2","github_update_milestone","github_update_milestone_v2","github_update_pr","github_update_pr_v2","github_update_project","github_update_project_v2","github_update_release","github_update_release_v2","gitlab_activate_user","gitlab_add_member","gitlab_add_saml_group_link","gitlab_approve_access_request","gitlab_approve_merge_request","gitlab_approve_user","gitlab_ban_user","gitlab_block_user","gitlab_cancel_pipeline","gitlab_compare_branches","gitlab_create_branch","gitlab_create_file","gitlab_create_issue","gitlab_create_issue_note","gitlab_create_merge_request","gitlab_create_merge_request_note","gitlab_create_pipeline","gitlab_create_release","gitlab_create_user","gitlab_deactivate_user","gitlab_delete_branch","gitlab_delete_issue","gitlab_delete_saml_group_link","gitlab_delete_user","gitlab_delete_user_identity","gitlab_deny_access_request","gitlab_get_file","gitlab_get_group","gitlab_get_issue","gitlab_get_job_log","gitlab_get_merge_request","gitlab_get_merge_request_changes","gitlab_get_pipeline","gitlab_get_project","gitlab_invite_member","gitlab_list_access_requests","gitlab_list_branches","gitlab_list_commits","gitlab_list_groups","gitlab_list_invitations","gitlab_list_issues","gitlab_list_members","gitlab_list_merge_requests","gitlab_list_pipeline_jobs","gitlab_list_pipelines","gitlab_list_projects","gitlab_list_releases","gitlab_list_repository_tree","gitlab_list_saml_group_links","gitlab_list_user_memberships","gitlab_merge_merge_request","gitlab_play_job","gitlab_reject_user","gitlab_remove_member","gitlab_retry_pipeline","gitlab_revoke_invitation","gitlab_search_users","gitlab_unban_user","gitlab_unblock_user","gitlab_update_file","gitlab_update_invitation","gitlab_update_issue","gitlab_update_member","gitlab_update_merge_request","gitlab_update_user","gmail_add_label","gmail_add_label_v2","gmail_archive","gmail_archive_v2","gmail_create_label_v2","gmail_delete","gmail_delete_draft_v2","gmail_delete_label_v2","gmail_delete_v2","gmail_draft","gmail_draft_v2","gmail_edit_draft_v2","gmail_get_draft_v2","gmail_get_thread_v2","gmail_list_drafts_v2","gmail_list_labels_v2","gmail_list_threads_v2","gmail_mark_read","gmail_mark_read_v2","gmail_mark_unread","gmail_mark_unread_v2","gmail_move","gmail_move_v2","gmail_read","gmail_read_v2","gmail_remove_label","gmail_remove_label_v2","gmail_search","gmail_search_v2","gmail_send","gmail_send_v2","gmail_trash_thread_v2","gmail_unarchive","gmail_unarchive_v2","gmail_untrash_thread_v2","gmail_update_label_v2","gong_aggregate_activity","gong_aggregate_by_period","gong_answered_scorecards","gong_ask_anything","gong_assign_flow_prospects","gong_create_call","gong_day_by_day_activity","gong_get_brief","gong_get_call","gong_get_call_transcript","gong_get_coaching","gong_get_extensive_calls","gong_get_folder_content","gong_get_logs","gong_get_prospect_flows","gong_get_user","gong_interaction_stats","gong_list_calls","gong_list_flows","gong_list_library_folders","gong_list_scorecards","gong_list_trackers","gong_list_users","gong_list_workspaces","gong_lookup_email","gong_lookup_phone","gong_purge_email_address","gong_purge_phone_number","gong_unassign_flow_prospects","google_ads_ad_performance","google_ads_campaign_performance","google_ads_list_ad_groups","google_ads_list_campaigns","google_ads_list_customers","google_ads_search","google_appsheet_add_rows","google_appsheet_delete_rows","google_appsheet_edit_rows","google_appsheet_find_rows","google_bigquery_create_dataset","google_bigquery_create_table","google_bigquery_delete_dataset","google_bigquery_delete_table","google_bigquery_get_query_results","google_bigquery_get_table","google_bigquery_insert_rows","google_bigquery_list_datasets","google_bigquery_list_table_data","google_bigquery_list_tables","google_bigquery_query","google_books_volume_details","google_books_volume_search","google_calendar_create","google_calendar_create_calendar","google_calendar_create_calendar_v2","google_calendar_create_v2","google_calendar_delete","google_calendar_delete_calendar","google_calendar_delete_calendar_v2","google_calendar_delete_v2","google_calendar_freebusy","google_calendar_freebusy_v2","google_calendar_get","google_calendar_get_v2","google_calendar_instances","google_calendar_instances_v2","google_calendar_invite","google_calendar_invite_v2","google_calendar_list","google_calendar_list_acl","google_calendar_list_acl_v2","google_calendar_list_calendars","google_calendar_list_calendars_v2","google_calendar_list_v2","google_calendar_move","google_calendar_move_v2","google_calendar_quick_add","google_calendar_quick_add_v2","google_calendar_respond","google_calendar_respond_v2","google_calendar_share_calendar","google_calendar_share_calendar_v2","google_calendar_unshare_calendar","google_calendar_unshare_calendar_v2","google_calendar_update","google_calendar_update_acl","google_calendar_update_acl_v2","google_calendar_update_calendar","google_calendar_update_calendar_v2","google_calendar_update_v2","google_contacts_create","google_contacts_delete","google_contacts_get","google_contacts_list","google_contacts_search","google_contacts_update","google_docs_create","google_docs_create_named_range","google_docs_create_paragraph_bullets","google_docs_delete_content_range","google_docs_delete_named_range","google_docs_delete_paragraph_bullets","google_docs_insert_image","google_docs_insert_page_break","google_docs_insert_table","google_docs_insert_text","google_docs_read","google_docs_replace_text","google_docs_update_paragraph_style","google_docs_update_text_style","google_docs_write","google_drive_copy","google_drive_create_comment","google_drive_create_folder","google_drive_delete","google_drive_delete_comment","google_drive_download","google_drive_export","google_drive_get_about","google_drive_get_content","google_drive_get_file","google_drive_get_revision","google_drive_list","google_drive_list_comments","google_drive_list_permissions","google_drive_list_revisions","google_drive_move","google_drive_search","google_drive_share","google_drive_trash","google_drive_unshare","google_drive_untrash","google_drive_update","google_drive_upload","google_forms_batch_update","google_forms_create_form","google_forms_create_watch","google_forms_delete_watch","google_forms_get_form","google_forms_get_responses","google_forms_list_watches","google_forms_renew_watch","google_forms_set_publish_settings","google_groups_add_alias","google_groups_add_member","google_groups_create_group","google_groups_delete_group","google_groups_get_group","google_groups_get_member","google_groups_get_settings","google_groups_has_member","google_groups_list_aliases","google_groups_list_groups","google_groups_list_members","google_groups_remove_alias","google_groups_remove_member","google_groups_update_group","google_groups_update_member","google_groups_update_settings","google_maps_air_quality","google_maps_directions","google_maps_distance_matrix","google_maps_elevation","google_maps_geocode","google_maps_geolocate","google_maps_place_details","google_maps_places_nearby","google_maps_places_search","google_maps_pollen","google_maps_reverse_geocode","google_maps_snap_to_roads","google_maps_solar","google_maps_speed_limits","google_maps_timezone","google_maps_validate_address","google_meet_create_space","google_meet_end_conference","google_meet_get_conference_record","google_meet_get_space","google_meet_list_conference_records","google_meet_list_participants","google_pagespeed_analyze","google_search","google_sheets_append","google_sheets_append_v2","google_sheets_batch_clear_v2","google_sheets_batch_get_v2","google_sheets_batch_update_v2","google_sheets_clear_v2","google_sheets_copy_sheet_v2","google_sheets_create_spreadsheet_v2","google_sheets_delete_rows_v2","google_sheets_delete_sheet_v2","google_sheets_delete_spreadsheet_v2","google_sheets_get_spreadsheet_v2","google_sheets_read","google_sheets_read_v2","google_sheets_update","google_sheets_update_v2","google_sheets_write","google_sheets_write_v2","google_slides_add_image","google_slides_add_slide","google_slides_batch_update","google_slides_copy_presentation","google_slides_create","google_slides_create_line","google_slides_create_paragraph_bullets","google_slides_create_shape","google_slides_create_sheets_chart","google_slides_create_table","google_slides_create_video","google_slides_delete_object","google_slides_delete_paragraph_bullets","google_slides_delete_table_column","google_slides_delete_table_row","google_slides_delete_text","google_slides_duplicate_object","google_slides_export_presentation","google_slides_get_page","google_slides_get_thumbnail","google_slides_group_objects","google_slides_insert_table_columns","google_slides_insert_table_rows","google_slides_insert_text","google_slides_merge_table_cells","google_slides_read","google_slides_refresh_sheets_chart","google_slides_replace_all_shapes_with_image","google_slides_replace_all_shapes_with_sheets_chart","google_slides_replace_all_text","google_slides_replace_image","google_slides_reroute_line","google_slides_ungroup_objects","google_slides_unmerge_table_cells","google_slides_update_image_properties","google_slides_update_line_category","google_slides_update_line_properties","google_slides_update_page_element_alt_text","google_slides_update_page_element_transform","google_slides_update_page_elements_z_order","google_slides_update_page_properties","google_slides_update_paragraph_style","google_slides_update_shape_properties","google_slides_update_slide_properties","google_slides_update_slides_position","google_slides_update_table_border_properties","google_slides_update_table_cell_properties","google_slides_update_table_column_properties","google_slides_update_table_row_properties","google_slides_update_text_style","google_slides_update_video_properties","google_slides_write","google_tasks_create","google_tasks_delete","google_tasks_get","google_tasks_list","google_tasks_list_task_lists","google_tasks_update","google_translate_detect","google_translate_text","google_vault_add_held_accounts","google_vault_add_matters_permissions","google_vault_close_matters","google_vault_create_matters","google_vault_create_matters_export","google_vault_create_matters_holds","google_vault_create_saved_query","google_vault_delete_matters","google_vault_delete_matters_export","google_vault_delete_matters_holds","google_vault_delete_saved_query","google_vault_download_export_file","google_vault_list_matters","google_vault_list_matters_export","google_vault_list_matters_holds","google_vault_list_saved_queries","google_vault_remove_held_accounts","google_vault_remove_matters_permissions","google_vault_reopen_matters","google_vault_undelete_matters","google_vault_update_matters","google_vault_update_matters_holds","grafana_check_data_source_health","grafana_create_alert_rule","grafana_create_annotation","grafana_create_contact_point","grafana_create_dashboard","grafana_create_folder","grafana_delete_alert_rule","grafana_delete_annotation","grafana_delete_contact_point","grafana_delete_dashboard","grafana_delete_folder","grafana_get_alert_rule","grafana_get_alert_rule_group","grafana_get_dashboard","grafana_get_data_source","grafana_get_folder","grafana_get_health","grafana_list_alert_rules","grafana_list_annotations","grafana_list_contact_points","grafana_list_dashboards","grafana_list_data_sources","grafana_list_folders","grafana_move_folder","grafana_query_data_source","grafana_update_alert_rule","grafana_update_annotation","grafana_update_contact_point","grafana_update_dashboard","grafana_update_folder","grain_create_hook","grain_create_hook_v2","grain_delete_hook","grain_delete_hook_v2","grain_get_recording","grain_get_transcript","grain_list_hooks","grain_list_hooks_v2","grain_list_meeting_types","grain_list_recordings","grain_list_teams","grain_list_views","granola_create_webhook_endpoint","granola_delete_webhook_endpoint","granola_get_note","granola_get_transcript","granola_list_audit_events","granola_list_folders","granola_list_notes","granola_list_webhook_endpoints","granola_update_webhook_endpoint","greenhouse_apply_candidate_tag_v2","greenhouse_convert_prospect_v2","greenhouse_create_application_v2","greenhouse_create_attachment_v2","greenhouse_create_candidate_tag_v2","greenhouse_create_candidate_v2","greenhouse_create_note_v2","greenhouse_delete_application_v2","greenhouse_delete_attachment_v2","greenhouse_delete_candidate_v2","greenhouse_get_application","greenhouse_get_application_v2","greenhouse_get_candidate","greenhouse_get_candidate_v2","greenhouse_get_job","greenhouse_get_job_v2","greenhouse_get_user","greenhouse_get_user_v2","greenhouse_hire_application_v2","greenhouse_list_application_stages_v2","greenhouse_list_applications","greenhouse_list_applications_v2","greenhouse_list_applied_candidate_tags_v2","greenhouse_list_attachments_v2","greenhouse_list_candidate_educations_v2","greenhouse_list_candidate_employments_v2","greenhouse_list_candidate_tags_v2","greenhouse_list_candidates","greenhouse_list_candidates_v2","greenhouse_list_close_reasons_v2","greenhouse_list_custom_field_options_v2","greenhouse_list_custom_fields_v2","greenhouse_list_departments","greenhouse_list_departments_v2","greenhouse_list_email_templates_v2","greenhouse_list_interviews_v2","greenhouse_list_job_hiring_managers_v2","greenhouse_list_job_interview_stages_v2","greenhouse_list_job_owners_v2","greenhouse_list_job_stages","greenhouse_list_jobs","greenhouse_list_jobs_v2","greenhouse_list_notes_v2","greenhouse_list_offers_v2","greenhouse_list_offices","greenhouse_list_offices_v2","greenhouse_list_openings_v2","greenhouse_list_prospect_pool_stages_v2","greenhouse_list_prospect_pools_v2","greenhouse_list_referrers_v2","greenhouse_list_rejection_reasons_v2","greenhouse_list_scorecards_v2","greenhouse_list_sources_v2","greenhouse_list_users","greenhouse_list_users_v2","greenhouse_move_application_v2","greenhouse_reject_application_v2","greenhouse_remove_candidate_tag_v2","greenhouse_unreject_application_v2","greenhouse_update_application_v2","greenhouse_update_candidate_v2","greptile_index_repo","greptile_query","greptile_search","greptile_status","guardrails_validate","harmonic_batch_get_people","harmonic_clear_people_saved_search_net_new_results","harmonic_enrich_person","harmonic_get_company_employees","harmonic_get_email_enrichment_job","harmonic_get_email_enrichment_usage","harmonic_get_enrichment_status","harmonic_get_people_saved_search_net_new_results","harmonic_get_people_saved_search_results","harmonic_get_person","harmonic_list_people_saved_searches","harmonic_search_people_scout","harmonic_submit_email_enrichment_job","helpscout_assign_conversation","helpscout_create_conversation","helpscout_create_customer","helpscout_create_customer_thread","helpscout_create_note","helpscout_create_reply","helpscout_delete_conversation","helpscout_get_conversation","helpscout_get_current_user","helpscout_get_customer","helpscout_get_organization","helpscout_get_saved_reply","helpscout_list_conversations","helpscout_list_custom_fields","helpscout_list_customer_properties","helpscout_list_customers","helpscout_list_folders","helpscout_list_mailboxes","helpscout_list_organizations","helpscout_list_saved_replies","helpscout_list_tags","helpscout_list_teams","helpscout_list_threads","helpscout_list_users","helpscout_list_workflows","helpscout_move_conversation","helpscout_run_workflow","helpscout_set_conversation_tags","helpscout_snooze_conversation","helpscout_unassign_conversation","helpscout_unsnooze_conversation","helpscout_update_conversation_customer","helpscout_update_conversation_status","helpscout_update_conversation_subject","helpscout_update_custom_fields","helpscout_update_customer","helpscout_update_customer_properties","hex_cancel_run","hex_create_collection","hex_create_group","hex_deactivate_user","hex_delete_group","hex_get_collection","hex_get_data_connection","hex_get_group","hex_get_project","hex_get_project_runs","hex_get_queried_tables","hex_get_run_status","hex_list_collections","hex_list_data_connections","hex_list_groups","hex_list_projects","hex_list_users","hex_run_project","hex_update_collection","hex_update_group","hex_update_project","http_request","hubspot_add_list_memberships","hubspot_create_appointment","hubspot_create_association","hubspot_create_company","hubspot_create_contact","hubspot_create_deal","hubspot_create_email","hubspot_create_line_item","hubspot_create_list","hubspot_create_note","hubspot_create_ticket","hubspot_delete_association","hubspot_delete_company","hubspot_delete_contact","hubspot_delete_deal","hubspot_delete_line_item","hubspot_delete_ticket","hubspot_get_appointment","hubspot_get_association_labels","hubspot_get_cart","hubspot_get_company","hubspot_get_contact","hubspot_get_deal","hubspot_get_email","hubspot_get_line_item","hubspot_get_list","hubspot_get_list_memberships","hubspot_get_marketing_event","hubspot_get_note","hubspot_get_properties","hubspot_get_quote","hubspot_get_ticket","hubspot_get_users","hubspot_list_appointments","hubspot_list_associations","hubspot_list_carts","hubspot_list_companies","hubspot_list_contacts","hubspot_list_deals","hubspot_list_emails","hubspot_list_line_items","hubspot_list_lists","hubspot_list_marketing_events","hubspot_list_notes","hubspot_list_owners","hubspot_list_quotes","hubspot_list_tickets","hubspot_remove_list_memberships","hubspot_search_companies","hubspot_search_contacts","hubspot_search_deals","hubspot_search_emails","hubspot_search_line_items","hubspot_search_notes","hubspot_search_quotes","hubspot_search_tickets","hubspot_update_appointment","hubspot_update_company","hubspot_update_contact","hubspot_update_deal","hubspot_update_line_item","hubspot_update_ticket","huggingface_chat","hunter_companies_find","hunter_discover","hunter_domain_search","hunter_email_count","hunter_email_finder","hunter_email_verifier","iam_add_user_to_group","iam_attach_role_policy","iam_attach_user_policy","iam_create_access_key","iam_create_role","iam_create_user","iam_delete_access_key","iam_delete_role","iam_delete_user","iam_detach_role_policy","iam_detach_user_policy","iam_get_policy","iam_get_role","iam_get_user","iam_list_access_keys","iam_list_attached_role_policies","iam_list_attached_user_policies","iam_list_groups","iam_list_policies","iam_list_roles","iam_list_users","iam_remove_user_from_group","iam_simulate_principal_policy","iam_update_access_key","icypeas_find_email","icypeas_verify_email","identity_center_check_assignment_deletion_status","identity_center_check_assignment_status","identity_center_create_account_assignment","identity_center_delete_account_assignment","identity_center_describe_account","identity_center_describe_group","identity_center_describe_user","identity_center_get_group","identity_center_get_user","identity_center_list_account_assignments","identity_center_list_accounts","identity_center_list_assignments_for_account","identity_center_list_group_memberships","identity_center_list_groups","identity_center_list_instances","identity_center_list_permission_sets","image_generate","incidentio_actions_create","incidentio_actions_list","incidentio_actions_show","incidentio_actions_update","incidentio_alert_events_create","incidentio_alerts_list","incidentio_alerts_resolve","incidentio_alerts_show","incidentio_catalog_entries_list","incidentio_catalog_types_list","incidentio_custom_fields_create","incidentio_custom_fields_delete","incidentio_custom_fields_list","incidentio_custom_fields_show","incidentio_custom_fields_update","incidentio_escalation_paths_create","incidentio_escalation_paths_delete","incidentio_escalation_paths_list","incidentio_escalation_paths_show","incidentio_escalation_paths_update","incidentio_escalations_cancel","incidentio_escalations_create","incidentio_escalations_list","incidentio_escalations_show","incidentio_follow_ups_create","incidentio_follow_ups_list","incidentio_follow_ups_show","incidentio_follow_ups_update","incidentio_incident_alerts_list","incidentio_incident_memberships_create","incidentio_incident_memberships_revoke","incidentio_incident_participants_list","incidentio_incident_roles_create","incidentio_incident_roles_delete","incidentio_incident_roles_list","incidentio_incident_roles_show","incidentio_incident_roles_update","incidentio_incident_statuses_list","incidentio_incident_timestamps_list","incidentio_incident_timestamps_show","incidentio_incident_types_list","incidentio_incident_updates_list","incidentio_incidents_create","incidentio_incidents_list","incidentio_incidents_show","incidentio_incidents_update","incidentio_on_call_now","incidentio_schedule_entries_list","incidentio_schedule_overrides_create","incidentio_schedule_overrides_list","incidentio_schedules_create","incidentio_schedules_delete","incidentio_schedules_list","incidentio_schedules_show","incidentio_schedules_update","incidentio_severities_list","incidentio_teams_list","incidentio_teams_show","incidentio_users_list","incidentio_users_show","incidentio_workflows_create","incidentio_workflows_delete","incidentio_workflows_list","incidentio_workflows_show","incidentio_workflows_update","infisical_create_secret","infisical_delete_secret","infisical_get_secret","infisical_list_secrets","infisical_update_secret","instagram_delete_comment","instagram_download_media","instagram_get_account_insights","instagram_get_container_status","instagram_get_conversation_messages","instagram_get_media","instagram_get_media_insights","instagram_get_message","instagram_get_profile","instagram_get_publishing_limit","instagram_hide_comment","instagram_list_comments","instagram_list_conversations","instagram_list_media","instagram_list_stories","instagram_private_reply","instagram_publish_carousel","instagram_publish_image","instagram_publish_reel","instagram_publish_story","instagram_publish_video","instagram_reply_to_comment","instagram_send_text_message","instagram_set_comments_enabled","instantly_activate_campaign","instantly_create_campaign","instantly_create_lead","instantly_create_lead_list","instantly_delete_campaign","instantly_delete_leads","instantly_get_lead","instantly_list_campaigns","instantly_list_emails","instantly_list_lead_lists","instantly_list_leads","instantly_patch_campaign","instantly_patch_lead","instantly_pause_campaign","instantly_reply_to_email","instantly_update_lead_interest_status","intercom_assign_conversation_v2","intercom_attach_contact_to_company_v2","intercom_close_conversation_v2","intercom_create_company","intercom_create_company_v2","intercom_create_contact","intercom_create_contact_v2","intercom_create_event_v2","intercom_create_message","intercom_create_message_v2","intercom_create_note_v2","intercom_create_tag_v2","intercom_create_ticket","intercom_create_ticket_v2","intercom_delete_contact","intercom_delete_contact_v2","intercom_detach_contact_from_company_v2","intercom_get_company","intercom_get_company_v2","intercom_get_contact","intercom_get_contact_v2","intercom_get_conversation","intercom_get_conversation_v2","intercom_get_ticket","intercom_get_ticket_v2","intercom_list_admins_v2","intercom_list_companies","intercom_list_companies_v2","intercom_list_contacts","intercom_list_contacts_v2","intercom_list_conversations","intercom_list_conversations_v2","intercom_list_tags_v2","intercom_open_conversation_v2","intercom_reply_conversation","intercom_reply_conversation_v2","intercom_search_contacts","intercom_search_contacts_v2","intercom_search_conversations","intercom_search_conversations_v2","intercom_snooze_conversation_v2","intercom_tag_contact_v2","intercom_tag_conversation_v2","intercom_untag_contact_v2","intercom_update_contact","intercom_update_contact_v2","intercom_update_ticket_v2","intune_get_compliance_policy","intune_get_detected_app","intune_get_device","intune_get_device_configuration","intune_list_app_devices","intune_list_compliance_policies","intune_list_compliance_policy_device_statuses","intune_list_detected_apps","intune_list_device_configurations","intune_list_devices","intune_reboot_device","intune_remote_lock_device","intune_retire_device","intune_sync_device","jina_read_url","jina_search","jira_add_attachment","jira_add_comment","jira_add_watcher","jira_add_worklog","jira_assign_issue","jira_bulk_read","jira_create_issue_link","jira_delete_attachment","jira_delete_comment","jira_delete_issue","jira_delete_issue_link","jira_delete_worklog","jira_get_attachments","jira_get_comments","jira_get_fields","jira_get_project","jira_get_transitions","jira_get_users","jira_get_worklogs","jira_list_issue_types","jira_list_projects","jira_remove_watcher","jira_retrieve","jira_search_issues","jira_search_users","jira_transition_issue","jira_update","jira_update_comment","jira_update_worklog","jira_write","jotform_add_label_resources","jotform_clone_form","jotform_create_form","jotform_create_label","jotform_create_question","jotform_create_questions","jotform_create_report","jotform_create_submission","jotform_create_submissions","jotform_create_webhook","jotform_delete_form","jotform_delete_label","jotform_delete_question","jotform_delete_report","jotform_delete_submission","jotform_delete_webhook","jotform_get_form","jotform_get_form_properties","jotform_get_history","jotform_get_label","jotform_get_question","jotform_get_report","jotform_get_settings","jotform_get_submission","jotform_get_usage","jotform_get_user","jotform_list_form_files","jotform_list_form_reports","jotform_list_form_submissions","jotform_list_forms","jotform_list_label_resources","jotform_list_labels","jotform_list_questions","jotform_list_reports","jotform_list_submissions","jotform_list_subusers","jotform_list_webhooks","jotform_remove_label_resources","jotform_update_form_properties","jotform_update_label","jotform_update_question","jotform_update_settings","jotform_update_submission","jsm_add_comment","jsm_add_customer","jsm_add_organization","jsm_add_participants","jsm_answer_approval","jsm_attach_form","jsm_copy_forms","jsm_create_object","jsm_create_organization","jsm_create_request","jsm_delete_form","jsm_delete_object","jsm_externalise_form","jsm_get_approvals","jsm_get_comments","jsm_get_customers","jsm_get_form","jsm_get_form_answers","jsm_get_form_structure","jsm_get_form_templates","jsm_get_issue_forms","jsm_get_object","jsm_get_object_schema","jsm_get_object_type_attributes","jsm_get_organizations","jsm_get_participants","jsm_get_queues","jsm_get_request","jsm_get_request_type_fields","jsm_get_request_types","jsm_get_requests","jsm_get_service_desks","jsm_get_sla","jsm_get_transitions","jsm_internalise_form","jsm_list_object_schemas","jsm_list_object_types","jsm_reopen_form","jsm_save_form_answers","jsm_search_objects_aql","jsm_submit_form","jsm_transition_request","jsm_update_object","jupyter_copy_content","jupyter_create_file","jupyter_create_session","jupyter_delete_content","jupyter_delete_session","jupyter_get_content","jupyter_get_content_v2","jupyter_interrupt_kernel","jupyter_list_contents","jupyter_list_kernels","jupyter_list_kernelspecs","jupyter_list_sessions","jupyter_rename_content","jupyter_restart_kernel","jupyter_start_kernel","jupyter_stop_kernel","jupyter_upload_file","kalshi_amend_order","kalshi_amend_order_v2","kalshi_cancel_order","kalshi_cancel_order_v2","kalshi_create_order","kalshi_create_order_v2","kalshi_get_balance","kalshi_get_balance_v2","kalshi_get_candlesticks","kalshi_get_candlesticks_v2","kalshi_get_event","kalshi_get_event_candlesticks","kalshi_get_event_candlesticks_v2","kalshi_get_event_v2","kalshi_get_events","kalshi_get_events_v2","kalshi_get_exchange_announcements","kalshi_get_exchange_announcements_v2","kalshi_get_exchange_schedule","kalshi_get_exchange_schedule_v2","kalshi_get_exchange_status","kalshi_get_exchange_status_v2","kalshi_get_fills","kalshi_get_fills_v2","kalshi_get_market","kalshi_get_market_v2","kalshi_get_markets","kalshi_get_markets_v2","kalshi_get_order","kalshi_get_order_v2","kalshi_get_orderbook","kalshi_get_orderbook_v2","kalshi_get_orders","kalshi_get_orders_v2","kalshi_get_positions","kalshi_get_positions_v2","kalshi_get_series_by_ticker","kalshi_get_series_by_ticker_v2","kalshi_get_series_list","kalshi_get_series_list_v2","kalshi_get_settlements","kalshi_get_settlements_v2","kalshi_get_trades","kalshi_get_trades_v2","ketch_get_consent","ketch_get_subscriptions","ketch_invoke_right","ketch_set_consent","ketch_set_subscriptions","knowledge_create_document","knowledge_delete_chunk","knowledge_delete_document","knowledge_get_connector","knowledge_get_document","knowledge_list_chunks","knowledge_list_connectors","knowledge_list_documents","knowledge_list_tags","knowledge_search","knowledge_trigger_sync","knowledge_update_chunk","knowledge_upload_chunk","knowledge_upsert_document","lambda_add_permission","lambda_create_alias","lambda_create_event_source_mapping","lambda_create_function","lambda_create_function_url_config","lambda_delete_alias","lambda_delete_event_source_mapping","lambda_delete_function","lambda_delete_function_concurrency","lambda_delete_function_event_invoke_config","lambda_delete_function_url_config","lambda_delete_provisioned_concurrency_config","lambda_get_account_settings","lambda_get_alias","lambda_get_event_source_mapping","lambda_get_function","lambda_get_function_concurrency","lambda_get_function_configuration","lambda_get_function_event_invoke_config","lambda_get_function_recursion_config","lambda_get_function_url_config","lambda_get_layer_version","lambda_get_policy","lambda_get_provisioned_concurrency_config","lambda_get_runtime_management_config","lambda_invoke","lambda_list_aliases","lambda_list_event_source_mappings","lambda_list_function_event_invoke_configs","lambda_list_function_url_configs","lambda_list_functions","lambda_list_layer_versions","lambda_list_layers","lambda_list_provisioned_concurrency_configs","lambda_list_tags","lambda_list_versions_by_function","lambda_publish_version","lambda_put_function_concurrency","lambda_put_function_event_invoke_config","lambda_put_function_recursion_config","lambda_put_provisioned_concurrency_config","lambda_put_runtime_management_config","lambda_remove_permission","lambda_tag_resource","lambda_untag_resource","lambda_update_alias","lambda_update_event_source_mapping","lambda_update_function_code","lambda_update_function_configuration","lambda_update_function_url_config","langsmith_create_feedback","langsmith_create_run","langsmith_create_runs_batch","langsmith_get_run","langsmith_update_run","latex_compile","latex_get_package","latex_list_fonts","latex_search_packages","launchdarkly_create_flag","launchdarkly_delete_flag","launchdarkly_get_audit_log","launchdarkly_get_flag","launchdarkly_get_flag_status","launchdarkly_list_environments","launchdarkly_list_flags","launchdarkly_list_members","launchdarkly_list_projects","launchdarkly_list_segments","launchdarkly_toggle_flag","launchdarkly_update_flag","leadmagic_company_search","leadmagic_email_to_profile","leadmagic_find_email","leadmagic_find_mobile","leadmagic_get_credits","leadmagic_profile_search","leadmagic_profile_to_email","leadmagic_role_finder","leadmagic_validate_email","lemlist_get_activities","lemlist_get_lead","lemlist_send_email","linear_add_label_to_issue","linear_add_label_to_project","linear_archive_issue","linear_archive_label","linear_archive_project","linear_create_attachment","linear_create_comment","linear_create_customer","linear_create_customer_request","linear_create_customer_status","linear_create_customer_tier","linear_create_cycle","linear_create_favorite","linear_create_issue","linear_create_issue_relation","linear_create_label","linear_create_project","linear_create_project_label","linear_create_project_milestone","linear_create_project_status","linear_create_project_update","linear_create_workflow_state","linear_delete_attachment","linear_delete_comment","linear_delete_customer","linear_delete_customer_status","linear_delete_customer_tier","linear_delete_issue","linear_delete_issue_relation","linear_delete_project","linear_delete_project_label","linear_delete_project_milestone","linear_delete_project_status","linear_get_active_cycle","linear_get_customer","linear_get_cycle","linear_get_issue","linear_get_project","linear_get_viewer","linear_list_attachments","linear_list_comments","linear_list_customer_requests","linear_list_customer_statuses","linear_list_customer_tiers","linear_list_customers","linear_list_cycles","linear_list_favorites","linear_list_issue_relations","linear_list_labels","linear_list_notifications","linear_list_project_labels","linear_list_project_milestones","linear_list_project_statuses","linear_list_project_updates","linear_list_projects","linear_list_teams","linear_list_users","linear_list_workflow_states","linear_merge_customers","linear_read_issues","linear_remove_label_from_issue","linear_remove_label_from_project","linear_search_issues","linear_unarchive_issue","linear_update_attachment","linear_update_comment","linear_update_customer","linear_update_customer_request","linear_update_customer_status","linear_update_customer_tier","linear_update_issue","linear_update_label","linear_update_notification","linear_update_project","linear_update_project_label","linear_update_project_milestone","linear_update_project_status","linear_update_workflow_state","linkedin_get_profile","linkedin_share_post","linkup_search","linq_add_participant","linq_check_imessage","linq_check_rcs","linq_create_attachment","linq_create_chat","linq_create_contact_card","linq_create_webhook_subscription","linq_delete_attachment","linq_delete_message","linq_delete_webhook_subscription","linq_edit_message","linq_get_attachment","linq_get_chat","linq_get_contact_card","linq_get_message","linq_get_webhook_subscription","linq_leave_chat","linq_list_chats","linq_list_messages","linq_list_phone_numbers","linq_list_thread","linq_list_webhook_events","linq_list_webhook_subscriptions","linq_mark_chat_read","linq_react_to_message","linq_remove_participant","linq_send_message","linq_send_voice_memo","linq_share_contact_card","linq_start_typing","linq_stop_typing","linq_update_chat","linq_update_contact_card","linq_update_webhook_subscription","llm_chat","logfire_get_token_info","logfire_get_trace","logfire_query","logfire_search_records","logrocket_create_release","logrocket_get_audit_logs","logrocket_get_highlights","logrocket_identify_user","logrocket_list_exported_sessions","logrocket_request_highlights","logs_get","logs_get_execution","logs_get_run_details","logs_query","logs_query_runs","loops_check_contact_suppression","loops_create_contact","loops_create_contact_property","loops_delete_contact","loops_find_contact","loops_get_transactional_email","loops_list_contact_properties","loops_list_mailing_lists","loops_list_transactional_emails","loops_remove_contact_suppression","loops_send_event","loops_send_transactional_email","loops_update_contact","luma_add_guests","luma_cancel_event","luma_create_event","luma_get_event","luma_get_guest","luma_get_guests","luma_list_events","luma_lookup_event","luma_send_invites","luma_update_event","luma_update_guest_status","mailchimp_add_member","mailchimp_add_member_tags","mailchimp_add_or_update_member","mailchimp_add_segment_member","mailchimp_add_subscriber_to_automation","mailchimp_archive_member","mailchimp_create_audience","mailchimp_create_batch_operation","mailchimp_create_campaign","mailchimp_create_interest","mailchimp_create_interest_category","mailchimp_create_landing_page","mailchimp_create_merge_field","mailchimp_create_segment","mailchimp_create_template","mailchimp_delete_audience","mailchimp_delete_batch_operation","mailchimp_delete_campaign","mailchimp_delete_interest","mailchimp_delete_interest_category","mailchimp_delete_landing_page","mailchimp_delete_member","mailchimp_delete_merge_field","mailchimp_delete_segment","mailchimp_delete_template","mailchimp_get_audience","mailchimp_get_audiences","mailchimp_get_automation","mailchimp_get_automations","mailchimp_get_batch_operation","mailchimp_get_batch_operations","mailchimp_get_campaign","mailchimp_get_campaign_content","mailchimp_get_campaign_report","mailchimp_get_campaign_reports","mailchimp_get_campaigns","mailchimp_get_interest","mailchimp_get_interest_categories","mailchimp_get_interest_category","mailchimp_get_interests","mailchimp_get_landing_page","mailchimp_get_landing_pages","mailchimp_get_member","mailchimp_get_member_tags","mailchimp_get_members","mailchimp_get_merge_field","mailchimp_get_merge_fields","mailchimp_get_segment","mailchimp_get_segment_members","mailchimp_get_segments","mailchimp_get_template","mailchimp_get_templates","mailchimp_pause_automation","mailchimp_publish_landing_page","mailchimp_remove_member_tags","mailchimp_remove_segment_member","mailchimp_replicate_campaign","mailchimp_schedule_campaign","mailchimp_send_campaign","mailchimp_set_campaign_content","mailchimp_start_automation","mailchimp_unarchive_member","mailchimp_unpublish_landing_page","mailchimp_unschedule_campaign","mailchimp_update_audience","mailchimp_update_campaign","mailchimp_update_interest","mailchimp_update_interest_category","mailchimp_update_landing_page","mailchimp_update_member","mailchimp_update_merge_field","mailchimp_update_segment","mailchimp_update_template","mailgun_add_list_member","mailgun_create_mailing_list","mailgun_get_domain","mailgun_get_mailing_list","mailgun_get_message","mailgun_list_domains","mailgun_list_messages","mailgun_send_message","managed_agent_archive_session","managed_agent_create_session","managed_agent_delete_session","managed_agent_get_session","managed_agent_interrupt_session","managed_agent_list_events","managed_agent_respond_custom_tool","managed_agent_respond_tool_confirmation","managed_agent_run_session","managed_agent_send_message","managed_agent_update_session","manageengine_sdp_add_change_note","manageengine_sdp_add_problem_note","manageengine_sdp_add_request_note","manageengine_sdp_create_asset","manageengine_sdp_create_change","manageengine_sdp_create_problem","manageengine_sdp_create_request","manageengine_sdp_create_solution","manageengine_sdp_delete_asset","manageengine_sdp_delete_change","manageengine_sdp_delete_problem","manageengine_sdp_delete_request","manageengine_sdp_delete_solution","manageengine_sdp_get_asset","manageengine_sdp_get_change","manageengine_sdp_get_problem","manageengine_sdp_get_request","manageengine_sdp_get_solution","manageengine_sdp_list_assets","manageengine_sdp_list_change_notes","manageengine_sdp_list_changes","manageengine_sdp_list_problem_notes","manageengine_sdp_list_problems","manageengine_sdp_list_request_notes","manageengine_sdp_list_requests","manageengine_sdp_list_solutions","manageengine_sdp_update_asset","manageengine_sdp_update_change","manageengine_sdp_update_problem","manageengine_sdp_update_request","manageengine_sdp_update_solution","mcp_list_operations","mcp_run_operation","mem0_add_memories","mem0_get_memories","mem0_search_memories","memory_add","memory_delete","memory_get","memory_get_all","microsoft_ad_add_directory_role_member","microsoft_ad_add_group_member","microsoft_ad_add_user_app_role_assignment","microsoft_ad_assign_license","microsoft_ad_create_group","microsoft_ad_create_user","microsoft_ad_delete_group","microsoft_ad_delete_user","microsoft_ad_get_conditional_access_policy","microsoft_ad_get_device","microsoft_ad_get_group","microsoft_ad_get_user","microsoft_ad_list_authentication_methods","microsoft_ad_list_conditional_access_policies","microsoft_ad_list_devices","microsoft_ad_list_directory_audits","microsoft_ad_list_directory_role_members","microsoft_ad_list_directory_roles","microsoft_ad_list_group_members","microsoft_ad_list_groups","microsoft_ad_list_service_principal_app_role_assignments","microsoft_ad_list_service_principals","microsoft_ad_list_sign_ins","microsoft_ad_list_subscribed_skus","microsoft_ad_list_user_app_role_assignments","microsoft_ad_list_user_devices","microsoft_ad_list_user_licenses","microsoft_ad_list_users","microsoft_ad_remove_directory_role_member","microsoft_ad_remove_group_member","microsoft_ad_remove_user_app_role_assignment","microsoft_ad_reset_password","microsoft_ad_revoke_sign_in_sessions","microsoft_ad_set_password","microsoft_ad_update_group","microsoft_ad_update_user","microsoft_dataverse_associate","microsoft_dataverse_create_multiple","microsoft_dataverse_create_record","microsoft_dataverse_delete_record","microsoft_dataverse_disassociate","microsoft_dataverse_download_file","microsoft_dataverse_download_file_v2","microsoft_dataverse_execute_action","microsoft_dataverse_execute_function","microsoft_dataverse_fetchxml_query","microsoft_dataverse_get_entity_metadata","microsoft_dataverse_get_record","microsoft_dataverse_list_records","microsoft_dataverse_search","microsoft_dataverse_update_multiple","microsoft_dataverse_update_record","microsoft_dataverse_upload_file","microsoft_dataverse_upsert_record","microsoft_dataverse_whoami","microsoft_dynamics_365_close_case","microsoft_dynamics_365_close_opportunity","microsoft_dynamics_365_create_record","microsoft_dynamics_365_get_record","microsoft_dynamics_365_list_records","microsoft_dynamics_365_qualify_lead","microsoft_dynamics_365_search_records","microsoft_dynamics_365_update_record","microsoft_excel_calculate","microsoft_excel_clear_range","microsoft_excel_close_session","microsoft_excel_create_session","microsoft_excel_create_table","microsoft_excel_delete_table","microsoft_excel_delete_table_row","microsoft_excel_delete_worksheet","microsoft_excel_format_range","microsoft_excel_get_table","microsoft_excel_get_table_row","microsoft_excel_get_worksheet","microsoft_excel_list_table_rows","microsoft_excel_list_tables","microsoft_excel_list_worksheets","microsoft_excel_read","microsoft_excel_read_v2","microsoft_excel_refresh_session","microsoft_excel_sort_range","microsoft_excel_table_add","microsoft_excel_update_table","microsoft_excel_update_table_row","microsoft_excel_update_worksheet","microsoft_excel_worksheet_add","microsoft_excel_write","microsoft_excel_write_v2","microsoft_planner_create_bucket","microsoft_planner_create_plan","microsoft_planner_create_task","microsoft_planner_delete_bucket","microsoft_planner_delete_plan","microsoft_planner_delete_task","microsoft_planner_get_plan_details","microsoft_planner_get_task_details","microsoft_planner_list_buckets","microsoft_planner_list_plans","microsoft_planner_read_bucket","microsoft_planner_read_plan","microsoft_planner_read_task","microsoft_planner_update_bucket","microsoft_planner_update_plan","microsoft_planner_update_plan_details","microsoft_planner_update_task","microsoft_planner_update_task_details","microsoft_teams_delete_channel_message","microsoft_teams_delete_chat_message","microsoft_teams_get_message","microsoft_teams_list_channel_members","microsoft_teams_list_channels","microsoft_teams_list_chat_members","microsoft_teams_list_chats","microsoft_teams_list_team_members","microsoft_teams_list_teams","microsoft_teams_read_channel","microsoft_teams_read_chat","microsoft_teams_reply_to_message","microsoft_teams_set_reaction","microsoft_teams_unset_reaction","microsoft_teams_update_channel_message","microsoft_teams_update_chat_message","microsoft_teams_write_channel","microsoft_teams_write_chat","microsoft_word_append","microsoft_word_create","microsoft_word_create_from_template","microsoft_word_export_pdf","microsoft_word_list","microsoft_word_read","microsoft_word_replace_text","microsoft_word_update","millionverifier_get_credits","millionverifier_verify_email","mintlify_create_agent_job","mintlify_create_assistant_message","mintlify_detect_ai_prose","mintlify_get_agent_job","mintlify_get_assistant_caller_stats","mintlify_get_assistant_conversations","mintlify_get_feedback","mintlify_get_feedback_by_page","mintlify_get_page_content","mintlify_get_searches","mintlify_get_update_status","mintlify_get_views","mintlify_get_visitors","mintlify_search","mintlify_send_agent_message","mintlify_trigger_automation","mintlify_trigger_preview","mintlify_trigger_update","mistral_parser","mistral_parser_v2","mistral_parser_v3","modal_call_function","modal_chat_completion","modal_list_models","monday_archive_item","monday_change_column_value","monday_create_board","monday_create_column","monday_create_group","monday_create_item","monday_create_subitem","monday_create_update","monday_delete_item","monday_duplicate_item","monday_get_board","monday_get_groups","monday_get_item","monday_get_items","monday_list_boards","monday_move_item_to_group","monday_search_items","monday_update_item","mongodb_delete","mongodb_execute","mongodb_insert","mongodb_introspect","mongodb_query","mongodb_update","mssql_delete","mssql_execute","mssql_insert","mssql_introspect","mssql_query","mssql_update","mysql_delete","mysql_execute","mysql_insert","mysql_introspect","mysql_query","mysql_update","neo4j_create","neo4j_delete","neo4j_execute","neo4j_introspect","neo4j_merge","neo4j_query","neo4j_update","netsuite_attach_record","netsuite_batch_create_records","netsuite_batch_delete_records","netsuite_batch_get_records","netsuite_batch_update_records","netsuite_batch_upsert_records","netsuite_create_record","netsuite_delete_record","netsuite_detach_record","netsuite_execute_action","netsuite_execute_dataset","netsuite_execute_suiteql","netsuite_get_async_result","netsuite_get_async_status","netsuite_get_governance_limits","netsuite_get_record","netsuite_get_record_form","netsuite_get_record_metadata","netsuite_get_select_options","netsuite_get_server_time","netsuite_get_subresource","netsuite_list_datasets","netsuite_list_record_types","netsuite_list_records","netsuite_transform_record","netsuite_update_record","netsuite_upsert_record","neverbounce_get_credits","neverbounce_verify_email","new_relic_create_deployment_event","new_relic_get_entity","new_relic_nrql_query","new_relic_search_entities","notion_add_database_row","notion_add_database_row_v2","notion_append_blocks","notion_append_blocks_v2","notion_create_comment","notion_create_comment_v2","notion_create_database","notion_create_database_v2","notion_create_page","notion_create_page_v2","notion_delete_block","notion_delete_block_v2","notion_list_comments","notion_list_comments_v2","notion_list_users","notion_list_users_v2","notion_query_database","notion_query_database_v2","notion_read","notion_read_database","notion_read_database_v2","notion_read_v2","notion_retrieve_block","notion_retrieve_block_children","notion_retrieve_block_children_v2","notion_retrieve_block_v2","notion_retrieve_user","notion_retrieve_user_v2","notion_search","notion_search_v2","notion_update_block","notion_update_block_v2","notion_update_page","notion_update_page_v2","notion_write","notion_write_v2","obsidian_append_active","obsidian_append_note","obsidian_append_periodic_note","obsidian_create_note","obsidian_delete_note","obsidian_execute_command","obsidian_get_active","obsidian_get_note","obsidian_get_periodic_note","obsidian_list_commands","obsidian_list_files","obsidian_open_file","obsidian_patch_active","obsidian_patch_note","obsidian_search","okta_activate_group_rule","okta_activate_user","okta_add_user_to_group","okta_assign_group_to_app","okta_assign_user_role","okta_assign_user_to_app","okta_clear_user_sessions","okta_create_group","okta_create_group_rule","okta_create_user","okta_deactivate_group_rule","okta_deactivate_user","okta_delete_group","okta_delete_group_rule","okta_delete_user","okta_enroll_factor","okta_get_app","okta_get_factor","okta_get_group","okta_get_group_rule","okta_get_logs","okta_get_session","okta_get_user","okta_list_app_groups","okta_list_app_users","okta_list_apps","okta_list_factors","okta_list_group_members","okta_list_group_rules","okta_list_groups","okta_list_user_roles","okta_list_users","okta_remove_group_from_app","okta_remove_user_from_app","okta_remove_user_from_group","okta_remove_user_role","okta_reset_all_factors","okta_reset_factor","okta_reset_password","okta_revoke_session","okta_suspend_user","okta_unsuspend_user","okta_update_group","okta_update_user","onedrive_copy","onedrive_create_folder","onedrive_create_share_link","onedrive_delete","onedrive_download","onedrive_get_drive_info","onedrive_get_item","onedrive_list","onedrive_move","onedrive_search","onedrive_upload","onepassword_create_item","onepassword_delete_item","onepassword_get_item","onepassword_get_item_file","onepassword_get_vault","onepassword_list_items","onepassword_list_vaults","onepassword_replace_item","onepassword_resolve_secret","onepassword_update_item","openai_embeddings","openai_image","oracle_fusion_financials_apply_receivables_receipt","oracle_fusion_financials_approve_receivables_invoice","oracle_fusion_financials_create_expense_line","oracle_fusion_financials_create_expense_report","oracle_fusion_financials_create_receivables_credit_memo","oracle_fusion_financials_create_receivables_invoice","oracle_fusion_financials_create_receivables_receipt","oracle_fusion_financials_get_expense_line","oracle_fusion_financials_get_expense_report","oracle_fusion_financials_get_gl_journal_batch","oracle_fusion_financials_get_gl_ledger","oracle_fusion_financials_get_payables_invoice","oracle_fusion_financials_get_payables_invoice_line","oracle_fusion_financials_get_payables_payment","oracle_fusion_financials_get_receivables_credit_memo","oracle_fusion_financials_get_receivables_invoice","oracle_fusion_financials_get_receivables_invoice_installment","oracle_fusion_financials_get_receivables_invoice_line","oracle_fusion_financials_get_receivables_receipt","oracle_fusion_financials_list_expense_lines","oracle_fusion_financials_list_expense_reports","oracle_fusion_financials_list_gl_balances","oracle_fusion_financials_list_gl_journal_batches","oracle_fusion_financials_list_gl_ledgers","oracle_fusion_financials_list_payables_invoice_lines","oracle_fusion_financials_list_payables_invoices","oracle_fusion_financials_list_payables_payments","oracle_fusion_financials_list_receivables_credit_memos","oracle_fusion_financials_list_receivables_invoice_installments","oracle_fusion_financials_list_receivables_invoice_lines","oracle_fusion_financials_list_receivables_invoices","oracle_fusion_financials_list_receivables_receipts","oracle_fusion_financials_submit_expense_report","oracle_fusion_financials_update_expense_line","oracle_fusion_financials_update_expense_report","oracle_fusion_financials_update_receivables_invoice","oracledb_delete","oracledb_execute","oracledb_insert","oracledb_introspect","oracledb_query","oracledb_update","otter_create_conversation","otter_get_conversation","otter_get_conversation_audio","otter_get_workspace","otter_list_channel_members","otter_list_channels","otter_list_conversations","otter_list_workspace_conversations","outlook_calendar_create_event","outlook_calendar_delete_event","outlook_calendar_get_event","outlook_calendar_list_events","outlook_calendar_respond","outlook_calendar_update_event","outlook_copy","outlook_create_folder","outlook_delete","outlook_draft","outlook_forward","outlook_get_attachment","outlook_list_attachments","outlook_list_folders","outlook_mark_read","outlook_mark_unread","outlook_move","outlook_read","outlook_reply","outlook_reply_all","outlook_search","outlook_send","outlook_update_message","pagerduty_add_note","pagerduty_create_incident","pagerduty_get_incident","pagerduty_get_service","pagerduty_list_escalation_policies","pagerduty_list_incident_alerts","pagerduty_list_incidents","pagerduty_list_oncalls","pagerduty_list_schedules","pagerduty_list_services","pagerduty_list_users","pagerduty_merge_incidents","pagerduty_send_event","pagerduty_snooze_incident","pagerduty_update_incident","parallel_deep_research","parallel_extract","parallel_search","pdl_autocomplete","pdl_bulk_company_enrich","pdl_bulk_person_enrich","pdl_clean_company","pdl_clean_location","pdl_clean_school","pdl_company_enrich","pdl_company_search","pdl_person_enrich","pdl_person_identify","pdl_person_search","perplexity_chat","perplexity_search","persona_approve_inquiry","persona_create_account","persona_create_inquiry","persona_create_report","persona_decline_inquiry","persona_expire_inquiry","persona_generate_inquiry_link","persona_get_account","persona_get_case","persona_get_document","persona_get_inquiry","persona_get_report","persona_get_verification","persona_import_accounts","persona_list_accounts","persona_list_cases","persona_list_inquiries","persona_list_inquiry_templates","persona_list_reports","persona_mark_inquiry_for_review","persona_print_inquiry_pdf","persona_redact_account","persona_redact_inquiry","persona_resume_inquiry","persona_update_account","persona_update_inquiry","pinecone_delete_vectors","pinecone_describe_index","pinecone_describe_index_stats","pinecone_fetch","pinecone_generate_embeddings","pinecone_list_indexes","pinecone_list_vector_ids","pinecone_search_text","pinecone_search_vector","pinecone_update_vector","pinecone_upsert_text","pipedrive_create_activity","pipedrive_create_deal","pipedrive_create_lead","pipedrive_create_project","pipedrive_delete_lead","pipedrive_get_activities","pipedrive_get_all_deals","pipedrive_get_deal","pipedrive_get_files","pipedrive_get_leads","pipedrive_get_mail_messages","pipedrive_get_mail_thread","pipedrive_get_pipeline_deals","pipedrive_get_pipelines","pipedrive_get_projects","pipedrive_update_activity","pipedrive_update_deal","pipedrive_update_lead","pitchbook_company_active_investors","pitchbook_company_bio","pitchbook_company_deal_service_providers","pitchbook_company_deals","pitchbook_company_financials","pitchbook_company_general_service_providers","pitchbook_company_industries","pitchbook_company_investors","pitchbook_company_most_recent_debt_financing","pitchbook_company_most_recent_financials","pitchbook_company_most_recent_financing","pitchbook_company_search","pitchbook_company_similar_companies","pitchbook_company_social_analytics","pitchbook_company_updates","pitchbook_company_vc_exit_predictions","pitchbook_contracts_history","pitchbook_cost_of_calls","pitchbook_credit_history","pitchbook_credit_news","pitchbook_credit_news_bulk","pitchbook_credit_news_most_recent","pitchbook_credit_news_search","pitchbook_deal_bio","pitchbook_deal_cap_table_history","pitchbook_deal_debt_lenders","pitchbook_deal_detailed","pitchbook_deal_investors","pitchbook_deal_multiples","pitchbook_deal_search","pitchbook_deal_service_providers","pitchbook_deal_stock_info","pitchbook_deal_tranche_info","pitchbook_deal_updates","pitchbook_deal_valuation","pitchbook_entity_affiliates","pitchbook_entity_locations","pitchbook_entity_news","pitchbook_entity_people","pitchbook_entity_updates","pitchbook_fund_active_investments","pitchbook_fund_benchmark","pitchbook_fund_bio","pitchbook_fund_cash_flows","pitchbook_fund_commitments","pitchbook_fund_investment_preferences","pitchbook_fund_investments","pitchbook_fund_performance","pitchbook_fund_search","pitchbook_fund_team","pitchbook_fund_updates","pitchbook_investor_active_investments","pitchbook_investor_bio","pitchbook_investor_board_seats","pitchbook_investor_deal_service_providers","pitchbook_investor_funds","pitchbook_investor_general_service_providers","pitchbook_investor_investments","pitchbook_investor_last_closed_fund","pitchbook_investor_preferences","pitchbook_investor_search","pitchbook_investor_updates","pitchbook_limited_partner_actual_allocations","pitchbook_limited_partner_bio","pitchbook_limited_partner_commitment_aggregates","pitchbook_limited_partner_commitment_preferences","pitchbook_limited_partner_commitments_detailed","pitchbook_limited_partner_search","pitchbook_limited_partner_service_providers","pitchbook_limited_partner_target_allocations","pitchbook_limited_partner_updates","pitchbook_lookup_table_structure","pitchbook_lookup_tables","pitchbook_patent_detailed","pitchbook_patent_search","pitchbook_people_search","pitchbook_person_bio","pitchbook_person_contact","pitchbook_person_education_work","pitchbook_sandbox_entities","pitchbook_search","pitchbook_service_provider_bio","pitchbook_service_provider_search","pitchbook_service_provider_updates","pitchbook_serviced_companies","pitchbook_serviced_deals","pitchbook_serviced_funds","pitchbook_serviced_investors","pitchbook_serviced_limited_partners","pitchbook_shared_search","pitchbook_usage_report","plane_archive_project","plane_archive_work_item","plane_confirm_attachment_upload","plane_create_attachment_upload","plane_create_comment","plane_create_cycle","plane_create_label","plane_create_link","plane_create_module","plane_create_project","plane_create_project_page","plane_create_state","plane_create_webhook","plane_create_work_item","plane_delete_attachment","plane_delete_comment","plane_delete_cycle","plane_delete_label","plane_delete_link","plane_delete_module","plane_delete_project","plane_delete_project_page","plane_delete_state","plane_delete_webhook","plane_delete_work_item","plane_get_attachment","plane_get_comment","plane_get_current_user","plane_get_cycle","plane_get_label","plane_get_link","plane_get_module","plane_get_project","plane_get_project_page","plane_get_project_summary","plane_get_state","plane_get_webhook","plane_get_work_item","plane_get_work_item_by_identifier","plane_list_attachments","plane_list_comments","plane_list_cycles","plane_list_labels","plane_list_links","plane_list_modules","plane_list_project_pages","plane_list_projects","plane_list_states","plane_list_webhooks","plane_list_work_items","plane_list_workspace_work_items","plane_manage_cycle_work_items","plane_manage_module_work_items","plane_regenerate_webhook_secret","plane_transfer_cycle_work_items","plane_unarchive_project","plane_unarchive_work_item","plane_update_comment","plane_update_cycle","plane_update_label","plane_update_link","plane_update_module","plane_update_project","plane_update_project_page","plane_update_state","plane_update_webhook","plane_update_work_item","planetscale_close_deploy_request","planetscale_create_backup","planetscale_create_branch","planetscale_create_deploy_request","planetscale_delete_branch","planetscale_get_backup","planetscale_get_branch","planetscale_get_database","planetscale_get_deploy_request","planetscale_list_backups","planetscale_list_branches","planetscale_list_databases","planetscale_list_deploy_requests","planetscale_queue_deploy_request","planetscale_review_deploy_request","polymarket_get_activity","polymarket_get_event","polymarket_get_events","polymarket_get_holders","polymarket_get_last_trade_price","polymarket_get_leaderboard","polymarket_get_market","polymarket_get_markets","polymarket_get_midpoint","polymarket_get_orderbook","polymarket_get_positions","polymarket_get_price","polymarket_get_price_history","polymarket_get_series","polymarket_get_series_by_id","polymarket_get_spread","polymarket_get_tags","polymarket_get_tick_size","polymarket_get_trades","polymarket_search","postgresql_delete","postgresql_execute","postgresql_insert","postgresql_introspect","postgresql_query","postgresql_update","posthog_batch_events","posthog_capture_event","posthog_create_annotation","posthog_create_cohort","posthog_create_dashboard","posthog_create_experiment","posthog_create_feature_flag","posthog_create_insight","posthog_create_survey","posthog_delete_feature_flag","posthog_delete_person","posthog_delete_survey","posthog_evaluate_flags","posthog_get_cohort","posthog_get_dashboard","posthog_get_event_definition","posthog_get_experiment","posthog_get_feature_flag","posthog_get_insight","posthog_get_organization","posthog_get_person","posthog_get_project","posthog_get_property_definition","posthog_get_session_recording","posthog_get_survey","posthog_list_actions","posthog_list_annotations","posthog_list_cohorts","posthog_list_dashboards","posthog_list_event_definitions","posthog_list_experiments","posthog_list_feature_flags","posthog_list_insights","posthog_list_organizations","posthog_list_persons","posthog_list_projects","posthog_list_property_definitions","posthog_list_recording_playlists","posthog_list_session_recordings","posthog_list_surveys","posthog_query","posthog_update_cohort","posthog_update_event_definition","posthog_update_experiment","posthog_update_feature_flag","posthog_update_insight","posthog_update_property_definition","posthog_update_survey","powerbi_execute_query","powerbi_get_dataset","powerbi_get_refresh_history","powerbi_get_report","powerbi_list_datasets","powerbi_list_reports","powerbi_list_workspaces","powerbi_refresh_dataset","profound_bot_logs","profound_bots_report","profound_category_assets","profound_category_personas","profound_category_prompts","profound_category_tags","profound_category_topics","profound_citation_prompts","profound_citations_report","profound_list_assets","profound_list_categories","profound_list_domains","profound_list_models","profound_list_optimizations","profound_list_personas","profound_list_regions","profound_optimization_analysis","profound_prompt_answers","profound_prompt_volume","profound_query_fanouts","profound_raw_logs","profound_referrals_report","profound_sentiment_report","profound_visibility_report","prospeo_account_information","prospeo_bulk_enrich_company","prospeo_bulk_enrich_person","prospeo_enrich_company","prospeo_enrich_person","prospeo_search_company","prospeo_search_person","prospeo_search_suggestions","pulse_parser","pulse_parser_v2","qdrant_fetch_points","qdrant_search_vector","qdrant_upsert_points","quartr_get_audio","quartr_get_company","quartr_get_event","quartr_get_event_summary","quartr_get_report","quartr_get_slide_deck","quartr_get_transcript","quartr_list_audio","quartr_list_companies","quartr_list_document_types","quartr_list_documents","quartr_list_event_types","quartr_list_events","quartr_list_live_events","quartr_list_reports","quartr_list_slide_decks","quartr_list_transcripts","quickbooks_add_attachment","quickbooks_create_bill","quickbooks_create_bill_payment","quickbooks_create_credit_memo","quickbooks_create_customer","quickbooks_create_customer_payment","quickbooks_create_deposit","quickbooks_create_employee","quickbooks_create_estimate","quickbooks_create_invoice","quickbooks_create_item","quickbooks_create_journal_entry","quickbooks_create_purchase","quickbooks_create_purchase_order","quickbooks_create_refund_receipt","quickbooks_create_sales_receipt","quickbooks_create_vendor","quickbooks_create_vendor_credit","quickbooks_download_attachment","quickbooks_download_transaction_pdf","quickbooks_email_transaction","quickbooks_get_company_info","quickbooks_read_accounting_transactions","quickbooks_read_attachments","quickbooks_read_master_data","quickbooks_read_purchasing_transactions","quickbooks_read_sales_transactions","quickbooks_run_financial_report","quickbooks_update_bill","quickbooks_update_bill_payment","quickbooks_update_credit_memo","quickbooks_update_customer","quickbooks_update_customer_payment","quickbooks_update_deposit","quickbooks_update_employee","quickbooks_update_estimate","quickbooks_update_invoice","quickbooks_update_item","quickbooks_update_journal_entry","quickbooks_update_purchase","quickbooks_update_purchase_order","quickbooks_update_refund_receipt","quickbooks_update_sales_receipt","quickbooks_update_vendor","quickbooks_update_vendor_credit","quickbooks_void_bill_payment","quickbooks_void_customer_payment","quickbooks_void_invoice","quickbooks_void_sales_receipt","quiver_image_to_svg","quiver_image_to_svg_v2","quiver_list_models","quiver_text_to_svg","quiver_text_to_svg_v2","rabbitmq_create_binding","rabbitmq_create_exchange","rabbitmq_create_policy","rabbitmq_create_queue","rabbitmq_delete_binding","rabbitmq_delete_exchange","rabbitmq_delete_policy","rabbitmq_delete_queue","rabbitmq_get_exchange","rabbitmq_get_messages","rabbitmq_get_overview","rabbitmq_get_queue","rabbitmq_health_check","rabbitmq_list_bindings","rabbitmq_list_channels","rabbitmq_list_connections","rabbitmq_list_consumers","rabbitmq_list_exchange_bindings","rabbitmq_list_exchanges","rabbitmq_list_nodes","rabbitmq_list_policies","rabbitmq_list_queues","rabbitmq_list_vhosts","rabbitmq_publish_message","rabbitmq_purge_queue","railway_create_environment","railway_create_project","railway_create_service","railway_delete_environment","railway_delete_project","railway_delete_service","railway_delete_variable","railway_deploy_service","railway_get_deployment","railway_get_deployment_logs","railway_get_project","railway_list_deployments","railway_list_project_members","railway_list_projects","railway_list_variables","railway_restart_deployment","railway_rollback_deployment","railway_transfer_project","railway_update_project","railway_upsert_variable","ramp_create_memo","ramp_get_balance","ramp_get_bill","ramp_get_business","ramp_get_memo","ramp_get_physical_card","ramp_get_reimbursement","ramp_get_transaction","ramp_get_user","ramp_get_vendor","ramp_get_virtual_card","ramp_list_bills","ramp_list_physical_cards","ramp_list_reimbursements","ramp_list_transactions","ramp_list_users","ramp_list_vendors","ramp_list_virtual_cards","rb2b_credit_check","rb2b_email_to_activity","rb2b_hem_to_best_linkedin","rb2b_hem_to_business_profile","rb2b_hem_to_linkedin","rb2b_hem_to_maid","rb2b_ip_to_company","rb2b_ip_to_hem","rb2b_ip_to_maid","rb2b_linkedin_slug_search","rb2b_linkedin_to_best_personal_email","rb2b_linkedin_to_business_profile","rb2b_linkedin_to_hashed_emails","rb2b_linkedin_to_mobile_phone","rb2b_linkedin_to_personal_email","rds_delete","rds_execute","rds_insert","rds_introspect","rds_query","rds_update","reddit_delete","reddit_edit","reddit_get_comments","reddit_get_controversial","reddit_get_info","reddit_get_me","reddit_get_messages","reddit_get_posts","reddit_get_saved","reddit_get_subreddit_info","reddit_get_subreddit_rules","reddit_get_user","reddit_get_user_comments","reddit_get_user_posts","reddit_hide","reddit_hot_posts","reddit_list_my_subreddits","reddit_lock","reddit_mark_all_read","reddit_mark_read","reddit_marknsfw","reddit_mod_approve","reddit_mod_distinguish","reddit_mod_remove","reddit_mod_sticky","reddit_reply","reddit_report","reddit_save","reddit_search","reddit_search_subreddits","reddit_send_message","reddit_submit_post","reddit_subscribe","reddit_unhide","reddit_unlock","reddit_unmarknsfw","reddit_unsave","reddit_vote","redis_command","redis_delete","redis_exists","redis_expire","redis_get","redis_hdel","redis_hget","redis_hgetall","redis_hset","redis_incr","redis_incrby","redis_keys","redis_llen","redis_lpop","redis_lpush","redis_lrange","redis_persist","redis_rpop","redis_rpush","redis_set","redis_setnx","redis_ttl","reducto_parser","reducto_parser_v2","resend_cancel_email","resend_create_audience","resend_create_broadcast","resend_create_contact","resend_delete_audience","resend_delete_contact","resend_get_audience","resend_get_broadcast","resend_get_contact","resend_get_email","resend_list_audiences","resend_list_contacts","resend_list_domains","resend_send","resend_send_broadcast","resend_update_contact","revenuecat_create_purchase","revenuecat_defer_google_subscription","revenuecat_delete_customer","revenuecat_get_customer","revenuecat_grant_entitlement","revenuecat_list_offerings","revenuecat_refund_google_subscription","revenuecat_revoke_entitlement","revenuecat_revoke_google_subscription","revenuecat_update_subscriber_attributes","rippling_bulk_create_custom_object_records","rippling_bulk_delete_custom_object_records","rippling_bulk_update_custom_object_records","rippling_create_business_partner","rippling_create_business_partner_group","rippling_create_custom_app","rippling_create_custom_object","rippling_create_custom_object_field","rippling_create_custom_object_record","rippling_create_custom_page","rippling_create_custom_setting","rippling_create_department","rippling_create_draft_hires","rippling_create_object_category","rippling_create_title","rippling_create_work_location","rippling_delete_business_partner","rippling_delete_business_partner_group","rippling_delete_custom_app","rippling_delete_custom_object","rippling_delete_custom_object_field","rippling_delete_custom_object_record","rippling_delete_custom_page","rippling_delete_custom_setting","rippling_delete_object_category","rippling_delete_title","rippling_delete_work_location","rippling_get_business_partner","rippling_get_business_partner_group","rippling_get_current_user","rippling_get_custom_app","rippling_get_custom_object","rippling_get_custom_object_field","rippling_get_custom_object_record","rippling_get_custom_object_record_by_external_id","rippling_get_custom_page","rippling_get_custom_setting","rippling_get_department","rippling_get_employment_type","rippling_get_job_function","rippling_get_object_category","rippling_get_report_run","rippling_get_supergroup","rippling_get_team","rippling_get_title","rippling_get_user","rippling_get_work_location","rippling_get_worker","rippling_list_business_partner_groups","rippling_list_business_partners","rippling_list_companies","rippling_list_custom_apps","rippling_list_custom_fields","rippling_list_custom_object_fields","rippling_list_custom_object_records","rippling_list_custom_objects","rippling_list_custom_pages","rippling_list_custom_settings","rippling_list_departments","rippling_list_employment_types","rippling_list_entitlements","rippling_list_job_functions","rippling_list_object_categories","rippling_list_supergroup_exclusion_members","rippling_list_supergroup_inclusion_members","rippling_list_supergroup_members","rippling_list_supergroups","rippling_list_teams","rippling_list_titles","rippling_list_users","rippling_list_work_locations","rippling_list_workers","rippling_query_custom_object_records","rippling_trigger_report_run","rippling_update_custom_app","rippling_update_custom_object","rippling_update_custom_object_field","rippling_update_custom_object_record","rippling_update_custom_page","rippling_update_custom_setting","rippling_update_department","rippling_update_object_category","rippling_update_supergroup_exclusion_members","rippling_update_supergroup_inclusion_members","rippling_update_title","rippling_update_work_location","rocketlane_add_field_option","rocketlane_add_project_members","rocketlane_add_task_assignees","rocketlane_add_task_dependencies","rocketlane_add_task_followers","rocketlane_archive_project","rocketlane_assign_placeholders","rocketlane_create_field","rocketlane_create_phase","rocketlane_create_project","rocketlane_create_space","rocketlane_create_space_document","rocketlane_create_task","rocketlane_create_time_entry","rocketlane_create_time_off","rocketlane_delete_field","rocketlane_delete_phase","rocketlane_delete_project","rocketlane_delete_space","rocketlane_delete_space_document","rocketlane_delete_task","rocketlane_delete_time_entry","rocketlane_delete_time_off","rocketlane_get_field","rocketlane_get_invoice","rocketlane_get_invoice_line_items","rocketlane_get_invoice_payments","rocketlane_get_phase","rocketlane_get_project","rocketlane_get_space","rocketlane_get_space_document","rocketlane_get_task","rocketlane_get_time_entry","rocketlane_get_time_off","rocketlane_get_user","rocketlane_import_template","rocketlane_list_fields","rocketlane_list_invoices","rocketlane_list_phases","rocketlane_list_placeholders","rocketlane_list_projects","rocketlane_list_resource_allocations","rocketlane_list_space_documents","rocketlane_list_spaces","rocketlane_list_tasks","rocketlane_list_time_entries","rocketlane_list_time_entry_categories","rocketlane_list_time_offs","rocketlane_list_users","rocketlane_move_task_to_phase","rocketlane_remove_project_members","rocketlane_remove_task_assignees","rocketlane_remove_task_dependencies","rocketlane_remove_task_followers","rocketlane_search_time_entries","rocketlane_unassign_placeholders","rocketlane_update_field","rocketlane_update_field_option","rocketlane_update_phase","rocketlane_update_project","rocketlane_update_space","rocketlane_update_space_document","rocketlane_update_task","rocketlane_update_time_entry","rootly_acknowledge_alert","rootly_add_incident_event","rootly_add_subscribers","rootly_assign_incident_role","rootly_create_action_item","rootly_create_alert","rootly_create_incident","rootly_create_status_page_event","rootly_delete_action_item","rootly_delete_incident","rootly_escalate_alert","rootly_get_alert","rootly_get_incident","rootly_list_action_items","rootly_list_alerts","rootly_list_causes","rootly_list_environments","rootly_list_escalation_policies","rootly_list_functionalities","rootly_list_incident_events","rootly_list_incident_roles","rootly_list_incident_types","rootly_list_incidents","rootly_list_on_calls","rootly_list_playbooks","rootly_list_retrospectives","rootly_list_schedules","rootly_list_services","rootly_list_severities","rootly_list_teams","rootly_list_users","rootly_mitigate_incident","rootly_remove_subscribers","rootly_resolve_alert","rootly_resolve_incident","rootly_run_workflow","rootly_snooze_alert","rootly_unassign_incident_role","rootly_update_action_item","rootly_update_alert","rootly_update_incident","s3_copy_object","s3_create_bucket","s3_delete_bucket","s3_delete_object","s3_delete_objects","s3_get_object","s3_head_object","s3_list_buckets","s3_list_objects","s3_presigned_url","s3_put_object","sailpoint_approve_access_request","sailpoint_cancel_access_request","sailpoint_decide_certification_review_items","sailpoint_get_access_profile","sailpoint_get_access_profile_entitlements","sailpoint_get_access_request_config","sailpoint_get_access_request_status","sailpoint_get_account","sailpoint_get_account_activity","sailpoint_get_account_entitlements","sailpoint_get_account_selections","sailpoint_get_campaign","sailpoint_get_certification","sailpoint_get_entitlement","sailpoint_get_entitlement_request_config","sailpoint_get_identity","sailpoint_get_role","sailpoint_get_role_entitlements","sailpoint_get_source","sailpoint_get_task_status","sailpoint_list_access_profiles","sailpoint_list_account_activities","sailpoint_list_accounts","sailpoint_list_campaigns","sailpoint_list_certification_review_items","sailpoint_list_certifications","sailpoint_list_entitlements","sailpoint_list_identities","sailpoint_list_identity_entitlements","sailpoint_list_pending_access_request_approvals","sailpoint_list_roles","sailpoint_list_sources","sailpoint_load_accounts","sailpoint_load_entitlements","sailpoint_reject_access_request","sailpoint_request_access","sailpoint_search","sailpoint_search_aggregate","sailpoint_search_count","sailpoint_sign_off_certification","salesforce_create_account","salesforce_create_case","salesforce_create_contact","salesforce_create_custom_field","salesforce_create_custom_object","salesforce_create_lead","salesforce_create_opportunity","salesforce_create_task","salesforce_delete_account","salesforce_delete_case","salesforce_delete_contact","salesforce_delete_custom_field","salesforce_delete_lead","salesforce_delete_opportunity","salesforce_delete_task","salesforce_describe_object","salesforce_get_accounts","salesforce_get_cases","salesforce_get_contacts","salesforce_get_dashboard","salesforce_get_leads","salesforce_get_opportunities","salesforce_get_report","salesforce_get_tasks","salesforce_list_dashboards","salesforce_list_objects","salesforce_list_report_types","salesforce_list_reports","salesforce_query","salesforce_query_more","salesforce_refresh_dashboard","salesforce_run_report","salesforce_tooling_query","salesforce_update_account","salesforce_update_case","salesforce_update_contact","salesforce_update_custom_field","salesforce_update_lead","salesforce_update_opportunity","salesforce_update_task","sap_concur_approve_expense_report","sap_concur_associate_attendees","sap_concur_create_cash_advance","sap_concur_create_expected_expense","sap_concur_create_expense_report","sap_concur_create_list_item","sap_concur_create_purchase_request","sap_concur_create_quick_expense","sap_concur_create_quick_expense_with_image","sap_concur_create_report_comment","sap_concur_create_travel_request","sap_concur_create_user","sap_concur_delete_expected_expense","sap_concur_delete_expense","sap_concur_delete_expense_report","sap_concur_delete_list_item","sap_concur_delete_travel_request","sap_concur_delete_user","sap_concur_get_allocation","sap_concur_get_budget","sap_concur_get_cash_advance","sap_concur_get_expected_expense","sap_concur_get_expense","sap_concur_get_expense_report","sap_concur_get_itemizations","sap_concur_get_itinerary","sap_concur_get_list","sap_concur_get_list_item","sap_concur_get_purchase_request","sap_concur_get_receipt","sap_concur_get_receipt_status","sap_concur_get_request_cash_advance","sap_concur_get_travel_profile","sap_concur_get_travel_request","sap_concur_get_user","sap_concur_issue_cash_advance","sap_concur_list_allocations","sap_concur_list_attendee_associations","sap_concur_list_budget_categories","sap_concur_list_budgets","sap_concur_list_exceptions","sap_concur_list_expected_expenses","sap_concur_list_expense_reports","sap_concur_list_expenses","sap_concur_list_itineraries","sap_concur_list_list_items","sap_concur_list_lists","sap_concur_list_receipts","sap_concur_list_report_comments","sap_concur_list_reports_to_approve","sap_concur_list_travel_profiles_summary","sap_concur_list_travel_request_comments","sap_concur_list_travel_requests","sap_concur_list_users","sap_concur_move_travel_request","sap_concur_recall_expense_report","sap_concur_remove_all_attendees","sap_concur_search_locations","sap_concur_search_users","sap_concur_send_back_expense_report","sap_concur_submit_expense_report","sap_concur_update_allocation","sap_concur_update_expected_expense","sap_concur_update_expense","sap_concur_update_expense_report","sap_concur_update_list_item","sap_concur_update_travel_request","sap_concur_update_user","sap_concur_upload_exchange_rates","sap_concur_upload_receipt_image","sap_s4hana_create_business_partner","sap_s4hana_create_purchase_order","sap_s4hana_create_purchase_requisition","sap_s4hana_create_sales_order","sap_s4hana_delete_sales_order","sap_s4hana_get_billing_document","sap_s4hana_get_business_partner","sap_s4hana_get_customer","sap_s4hana_get_inbound_delivery","sap_s4hana_get_material_document","sap_s4hana_get_outbound_delivery","sap_s4hana_get_product","sap_s4hana_get_purchase_order","sap_s4hana_get_purchase_requisition","sap_s4hana_get_sales_order","sap_s4hana_get_supplier","sap_s4hana_get_supplier_invoice","sap_s4hana_list_billing_documents","sap_s4hana_list_business_partners","sap_s4hana_list_customers","sap_s4hana_list_inbound_deliveries","sap_s4hana_list_material_documents","sap_s4hana_list_material_stock","sap_s4hana_list_outbound_deliveries","sap_s4hana_list_products","sap_s4hana_list_purchase_orders","sap_s4hana_list_purchase_requisitions","sap_s4hana_list_sales_orders","sap_s4hana_list_supplier_invoices","sap_s4hana_list_suppliers","sap_s4hana_odata_query","sap_s4hana_update_business_partner","sap_s4hana_update_customer","sap_s4hana_update_product","sap_s4hana_update_purchase_order","sap_s4hana_update_purchase_requisition","sap_s4hana_update_sales_order","sap_s4hana_update_supplier","search_tool","secrets_manager_create_secret","secrets_manager_delete_secret","secrets_manager_describe_secret","secrets_manager_get_secret","secrets_manager_list_secrets","secrets_manager_restore_secret","secrets_manager_rotate_secret","secrets_manager_tag_resource","secrets_manager_untag_resource","secrets_manager_update_secret","semrush_backlinks","semrush_backlinks_anchors","semrush_backlinks_competitors","semrush_backlinks_geo_distribution","semrush_backlinks_indexed_pages","semrush_backlinks_overview","semrush_backlinks_tld_distribution","semrush_batch_keyword_overview","semrush_broad_match_keywords","semrush_domain_ad_copies","semrush_domain_ad_history","semrush_domain_organic_competitors","semrush_domain_organic_keywords","semrush_domain_overview","semrush_domain_overview_all","semrush_domain_overview_history","semrush_domain_paid_competitors","semrush_domain_paid_keywords","semrush_domain_pla_copies","semrush_domain_pla_keywords","semrush_domain_vs_domain","semrush_keyword_ad_history","semrush_keyword_difficulty","semrush_keyword_overview","semrush_keyword_overview_all","semrush_keyword_questions","semrush_organic_results","semrush_paid_results","semrush_referring_domains","semrush_referring_ips","semrush_related_keywords","semrush_subdomain_ad_copies","semrush_subdomain_organic_keywords","semrush_subdomain_overview","semrush_subdomain_overview_all","semrush_subdomain_overview_history","semrush_subdomain_paid_keywords","semrush_top_domains","semrush_url_organic_keywords","semrush_url_overview","semrush_url_overview_all","semrush_url_overview_history","semrush_url_paid_keywords","semrush_winners_and_losers","sendblue_evaluate_service","sendblue_get_message","sendblue_send_group_message","sendblue_send_message","sendblue_send_typing_indicator","sendgrid_add_contact","sendgrid_add_contacts_to_list","sendgrid_create_list","sendgrid_create_template","sendgrid_create_template_version","sendgrid_delete_contacts","sendgrid_delete_list","sendgrid_delete_template","sendgrid_get_contact","sendgrid_get_list","sendgrid_get_template","sendgrid_list_all_lists","sendgrid_list_templates","sendgrid_remove_contacts_from_list","sendgrid_search_contacts","sendgrid_send_mail","sentry_events_get","sentry_events_list","sentry_issues_get","sentry_issues_list","sentry_issues_update","sentry_projects_create","sentry_projects_get","sentry_projects_list","sentry_projects_update","sentry_releases_create","sentry_releases_deploy","sentry_releases_list","sentry_teams_list","serper_search","servicenow_add_incident_comment","servicenow_aggregate","servicenow_close_incident","servicenow_create_change_request","servicenow_create_incident","servicenow_create_record","servicenow_delete_record","servicenow_download_attachment","servicenow_download_attachment_v2","servicenow_find_user","servicenow_get_change_next_states","servicenow_get_change_request","servicenow_get_ci","servicenow_get_incident","servicenow_get_knowledge_article","servicenow_get_requested_item","servicenow_list_approvals","servicenow_list_attachments","servicenow_list_catalog_items","servicenow_list_change_requests","servicenow_list_change_tasks","servicenow_list_ci_relationships","servicenow_list_group_members","servicenow_list_incidents","servicenow_list_requested_items","servicenow_order_catalog_item","servicenow_read_record","servicenow_resolve_incident","servicenow_search_cis","servicenow_search_knowledge","servicenow_update_approval","servicenow_update_change_request","servicenow_update_change_state","servicenow_update_incident","servicenow_update_record","servicenow_upload_attachment","ses_create_configuration_set","ses_create_email_identity","ses_create_template","ses_delete_email_identity","ses_delete_suppressed_destination","ses_delete_template","ses_get_account","ses_get_email_identity","ses_get_suppressed_destination","ses_get_template","ses_list_identities","ses_list_suppressed_destinations","ses_list_templates","ses_put_suppressed_destination","ses_send_bulk_email","ses_send_custom_verification_email","ses_send_email","ses_send_templated_email","ses_update_template","sftp_delete","sftp_download","sftp_download_v2","sftp_list","sftp_mkdir","sftp_upload","sharepoint_add_list_items","sharepoint_create_list","sharepoint_create_page","sharepoint_delete_file","sharepoint_delete_list_item","sharepoint_delete_page","sharepoint_download_file","sharepoint_get_drive_item","sharepoint_get_list","sharepoint_get_list_item","sharepoint_list_sites","sharepoint_publish_page","sharepoint_read_page","sharepoint_update_list","sharepoint_update_page","sharepoint_upload_file","shopify_adjust_inventory","shopify_cancel_order","shopify_create_customer","shopify_create_fulfillment","shopify_create_product","shopify_create_product_variants","shopify_delete_customer","shopify_delete_product","shopify_get_collection","shopify_get_customer","shopify_get_fulfillment","shopify_get_fulfillment_order","shopify_get_inventory_level","shopify_get_job","shopify_get_order","shopify_get_product","shopify_list_collections","shopify_list_customers","shopify_list_fulfillment_orders","shopify_list_inventory_items","shopify_list_locations","shopify_list_orders","shopify_list_products","shopify_update_customer","shopify_update_fulfillment_tracking","shopify_update_order","shopify_update_product","shopify_update_product_variants","similarweb_bounce_rate","similarweb_page_views","similarweb_pages_per_visit","similarweb_traffic_visits","similarweb_visit_duration","similarweb_website_overview","sixtyfour_enrich_company","sixtyfour_enrich_lead","sixtyfour_find_email","sixtyfour_find_phone","slack_add_bookmark","slack_add_reaction","slack_archive_conversation","slack_canvas","slack_close_conversation","slack_create_channel_canvas","slack_create_conversation","slack_create_user_group","slack_delete_canvas","slack_delete_file","slack_delete_message","slack_delete_scheduled_message","slack_disable_user_group","slack_download","slack_edit_bookmark","slack_edit_canvas","slack_enable_user_group","slack_ephemeral_message","slack_get_canvas","slack_get_channel_history","slack_get_channel_info","slack_get_dnd_info","slack_get_file_info","slack_get_message","slack_get_permalink","slack_get_reactions","slack_get_team_dnd_info","slack_get_team_info","slack_get_team_profile","slack_get_thread","slack_get_thread_replies","slack_get_user","slack_get_user_presence","slack_get_user_profile","slack_invite_to_conversation","slack_join_conversation","slack_kick_conversation","slack_leave_conversation","slack_list_bookmarks","slack_list_canvases","slack_list_channels","slack_list_emoji","slack_list_files","slack_list_members","slack_list_pins","slack_list_reactions","slack_list_scheduled_messages","slack_list_user_conversations","slack_list_user_group_members","slack_list_user_groups","slack_list_users","slack_lists_access_delete","slack_lists_access_set","slack_lists_create","slack_lists_download_get","slack_lists_download_start","slack_lists_items_create","slack_lists_items_delete","slack_lists_items_delete_multiple","slack_lists_items_info","slack_lists_items_list","slack_lists_items_update","slack_lists_update","slack_lookup_canvas_sections","slack_lookup_user_by_email","slack_mark_conversation_read","slack_message","slack_message_reader","slack_open_conversation","slack_open_view","slack_pin_message","slack_publish_view","slack_push_view","slack_remove_bookmark","slack_remove_reaction","slack_rename_agent_session_v2","slack_rename_conversation","slack_revoke_canvas_access","slack_schedule_message","slack_set_agent_session_status_v2","slack_set_conversation_purpose","slack_set_conversation_topic","slack_set_status","slack_set_suggested_prompts","slack_set_suggested_prompts_v2","slack_set_title","slack_set_user_presence","slack_share_canvas","slack_unarchive_conversation","slack_unfurl_links","slack_unpin_message","slack_update_message","slack_update_user_group","slack_update_user_group_members","slack_update_view","smartlead_add_email_accounts_to_campaign","smartlead_add_leads_to_campaign","smartlead_create_campaign","smartlead_create_lead_list","smartlead_delete_campaign","smartlead_delete_campaign_webhook","smartlead_delete_lead_from_campaign","smartlead_delete_lead_list","smartlead_duplicate_campaign","smartlead_export_campaign_leads","smartlead_get_campaign","smartlead_get_campaign_analytics","smartlead_get_campaign_analytics_by_date","smartlead_get_campaign_lead_statistics","smartlead_get_campaign_mailbox_statistics","smartlead_get_campaign_sequences","smartlead_get_campaign_statistics","smartlead_get_campaign_top_level_analytics_by_date","smartlead_get_campaign_webhook_summary","smartlead_get_lead_by_email","smartlead_get_lead_by_id","smartlead_get_lead_list","smartlead_get_lead_message_history","smartlead_list_campaign_email_accounts","smartlead_list_campaign_leads","smartlead_list_campaign_webhooks","smartlead_list_campaigns","smartlead_list_clients","smartlead_list_email_accounts","smartlead_list_inbox_replies","smartlead_list_lead_activities","smartlead_list_lead_categories","smartlead_list_lead_lists","smartlead_mark_lead_complete","smartlead_pause_lead","smartlead_remove_email_accounts_from_campaign","smartlead_resume_lead","smartlead_save_campaign_sequences","smartlead_unsubscribe_lead_from_campaign","smartlead_unsubscribe_lead_globally","smartlead_update_campaign_schedule","smartlead_update_campaign_settings","smartlead_update_campaign_status","smartlead_update_lead","smartlead_update_lead_category","smartlead_update_lead_list","smartlead_upsert_campaign_webhook","sms_send","smtp_send_mail","snowflake_alter_warehouse","snowflake_call_procedure","snowflake_cancel_statement","snowflake_cancel_task_run","snowflake_cortex_analyst_ask","snowflake_cortex_analyst_feedback","snowflake_delete_rows","snowflake_execute_sql","snowflake_get_statement","snowflake_get_task","snowflake_get_task_run","snowflake_get_task_run_output","snowflake_get_warehouse","snowflake_insert_rows","snowflake_introspect_schema","snowflake_list_copy_history","snowflake_list_databases","snowflake_list_query_history","snowflake_list_schemas","snowflake_list_tables","snowflake_list_task_runs","snowflake_list_tasks","snowflake_list_warehouses","snowflake_load_data","snowflake_resume_task","snowflake_resume_warehouse","snowflake_run_task","snowflake_suspend_task","snowflake_suspend_warehouse","snowflake_unload_data","snowflake_update_rows","snowflake_upsert_rows","splunk_cancel_search_job","splunk_create_search_job","splunk_dispatch_saved_search","splunk_get_fired_alerts","splunk_get_saved_search","splunk_get_search_job","splunk_get_search_results","splunk_list_apps","splunk_list_fired_alerts","splunk_list_indexes","splunk_list_saved_searches","splunk_run_search","sportmonks_core_get_cities","sportmonks_core_get_city","sportmonks_core_get_continent","sportmonks_core_get_continents","sportmonks_core_get_countries","sportmonks_core_get_country","sportmonks_core_get_entity_filters","sportmonks_core_get_my_usage","sportmonks_core_get_region","sportmonks_core_get_regions","sportmonks_core_get_timezones","sportmonks_core_get_type","sportmonks_core_get_type_by_entity","sportmonks_core_get_types","sportmonks_core_search_cities","sportmonks_core_search_countries","sportmonks_core_search_regions","sportmonks_football_expected_by_player","sportmonks_football_expected_by_team","sportmonks_football_get_all_commentaries","sportmonks_football_get_all_fixtures","sportmonks_football_get_all_players","sportmonks_football_get_all_rivals","sportmonks_football_get_all_teams","sportmonks_football_get_all_transfer_rumours","sportmonks_football_get_all_transfers","sportmonks_football_get_brackets_by_season","sportmonks_football_get_coach","sportmonks_football_get_coaches","sportmonks_football_get_coaches_by_country","sportmonks_football_get_commentaries_by_fixture","sportmonks_football_get_current_leagues_by_team","sportmonks_football_get_expected_lineups_by_player","sportmonks_football_get_expected_lineups_by_team","sportmonks_football_get_extended_team_squad","sportmonks_football_get_fixture","sportmonks_football_get_fixtures_by_date","sportmonks_football_get_fixtures_by_date_range","sportmonks_football_get_fixtures_by_date_range_for_team","sportmonks_football_get_fixtures_by_ids","sportmonks_football_get_grouped_standings_by_round","sportmonks_football_get_head_to_head","sportmonks_football_get_inplay_livescores","sportmonks_football_get_latest_coaches","sportmonks_football_get_latest_fixtures","sportmonks_football_get_latest_livescores","sportmonks_football_get_latest_players","sportmonks_football_get_latest_totw","sportmonks_football_get_latest_transfers","sportmonks_football_get_league","sportmonks_football_get_leagues","sportmonks_football_get_leagues_by_country","sportmonks_football_get_leagues_by_date","sportmonks_football_get_leagues_by_team","sportmonks_football_get_live_leagues","sportmonks_football_get_live_probabilities","sportmonks_football_get_live_probabilities_by_fixture","sportmonks_football_get_live_standings_by_league","sportmonks_football_get_livescores","sportmonks_football_get_match_facts","sportmonks_football_get_match_facts_by_date_range","sportmonks_football_get_match_facts_by_fixture","sportmonks_football_get_match_facts_by_league","sportmonks_football_get_past_fixtures_by_tv_station","sportmonks_football_get_player","sportmonks_football_get_players_by_country","sportmonks_football_get_postmatch_news","sportmonks_football_get_postmatch_news_by_season","sportmonks_football_get_predictability_by_league","sportmonks_football_get_prematch_news","sportmonks_football_get_prematch_news_by_season","sportmonks_football_get_prematch_news_upcoming","sportmonks_football_get_probabilities","sportmonks_football_get_probabilities_by_fixture","sportmonks_football_get_referee","sportmonks_football_get_referees","sportmonks_football_get_referees_by_country","sportmonks_football_get_referees_by_season","sportmonks_football_get_rivals_by_team","sportmonks_football_get_round","sportmonks_football_get_round_statistics","sportmonks_football_get_rounds","sportmonks_football_get_rounds_by_season","sportmonks_football_get_schedules_by_season","sportmonks_football_get_schedules_by_season_and_team","sportmonks_football_get_schedules_by_team","sportmonks_football_get_season","sportmonks_football_get_seasons","sportmonks_football_get_seasons_by_team","sportmonks_football_get_stage","sportmonks_football_get_stage_statistics","sportmonks_football_get_stages","sportmonks_football_get_stages_by_season","sportmonks_football_get_standing_corrections_by_season","sportmonks_football_get_standings","sportmonks_football_get_standings_by_round","sportmonks_football_get_standings_by_season","sportmonks_football_get_state","sportmonks_football_get_states","sportmonks_football_get_team","sportmonks_football_get_team_rankings","sportmonks_football_get_team_rankings_by_date","sportmonks_football_get_team_rankings_by_team","sportmonks_football_get_team_squad","sportmonks_football_get_team_squad_by_season","sportmonks_football_get_teams_by_country","sportmonks_football_get_teams_by_season","sportmonks_football_get_topscorers_by_season","sportmonks_football_get_topscorers_by_stage","sportmonks_football_get_totw","sportmonks_football_get_totw_by_round","sportmonks_football_get_transfer","sportmonks_football_get_transfer_rumour","sportmonks_football_get_transfer_rumours_between_dates","sportmonks_football_get_transfer_rumours_by_player","sportmonks_football_get_transfer_rumours_by_team","sportmonks_football_get_transfers_between_dates","sportmonks_football_get_transfers_by_player","sportmonks_football_get_transfers_by_team","sportmonks_football_get_tv_station","sportmonks_football_get_tv_stations","sportmonks_football_get_tv_stations_by_fixture","sportmonks_football_get_upcoming_fixtures_by_market","sportmonks_football_get_upcoming_fixtures_by_tv_station","sportmonks_football_get_value_bets","sportmonks_football_get_value_bets_by_fixture","sportmonks_football_get_venue","sportmonks_football_get_venues","sportmonks_football_get_venues_by_season","sportmonks_football_search_coaches","sportmonks_football_search_fixtures","sportmonks_football_search_leagues","sportmonks_football_search_players","sportmonks_football_search_referees","sportmonks_football_search_rounds","sportmonks_football_search_seasons","sportmonks_football_search_stages","sportmonks_football_search_teams","sportmonks_football_search_venues","sportmonks_motorsport_get_all_fixtures","sportmonks_motorsport_get_current_leagues_by_team","sportmonks_motorsport_get_driver","sportmonks_motorsport_get_driver_standings","sportmonks_motorsport_get_driver_standings_by_season","sportmonks_motorsport_get_drivers","sportmonks_motorsport_get_drivers_by_country","sportmonks_motorsport_get_drivers_by_season","sportmonks_motorsport_get_fixture","sportmonks_motorsport_get_fixtures_by_date","sportmonks_motorsport_get_fixtures_by_date_range","sportmonks_motorsport_get_fixtures_by_ids","sportmonks_motorsport_get_laps_by_fixture","sportmonks_motorsport_get_laps_by_fixture_and_driver","sportmonks_motorsport_get_laps_by_fixture_and_lap","sportmonks_motorsport_get_latest_laps_by_fixture","sportmonks_motorsport_get_latest_pitstops_by_fixture","sportmonks_motorsport_get_latest_stints_by_fixture","sportmonks_motorsport_get_latest_updated_drivers","sportmonks_motorsport_get_latest_updated_fixtures","sportmonks_motorsport_get_league","sportmonks_motorsport_get_leagues","sportmonks_motorsport_get_leagues_by_country","sportmonks_motorsport_get_leagues_by_date","sportmonks_motorsport_get_leagues_by_live","sportmonks_motorsport_get_leagues_by_team","sportmonks_motorsport_get_livescores","sportmonks_motorsport_get_pitstops_by_fixture","sportmonks_motorsport_get_pitstops_by_fixture_and_driver","sportmonks_motorsport_get_pitstops_by_fixture_and_lap","sportmonks_motorsport_get_race_results_by_season_and_driver","sportmonks_motorsport_get_race_results_by_season_and_team","sportmonks_motorsport_get_schedules_by_season","sportmonks_motorsport_get_season","sportmonks_motorsport_get_seasons","sportmonks_motorsport_get_stage","sportmonks_motorsport_get_stages","sportmonks_motorsport_get_stages_by_season","sportmonks_motorsport_get_state","sportmonks_motorsport_get_states","sportmonks_motorsport_get_stints_by_fixture","sportmonks_motorsport_get_stints_by_fixture_and_driver","sportmonks_motorsport_get_stints_by_fixture_and_stint","sportmonks_motorsport_get_team","sportmonks_motorsport_get_team_standings","sportmonks_motorsport_get_team_standings_by_season","sportmonks_motorsport_get_teams","sportmonks_motorsport_get_teams_by_country","sportmonks_motorsport_get_teams_by_season","sportmonks_motorsport_get_venue","sportmonks_motorsport_get_venues","sportmonks_motorsport_get_venues_by_season","sportmonks_motorsport_search_drivers","sportmonks_motorsport_search_leagues","sportmonks_motorsport_search_stages","sportmonks_motorsport_search_teams","sportmonks_motorsport_search_venues","sportmonks_odds_get_all_historical_odds","sportmonks_odds_get_all_inplay_odds","sportmonks_odds_get_all_pre_match_odds","sportmonks_odds_get_all_premium_odds","sportmonks_odds_get_bookmaker","sportmonks_odds_get_bookmaker_event_ids_by_fixture","sportmonks_odds_get_bookmakers","sportmonks_odds_get_bookmakers_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture_and_bookmaker","sportmonks_odds_get_inplay_odds_by_fixture_and_market","sportmonks_odds_get_last_updated_inplay_odds","sportmonks_odds_get_last_updated_pre_match_odds","sportmonks_odds_get_market","sportmonks_odds_get_markets","sportmonks_odds_get_pre_match_odds_by_fixture","sportmonks_odds_get_pre_match_odds_by_fixture_and_bookmaker","sportmonks_odds_get_pre_match_odds_by_fixture_and_market","sportmonks_odds_get_premium_odds_by_fixture","sportmonks_odds_get_premium_odds_by_fixture_and_bookmaker","sportmonks_odds_get_premium_odds_by_fixture_and_market","sportmonks_odds_get_updated_historical_odds_between","sportmonks_odds_get_updated_premium_odds_between","sportmonks_odds_search_bookmakers","sportmonks_odds_search_markets","spotify_add_playlist_cover","spotify_add_to_queue","spotify_add_tracks_to_playlist","spotify_check_following","spotify_check_playlist_followers","spotify_check_saved_albums","spotify_check_saved_audiobooks","spotify_check_saved_episodes","spotify_check_saved_shows","spotify_check_saved_tracks","spotify_create_playlist","spotify_follow_artists","spotify_follow_playlist","spotify_get_album","spotify_get_album_tracks","spotify_get_albums","spotify_get_artist","spotify_get_artist_albums","spotify_get_artist_top_tracks","spotify_get_artists","spotify_get_audiobook","spotify_get_audiobook_chapters","spotify_get_audiobooks","spotify_get_categories","spotify_get_current_user","spotify_get_currently_playing","spotify_get_devices","spotify_get_episode","spotify_get_episodes","spotify_get_followed_artists","spotify_get_markets","spotify_get_new_releases","spotify_get_playback_state","spotify_get_playlist","spotify_get_playlist_cover","spotify_get_playlist_tracks","spotify_get_queue","spotify_get_recently_played","spotify_get_saved_albums","spotify_get_saved_audiobooks","spotify_get_saved_episodes","spotify_get_saved_shows","spotify_get_saved_tracks","spotify_get_show","spotify_get_show_episodes","spotify_get_shows","spotify_get_top_artists","spotify_get_top_tracks","spotify_get_track","spotify_get_tracks","spotify_get_user_playlists","spotify_get_user_profile","spotify_pause","spotify_play","spotify_remove_saved_albums","spotify_remove_saved_audiobooks","spotify_remove_saved_episodes","spotify_remove_saved_shows","spotify_remove_saved_tracks","spotify_remove_tracks_from_playlist","spotify_reorder_playlist_items","spotify_replace_playlist_items","spotify_save_albums","spotify_save_audiobooks","spotify_save_episodes","spotify_save_shows","spotify_save_tracks","spotify_search","spotify_seek","spotify_set_repeat","spotify_set_shuffle","spotify_set_volume","spotify_skip_next","spotify_skip_previous","spotify_transfer_playback","spotify_unfollow_artists","spotify_unfollow_playlist","spotify_update_playlist","sqs_cancel_message_move_task","sqs_change_message_visibility","sqs_change_message_visibility_batch","sqs_create_queue","sqs_delete_message","sqs_delete_message_batch","sqs_delete_queue","sqs_get_queue_attributes","sqs_get_queue_url","sqs_list_dead_letter_source_queues","sqs_list_message_move_tasks","sqs_list_queue_tags","sqs_list_queues","sqs_purge_queue","sqs_receive_message","sqs_send","sqs_send_message_batch","sqs_set_queue_attributes","sqs_start_message_move_task","sqs_tag_queue","sqs_untag_queue","square_batch_retrieve_inventory_counts","square_cancel_invoice","square_cancel_payment","square_complete_payment","square_create_catalog_image","square_create_customer","square_create_invoice","square_create_order","square_create_payment","square_delete_catalog_object","square_delete_customer","square_delete_invoice","square_get_catalog_object","square_get_customer","square_get_invoice","square_get_location","square_get_order","square_get_payment","square_get_refund","square_list_catalog","square_list_customers","square_list_invoices","square_list_locations","square_list_payments","square_list_refunds","square_pay_order","square_publish_invoice","square_refund_payment","square_search_catalog_objects","square_search_customers","square_search_invoices","square_search_orders","square_update_customer","square_upsert_catalog_object","ssh_check_command_exists","ssh_check_file_exists","ssh_create_directory","ssh_delete_file","ssh_download_file","ssh_download_file_v2","ssh_execute_command","ssh_execute_script","ssh_get_system_info","ssh_list_directory","ssh_move_rename","ssh_read_file_content","ssh_upload_file","ssh_write_file_content","ssm_cancel_command","ssm_delete_parameter","ssm_describe_automation_executions","ssm_describe_instance_information","ssm_describe_instance_patch_states","ssm_describe_instance_patches","ssm_describe_parameters","ssm_get_automation_execution","ssm_get_command_invocation","ssm_get_document","ssm_get_parameter","ssm_get_parameters","ssm_get_parameters_by_path","ssm_list_command_invocations","ssm_list_commands","ssm_list_compliance_items","ssm_list_compliance_summaries","ssm_list_documents","ssm_put_parameter","ssm_send_command","ssm_start_automation_execution","ssm_stop_automation_execution","stagehand_agent","stagehand_extract","stripe_cancel_payment_intent","stripe_cancel_subscription","stripe_capture_charge","stripe_capture_payment_intent","stripe_confirm_payment_intent","stripe_create_charge","stripe_create_customer","stripe_create_invoice","stripe_create_payment_intent","stripe_create_price","stripe_create_product","stripe_create_subscription","stripe_delete_customer","stripe_delete_invoice","stripe_delete_product","stripe_finalize_invoice","stripe_list_charges","stripe_list_customers","stripe_list_events","stripe_list_invoices","stripe_list_payment_intents","stripe_list_prices","stripe_list_products","stripe_list_subscriptions","stripe_pay_invoice","stripe_resume_subscription","stripe_retrieve_charge","stripe_retrieve_customer","stripe_retrieve_event","stripe_retrieve_invoice","stripe_retrieve_payment_intent","stripe_retrieve_price","stripe_retrieve_product","stripe_retrieve_subscription","stripe_search_charges","stripe_search_customers","stripe_search_invoices","stripe_search_payment_intents","stripe_search_prices","stripe_search_products","stripe_search_subscriptions","stripe_send_invoice","stripe_update_charge","stripe_update_customer","stripe_update_invoice","stripe_update_payment_intent","stripe_update_price","stripe_update_product","stripe_update_subscription","stripe_void_invoice","sts_assume_role","sts_assume_role_with_saml","sts_assume_role_with_web_identity","sts_get_access_key_info","sts_get_caller_identity","sts_get_session_token","stt_assemblyai","stt_assemblyai_v2","stt_deepgram","stt_deepgram_v2","stt_elevenlabs","stt_elevenlabs_v2","stt_gemini","stt_gemini_v2","stt_whisper","stt_whisper_v2","supabase_count","supabase_delete","supabase_get_row","supabase_insert","supabase_introspect","supabase_invoke_function","supabase_query","supabase_rpc","supabase_storage_copy","supabase_storage_create_bucket","supabase_storage_create_signed_upload_url","supabase_storage_create_signed_url","supabase_storage_delete","supabase_storage_delete_bucket","supabase_storage_download","supabase_storage_empty_bucket","supabase_storage_get_public_url","supabase_storage_list","supabase_storage_list_buckets","supabase_storage_move","supabase_storage_update_bucket","supabase_storage_upload","supabase_text_search","supabase_update","supabase_upsert","supabase_vector_search","table_batch_insert_rows","table_create","table_delete_row","table_delete_rows_by_filter","table_get_row","table_get_schema","table_insert_row","table_list","table_query_rows","table_query_rows_v2","table_update_row","table_update_rows_by_filter","table_upsert_row","tailscale_authorize_device","tailscale_create_auth_key","tailscale_delete_auth_key","tailscale_delete_device","tailscale_delete_user","tailscale_expire_device_key","tailscale_get_acl","tailscale_get_auth_key","tailscale_get_device","tailscale_get_device_routes","tailscale_get_dns_preferences","tailscale_get_dns_searchpaths","tailscale_list_auth_keys","tailscale_list_devices","tailscale_list_dns_nameservers","tailscale_list_users","tailscale_set_acl","tailscale_set_device_routes","tailscale_set_device_tags","tailscale_set_dns_nameservers","tailscale_set_dns_preferences","tailscale_set_dns_searchpaths","tailscale_suspend_user","tailscale_update_device_key","tavily_crawl","tavily_extract","tavily_map","tavily_search","telegram_copy_message","telegram_delete_message","telegram_edit_message_text","telegram_forward_message","telegram_get_chat","telegram_get_chat_member","telegram_message","telegram_pin_message","telegram_send_animation","telegram_send_audio","telegram_send_chat_action","telegram_send_contact","telegram_send_document","telegram_send_location","telegram_send_photo","telegram_send_poll","telegram_send_video","telegram_set_message_reaction","telegram_unpin_message","temporal_cancel_workflow","temporal_count_workflows","temporal_create_schedule","temporal_delete_schedule","temporal_describe_schedule","temporal_describe_task_queue","temporal_describe_workflow","temporal_get_workflow_history","temporal_list_schedules","temporal_list_workflows","temporal_pause_schedule","temporal_query_workflow","temporal_reset_workflow","temporal_signal_with_start","temporal_signal_workflow","temporal_start_workflow","temporal_terminate_workflow","temporal_trigger_schedule","temporal_unpause_schedule","temporal_update_workflow","textract_analyze_expense","textract_analyze_id","textract_parser","textract_parser_v2","thinking_tool","thrive_add_audience_managers","thrive_add_audience_members","thrive_add_user_tags","thrive_create_assignment","thrive_create_audience","thrive_create_completion","thrive_create_user","thrive_delete_assignment","thrive_delete_audience","thrive_delete_user","thrive_get_activity","thrive_get_assignment","thrive_get_audience","thrive_get_completion","thrive_get_content","thrive_get_cpd_category","thrive_get_cpd_entry","thrive_get_cpd_requirement","thrive_get_enrolment","thrive_get_skill_levels","thrive_get_tag","thrive_get_user_by_id","thrive_get_user_by_ref","thrive_list_assignments","thrive_list_audience_managers","thrive_list_audience_members","thrive_list_audiences","thrive_list_completions","thrive_list_enrolments","thrive_list_tags","thrive_query_activities","thrive_query_content","thrive_query_cpd_categories","thrive_query_cpd_entries","thrive_query_cpd_requirements","thrive_query_cpd_user_summaries","thrive_remove_audience_manager","thrive_remove_audience_member","thrive_remove_user_tags","thrive_replace_audience_managers","thrive_replace_audience_members","thrive_search_users","thrive_suspend_user","thrive_update_assignment","thrive_update_audience","thrive_update_user","thrive_update_user_skills","tiktok_get_post_status","tiktok_get_user","tiktok_list_videos","tiktok_query_videos","tiktok_upload_video_draft","tinybird_append_datasource","tinybird_delete_datasource_rows","tinybird_events","tinybird_get_job","tinybird_query","tinybird_query_pipe","tinybird_truncate_datasource","tinyfish_cancel_run","tinyfish_fetch","tinyfish_get_run","tinyfish_list_profiles","tinyfish_list_runs","tinyfish_list_vault_items","tinyfish_run","tinyfish_run_async","tinyfish_search","trello_add_checklist","trello_add_checklist_item","trello_add_comment","trello_add_label","trello_add_member","trello_create_board","trello_create_card","trello_create_list","trello_delete_card","trello_get_actions","trello_get_board","trello_get_card","trello_list_cards","trello_list_lists","trello_list_members","trello_remove_label","trello_remove_member","trello_search","trello_update_card","trello_update_checklist_item","trello_update_list","trigger_dev_activate_schedule","trigger_dev_add_run_tags","trigger_dev_batch_trigger_task","trigger_dev_cancel_run","trigger_dev_complete_waitpoint_token","trigger_dev_create_env_var","trigger_dev_create_schedule","trigger_dev_create_waitpoint_token","trigger_dev_deactivate_schedule","trigger_dev_delete_env_var","trigger_dev_delete_schedule","trigger_dev_execute_query","trigger_dev_get_batch","trigger_dev_get_batch_results","trigger_dev_get_deployment","trigger_dev_get_env_var","trigger_dev_get_latest_deployment","trigger_dev_get_query_schema","trigger_dev_get_queue","trigger_dev_get_run","trigger_dev_get_run_events","trigger_dev_get_run_result","trigger_dev_get_run_trace","trigger_dev_get_schedule","trigger_dev_get_waitpoint_token","trigger_dev_import_env_vars","trigger_dev_list_deployments","trigger_dev_list_env_vars","trigger_dev_list_queues","trigger_dev_list_runs","trigger_dev_list_schedules","trigger_dev_list_timezones","trigger_dev_list_waitpoint_tokens","trigger_dev_override_queue_concurrency","trigger_dev_pause_queue","trigger_dev_promote_deployment","trigger_dev_replay_run","trigger_dev_reschedule_run","trigger_dev_reset_queue_concurrency","trigger_dev_resume_queue","trigger_dev_trigger_task","trigger_dev_update_env_var","trigger_dev_update_run_metadata","trigger_dev_update_schedule","tts_azure","tts_cartesia","tts_deepgram","tts_elevenlabs","tts_google","tts_openai","tts_playht","twilio_send_sms","twilio_voice_get_recording","twilio_voice_list_calls","twilio_voice_make_call","typeform_create_form","typeform_delete_form","typeform_files","typeform_get_form","typeform_insights","typeform_list_forms","typeform_responses","typeform_update_form","upstash_redis_command","upstash_redis_delete","upstash_redis_exists","upstash_redis_expire","upstash_redis_get","upstash_redis_hget","upstash_redis_hgetall","upstash_redis_hset","upstash_redis_incr","upstash_redis_incrby","upstash_redis_keys","upstash_redis_lpush","upstash_redis_lrange","upstash_redis_set","upstash_redis_setnx","upstash_redis_ttl","uptimerobot_create_alert_contact","uptimerobot_create_maintenance_window","uptimerobot_create_monitor","uptimerobot_create_psp","uptimerobot_delete_alert_contact","uptimerobot_delete_maintenance_window","uptimerobot_delete_monitor","uptimerobot_delete_psp","uptimerobot_get_account","uptimerobot_get_alert_contact","uptimerobot_get_incident","uptimerobot_get_maintenance_window","uptimerobot_get_monitor","uptimerobot_get_psp","uptimerobot_list_alert_contacts","uptimerobot_list_incidents","uptimerobot_list_maintenance_windows","uptimerobot_list_monitors","uptimerobot_list_psps","uptimerobot_pause_monitor","uptimerobot_start_monitor","uptimerobot_update_maintenance_window","uptimerobot_update_monitor","uptimerobot_update_psp","vanta_download_document_file","vanta_get_control","vanta_get_document","vanta_get_framework","vanta_get_person","vanta_get_policy","vanta_get_risk_scenario","vanta_get_test","vanta_get_vendor","vanta_get_vulnerable_asset","vanta_list_control_documents","vanta_list_control_tests","vanta_list_controls","vanta_list_document_uploads","vanta_list_documents","vanta_list_framework_controls","vanta_list_frameworks","vanta_list_monitored_computers","vanta_list_people","vanta_list_policies","vanta_list_risk_scenarios","vanta_list_test_entities","vanta_list_tests","vanta_list_vendors","vanta_list_vulnerabilities","vanta_list_vulnerability_remediations","vanta_list_vulnerable_assets","vanta_submit_document","vanta_upload_document_file","vercel_add_domain","vercel_add_project_domain","vercel_cancel_deployment","vercel_create_alias","vercel_create_check","vercel_create_deployment","vercel_create_dns_record","vercel_create_edge_config","vercel_create_env_var","vercel_create_project","vercel_create_webhook","vercel_delete_alias","vercel_delete_deployment","vercel_delete_dns_record","vercel_delete_domain","vercel_delete_edge_config","vercel_delete_env_var","vercel_delete_project","vercel_delete_webhook","vercel_get_alias","vercel_get_check","vercel_get_deployment","vercel_get_deployment_events","vercel_get_domain","vercel_get_domain_config","vercel_get_edge_config","vercel_get_edge_config_items","vercel_get_env_vars","vercel_get_project","vercel_get_team","vercel_get_user","vercel_get_webhook","vercel_list_aliases","vercel_list_checks","vercel_list_deployment_files","vercel_list_deployments","vercel_list_dns_records","vercel_list_domains","vercel_list_edge_configs","vercel_list_project_domains","vercel_list_projects","vercel_list_team_members","vercel_list_teams","vercel_list_webhooks","vercel_pause_project","vercel_promote_deployment","vercel_remove_project_domain","vercel_rerequest_check","vercel_unpause_project","vercel_update_check","vercel_update_dns_record","vercel_update_edge_config_items","vercel_update_env_var","vercel_update_project","vercel_update_project_domain","vercel_verify_project_domain","video_falai","video_luma","video_minimax","video_runway","video_veo","vision_tool","vision_tool_v2","wealthbox_read_contact","wealthbox_read_note","wealthbox_read_task","wealthbox_write_contact","wealthbox_write_note","wealthbox_write_task","webflow_create_item","webflow_delete_item","webflow_get_item","webflow_list_items","webflow_update_item","webhook_request","whatsapp_get_media","whatsapp_mark_read","whatsapp_send_interactive","whatsapp_send_media","whatsapp_send_message","whatsapp_send_reaction","whatsapp_send_template","whatsapp_upload_media","wikipedia_content","wikipedia_random","wikipedia_search","wikipedia_summary","windchill_check_in_document","windchill_check_in_documents","windchill_check_out_document","windchill_check_out_documents","windchill_create_document","windchill_create_documents","windchill_delete_document","windchill_delete_documents","windchill_download_attachment","windchill_download_primary_content","windchill_get_document","windchill_get_document_structure","windchill_get_primary_content","windchill_get_valid_state_transitions","windchill_list_attachments","windchill_list_documents","windchill_revise_document","windchill_revise_documents","windchill_set_lifecycle_state","windchill_undo_check_out_document","windchill_undo_check_out_documents","windchill_update_common_properties","windchill_update_document","windchill_update_document_security_labels","windchill_update_documents","windchill_upload_attachments","windchill_upload_primary_content","wiza_company_enrichment","wiza_get_credits","wiza_individual_reveal","wiza_prospect_search","wordpress_create_category","wordpress_create_comment","wordpress_create_page","wordpress_create_post","wordpress_create_tag","wordpress_delete_category","wordpress_delete_comment","wordpress_delete_media","wordpress_delete_page","wordpress_delete_post","wordpress_delete_tag","wordpress_get_category","wordpress_get_current_user","wordpress_get_media","wordpress_get_page","wordpress_get_post","wordpress_get_tag","wordpress_get_user","wordpress_list_categories","wordpress_list_comments","wordpress_list_media","wordpress_list_pages","wordpress_list_posts","wordpress_list_tags","wordpress_list_users","wordpress_search_content","wordpress_update_category","wordpress_update_comment","wordpress_update_page","wordpress_update_post","wordpress_update_tag","wordpress_upload_media","workday_assign_onboarding","workday_change_job","workday_create_prehire","workday_get_compensation","workday_get_organizations","workday_get_worker","workday_hire_employee","workday_list_workers","workday_terminate_worker","workday_update_worker","workflow_executor","x_create_bookmark","x_create_tweet","x_delete_bookmark","x_delete_tweet","x_get_blocking","x_get_bookmarks","x_get_followers","x_get_following","x_get_liked_tweets","x_get_liking_users","x_get_me","x_get_personalized_trends","x_get_quote_tweets","x_get_retweeted_by","x_get_trends_by_woeid","x_get_tweets_by_ids","x_get_usage","x_get_user_mentions","x_get_user_timeline","x_get_user_tweets","x_hide_reply","x_manage_block","x_manage_follow","x_manage_like","x_manage_mute","x_manage_retweet","x_read","x_search","x_search_tweets","x_search_users","x_user","x_write","youcom_answer","youcom_finance_research","youcom_get_account_balance","youcom_get_contents","youcom_get_research_task","youcom_research","youcom_search","youcom_search_images","youtube_channel_info","youtube_channel_playlists","youtube_channel_videos","youtube_comments","youtube_playlist_items","youtube_search","youtube_trending","youtube_video_categories","youtube_video_details","zendesk_autocomplete_organizations","zendesk_create_organization","zendesk_create_organizations_bulk","zendesk_create_ticket","zendesk_create_tickets_bulk","zendesk_create_user","zendesk_create_users_bulk","zendesk_delete_organization","zendesk_delete_ticket","zendesk_delete_user","zendesk_get_current_user","zendesk_get_organization","zendesk_get_organizations","zendesk_get_ticket","zendesk_get_tickets","zendesk_get_user","zendesk_get_users","zendesk_merge_tickets","zendesk_search","zendesk_search_count","zendesk_search_users","zendesk_update_organization","zendesk_update_ticket","zendesk_update_tickets_bulk","zendesk_update_user","zendesk_update_users_bulk","zep_add_messages","zep_add_user","zep_create_thread","zep_delete_thread","zep_get_context","zep_get_messages","zep_get_threads","zep_get_user","zep_get_user_threads","zerobounce_get_credits","zerobounce_verify_email","zoho_desk_add_comment","zoho_desk_create_account","zoho_desk_create_contact","zoho_desk_create_ticket","zoho_desk_delete_comment","zoho_desk_get_account","zoho_desk_get_agent","zoho_desk_get_attachment","zoho_desk_get_comment","zoho_desk_get_contact","zoho_desk_get_department","zoho_desk_get_thread","zoho_desk_get_ticket","zoho_desk_list_accounts","zoho_desk_list_agents","zoho_desk_list_comments","zoho_desk_list_contacts","zoho_desk_list_departments","zoho_desk_list_organizations","zoho_desk_list_threads","zoho_desk_list_tickets","zoho_desk_move_ticket","zoho_desk_search_accounts","zoho_desk_search_contacts","zoho_desk_search_tickets","zoho_desk_send_reply","zoho_desk_update_account","zoho_desk_update_comment","zoho_desk_update_contact","zoho_desk_update_ticket","zoom_create_meeting","zoom_delete_meeting","zoom_delete_recording","zoom_get_meeting","zoom_get_meeting_invitation","zoom_get_meeting_recordings","zoom_list_meetings","zoom_list_past_participants","zoom_list_recordings","zoom_update_meeting","zoominfo_enrich_companies","zoominfo_enrich_contacts","zoominfo_search_companies","zoominfo_search_contacts","zoominfo_search_intent","zoominfo_search_news"]' ) export default toolIds diff --git a/apps/sim/tools/generated/tool-metadata.ts b/apps/sim/tools/generated/tool-metadata.ts index ded6c71f003..10a1ab3effd 100644 --- a/apps/sim/tools/generated/tool-metadata.ts +++ b/apps/sim/tools/generated/tool-metadata.ts @@ -3,7 +3,7 @@ /** Serializable metadata for every built-in tool, keyed by tool id. */ const toolMetadata: Record = JSON.parse( - '{"a2a_cancel_task":{"id":"a2a_cancel_task","name":"A2A Cancel Task","description":"Request cancellation of an in-progress A2A task.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The task ID to cancel"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_get_agent_card":{"id":"a2a_get_agent_card","name":"A2A Get Agent Card","description":"Fetch the Agent Card (discovery document) for an external A2A agent.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_get_task":{"id":"a2a_get_task","name":"A2A Get Task","description":"Retrieve the current state and result of an A2A task.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The task ID to retrieve"},"historyLength":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of history messages to include"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_send_message":{"id":"a2a_send_message","name":"A2A Send Message","description":"Send a message to an external A2A agent and return its response.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"message":{"type":"string","required":true,"visibility":"user-or-llm","description":"The message text to send"},"data":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional structured JSON data to attach"},"files":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional files to attach"},"taskId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Existing task ID to continue"},"contextId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Conversation context ID to continue"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"affinity_batch_update_entity_fields":{"id":"affinity_batch_update_entity_fields","name":"Affinity Batch Update Entity Fields","description":"Write up to 100 non-list field values on one company or person in a single request.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to write the fields on: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"updates":{"type":"json","required":true,"visibility":"user-or-llm","description":"Up to 100 field updates as [{\\"id\\":\\"\\",\\"value\\":{\\"type\\":\\"…\\",\\"data\\":…}}], using the same value shapes as a single field update"}},"hostedApiKey":"none"},"affinity_batch_update_list_entry_fields":{"id":"affinity_batch_update_list_entry_fields","name":"Affinity Batch Update List Entry Fields","description":"Write up to 100 field values on one list row in a single request. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"updates":{"type":"json","required":true,"visibility":"user-or-llm","description":"Up to 100 field updates as [{\\"id\\":\\"\\",\\"value\\":{\\"type\\":\\"…\\",\\"data\\":…}}], using the same value shapes as a single field update"}},"hostedApiKey":"none"},"affinity_create_list":{"id":"affinity_create_list","name":"Affinity Create List","description":"Create a list. Its type fixes which entities it can hold, and the API key holder becomes its creator and owner.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the new list"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Entity kind the list holds: company, opportunity, or person"},"isPublic":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether everyone in the organization can see the list"}},"hostedApiKey":"none"},"affinity_create_list_field_dropdown_option":{"id":"affinity_create_list_field_dropdown_option","name":"Affinity Create List Field Dropdown Option","description":"Add a selectable option to a dropdown field on a list. A ranked or status option also needs a rank and a color.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Kind of option to create, matching the field. dropdown takes only a label; ranked-dropdown also requires rank and color; status-dropdown additionally requires a status category. Sending a field the kind does not accept is rejected"},"text":{"type":"string","required":true,"visibility":"user-or-llm","description":"The option label"},"rank":{"type":"number","required":false,"visibility":"user-or-llm","description":"Sort order. Required on a ranked-dropdown or status-dropdown option"},"color":{"type":"string","required":false,"visibility":"user-or-llm","description":"Option color: white, gray, blue, green, purple, orange, or red. Required on a ranked-dropdown or status-dropdown option"},"statusCategory":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pipeline meaning of the option: open, won, lost, or on-hold. Status-dropdown options only"},"winRate":{"type":"number","required":false,"visibility":"user-or-llm","description":"Expected win rate of the status. Status-dropdown options only"}},"hostedApiKey":"none"},"affinity_create_merge":{"id":"affinity_create_merge","name":"Affinity Create Merge","description":"Fold a duplicate company or person into the record you are keeping. The merge runs asynchronously — poll the returned task to see it finish. Requires the \\"Manage duplicates\\" permission and an admin role.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to merge: companies or persons"},"primaryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to keep"},"duplicateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the duplicate record to fold in"}},"hostedApiKey":"none"},"affinity_create_note":{"id":"affinity_create_note","name":"Affinity Create Note","description":"Write a note — attached to companies, persons, and opportunities, anchored to a meeting, call, or chat message, or posted as a reply to an existing note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Note shape: entities to attach it to records, interaction to anchor it to a meeting, call, or chat message, or user-reply to reply to a note"},"html":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note body as HTML"},"companyIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Companies to attach the note to, e.g. [1, 2]. Not used on a reply"},"personIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Persons to attach the note to, e.g. [1, 2]. Not used on a reply"},"opportunityIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Opportunities to attach the note to, e.g. [1, 2]. Not used on a reply"},"interactionId":{"type":"string","required":false,"visibility":"user-or-llm","description":"The interaction to anchor the note to. Required for an interaction note"},"interactionType":{"type":"string","required":false,"visibility":"user-or-llm","description":"Kind of the anchoring interaction: meeting, call, or chat-message. Required for an interaction note"},"parentId":{"type":"string","required":false,"visibility":"user-or-llm","description":"The note being replied to. Required for a user-reply note"},"creatorId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Attribute the note to another internal person. Defaults to the API key holder"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"Backdate the note to this ISO 8601 timestamp"}},"hostedApiKey":"none"},"affinity_create_reminder":{"id":"affinity_create_reminder","name":"Affinity Create Reminder","description":"Create a reminder on one company, person, or opportunity. A recurring reminder resets whenever the chosen signal happens instead of firing once.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"one-time to fire once, or recurring to reset on a signal"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"What the reminder is about: company, person, or opportunity"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company, person, or opportunity"},"dueDate":{"type":"string","required":false,"visibility":"user-or-llm","description":"When the reminder is due, as an ISO 8601 timestamp. Required for a one-time reminder; on a recurring one Affinity computes it from the period when omitted"},"content":{"type":"string","required":false,"visibility":"user-or-llm","description":"What the reminder says"},"ownerId":{"type":"string","required":true,"visibility":"user-or-llm","description":"User the reminder is assigned to. Must be an internal user. The API key holder is recorded as the creator, which is a separate field"},"resetTrigger":{"type":"string","required":false,"visibility":"user-or-llm","description":"What restarts a recurring reminder: interaction, email, or event. Required when the type is recurring"},"periodDays":{"type":"number","required":false,"visibility":"user-or-llm","description":"Days between firings of a recurring reminder. Required when the type is recurring"}},"hostedApiKey":"none"},"affinity_delete_list_field_dropdown_option":{"id":"affinity_delete_list_field_dropdown_option","name":"Affinity Delete List Field Dropdown Option","description":"Permanently delete a dropdown option on a list field. Every list entry currently set to it is cleared, and those values cannot be recovered.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID to delete"}},"hostedApiKey":"none"},"affinity_delete_note":{"id":"affinity_delete_note","name":"Affinity Delete Note","description":"Delete a note you created. Deleting a root note also deletes its replies; deleting a reply removes only that reply.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID to delete"}},"hostedApiKey":"none"},"affinity_get_company":{"id":"affinity_get_company","name":"Affinity Get Company","description":"Look up one company by ID. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"companyId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The company ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"}},"hostedApiKey":"none"},"affinity_get_current_user":{"id":"affinity_get_current_user","name":"Affinity Get Current User","description":"Verify an Affinity API key and return the tenant, the user behind the key, and the scopes the grant carries.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"}},"hostedApiKey":"none"},"affinity_get_entity_field_value":{"id":"affinity_get_entity_field_value","name":"Affinity Get Entity Field Value","description":"Read one non-list field value from a company or person.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to read the field from: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to read"}},"hostedApiKey":"none"},"affinity_get_list":{"id":"affinity_get_list","name":"Affinity Get List","description":"Read one list — its name, type, owner, and privacy setting.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"}},"hostedApiKey":"none"},"affinity_get_list_entry":{"id":"affinity_get_list_entry","name":"Affinity Get List Entry","description":"Read one row of a list with its entity. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"}},"hostedApiKey":"none"},"affinity_get_list_entry_field":{"id":"affinity_get_list_entry_field","name":"Affinity Get List Entry Field","description":"Read one field value on a list row.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to read"}},"hostedApiKey":"none"},"affinity_get_list_field_dropdown_option":{"id":"affinity_get_list_field_dropdown_option","name":"Affinity Get List Field Dropdown Option","description":"Read one dropdown option on a list field.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID"}},"hostedApiKey":"none"},"affinity_get_merge":{"id":"affinity_get_merge","name":"Affinity Get Merge","description":"Read the status of one company or person merge, including why it failed if it did.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge to read: companies or persons"},"mergeId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The merge ID"}},"hostedApiKey":"none"},"affinity_get_merge_task":{"id":"affinity_get_merge_task","name":"Affinity Get Merge Task","description":"Read one merge task and how its merges are progressing. Poll this after starting a merge.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge task to read: companies or persons"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The merge task ID"}},"hostedApiKey":"none"},"affinity_get_note":{"id":"affinity_get_note","name":"Affinity Get Note","description":"Read one note with its body, author, mentions, and attached records.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return, e.g. [\\"repliesCount\\",\\"personsPreview\\",\\"companiesPreview\\",\\"opportunitiesPreview\\"]. Those four fields are omitted unless requested here"}},"hostedApiKey":"none"},"affinity_get_opportunity":{"id":"affinity_get_opportunity","name":"Affinity Get Opportunity","description":"Read one opportunity and the list it belongs to. Its field data lives on the list entry.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"opportunityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The opportunity ID"}},"hostedApiKey":"none"},"affinity_get_person":{"id":"affinity_get_person","name":"Affinity Get Person","description":"Look up one person by ID. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"personId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The person ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"}},"hostedApiKey":"none"},"affinity_get_saved_view":{"id":"affinity_get_saved_view","name":"Affinity Get Saved View","description":"Read one saved view — its name, kind, and creation date.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"viewId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The saved view ID"}},"hostedApiKey":"none"},"affinity_get_transcript":{"id":"affinity_get_transcript","name":"Affinity Get Transcript","description":"Read one transcript with its first 100 fragments. Page the fragments endpoint for a longer meeting.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"transcriptId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The transcript ID"}},"hostedApiKey":"none"},"affinity_get_user":{"id":"affinity_get_user","name":"Affinity Get User","description":"Read one internal user. A user and their person record share the same numeric ID, so a person ID works here.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"userId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The user ID, which is also their person ID"}},"hostedApiKey":"none"},"affinity_list_calls":{"id":"affinity_list_calls","name":"Affinity List Calls","description":"Page through logged calls and their participants. Only calls the API key holder can see are returned.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_chat_messages":{"id":"affinity_list_chat_messages","name":"Affinity List Chat Messages","description":"Page through logged chat messages and their participants. Only messages the API key holder can see are returned.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_companies":{"id":"affinity_list_companies","name":"Affinity List Companies","description":"Page through companies. Companies come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these company IDs, e.g. [1, 2, 3]"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_coworker_connections":{"id":"affinity_list_coworker_connections","name":"Affinity List Coworker Connections","description":"Find warm paths into a company through shared work history: who in your Affinity data once worked alongside the people you want to reach. Grouped by target, strongest first.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":true,"visibility":"user-or-llm","description":"Required scope. The only supported filter is target.currentCompany.id, e.g. \\"target.currentCompany.id=123\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of targets to return per page, 1-50. Defaults to 20"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_emails":{"id":"affinity_list_emails","name":"Affinity List Emails","description":"Page through email metadata — subject, participants, and timestamps. Affinity never exposes email bodies through the API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_entity_field_values":{"id":"affinity_list_entity_field_values","name":"Affinity List Entity Field Values","description":"Page through a company\'s or person\'s non-list field values. List fields are not returned here — read those through the list entry.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to read field values from: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field IDs. Mutually exclusive with Field Types"},"types":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field categories: enriched, global, relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_list_entity_list_entries":{"id":"affinity_list_entity_list_entries","name":"Affinity List Entity List Entries","description":"Page through a company\'s or person\'s rows across every list, each carrying that list\'s field values and when the entity was added.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up the rows of: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_entity_lists":{"id":"affinity_list_entity_lists","name":"Affinity List Entity Lists","description":"List every list a company or person appears on that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up the lists of: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_entity_notes":{"id":"affinity_list_entity_notes","name":"Affinity List Entity Notes","description":"List the notes relevant to one company, person, or opportunity — directly attached notes plus notes reaching it through its people and meetings.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity the notes hang off: companies, persons, or opportunities"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company, person, or opportunity"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_entity_relationships":{"id":"affinity_list_entity_relationships","name":"Affinity List Entity Relationships","description":"List who knows a company or person, scored 0.0 to 1.0 by how much the two actually interact. Strongest first by default.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up relationships for: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on interactionScore only, e.g. \\"interactionScore>=0.5\\""},"orderBy":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order: [\\"interactionScore\\"] for weakest first, [\\"-interactionScore\\"] for strongest first (the default)"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_field_dropdown_options":{"id":"affinity_list_field_dropdown_options","name":"Affinity List Field Dropdown Options","description":"List the selectable options on a dropdown or ranked-dropdown company or person field. Writing such a field needs the option ID, not its text.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which field family the field belongs to: companies or persons"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown or ranked-dropdown field ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_field_metadata":{"id":"affinity_list_field_metadata","name":"Affinity List Field Metadata","description":"List the non-list company or person fields, with the value type, filter operators, and sort support of each. Start here to find the Field IDs the read and write tools take.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which fields to describe: companies or persons"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return: [\\"filterability\\",\\"sortability\\"]. Both are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on name only, e.g. \\"name=~Status\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_field_value_changes":{"id":"affinity_list_field_value_changes","name":"Affinity List Field Value Changes","description":"Page through field value changes across the whole workspace. Built for delta sync: follow nextCursor to the end of a run, then resume from the last cursor next time.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over field.id, listEntry.id, changer.id, changedAt, or actionType. Resume a sync with e.g. \\"changedAt>2026-06-01T12:00:00Z\\""},"orderBy":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order: [\\"changedAt\\"] for oldest first (the default), [\\"-changedAt\\"] for newest first"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_investor_executive_connections":{"id":"affinity_list_investor_executive_connections","name":"Affinity List Investor Executive Connections","description":"Find warm paths into a company through investment history: which investors in your Affinity data backed a company the people you want to reach once led. Grouped by target, strongest first.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":true,"visibility":"user-or-llm","description":"Required scope. The only supported filter is target.currentCompany.id, e.g. \\"target.currentCompany.id=123\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of targets to return per page, 1-50. Defaults to 20"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_list_entries":{"id":"affinity_list_list_entries","name":"Affinity List List Entries","description":"Page through the rows of a list. Rows come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_list_entry_field_value_changes":{"id":"affinity_list_list_entry_field_value_changes","name":"Affinity List List Entry Field Value Changes","description":"Page through the history of one list row — who changed which field, when, and to what.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over field.id, changer.id, changedAt, or actionType, e.g. \\"field.id=field-1234\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_list_entry_fields":{"id":"affinity_list_list_entry_fields","name":"Affinity List List Entry Fields","description":"Page through every field value on one list row, including the list-specific columns. All fields are returned unless narrowed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field IDs. Mutually exclusive with Field Types"},"types":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field categories: enriched, global, list, relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_list_list_field_dropdown_options":{"id":"affinity_list_list_field_dropdown_options","name":"Affinity List List Field Dropdown Options","description":"List the selectable options on a dropdown, ranked-dropdown, or status-dropdown field of a list.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_list_fields":{"id":"affinity_list_list_fields","name":"Affinity List List Fields","description":"List the fields available on one list, including its list-specific columns. Use these Field IDs when reading or writing list entries.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return: [\\"filterability\\",\\"sortability\\"]. Both are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on name only, e.g. \\"name=~Stage\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_lists":{"id":"affinity_list_lists","name":"Affinity List Lists","description":"Page through the lists in the organization that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"term":{"type":"string","required":false,"visibility":"user-or-llm","description":"Case-insensitive substring match on the list name"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_meetings":{"id":"affinity_list_meetings","name":"Affinity List Meetings","description":"Page through past and upcoming meetings with their organizer and attendees.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_merge_tasks":{"id":"affinity_list_merge_tasks","name":"Affinity List Merge Tasks","description":"Page through merge tasks, each summarizing how many of its merges are in progress, succeeded, or failed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge tasks to list: companies or persons"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on status only, e.g. \\"status=in-progress\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_merges":{"id":"affinity_list_merges","name":"Affinity List Merges","description":"Page through the company or person merges the organization has run, with the status and the records involved in each.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merges to list: companies or persons"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over status or taskId, e.g. \\"status=failed\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_note_attached_companies":{"id":"affinity_list_note_attached_companies","name":"Affinity List Note Attached Companies","description":"List the companies directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_note_attached_opportunities":{"id":"affinity_list_note_attached_opportunities","name":"Affinity List Note Attached Opportunities","description":"List the opportunities directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_note_attached_persons":{"id":"affinity_list_note_attached_persons","name":"Affinity List Note Attached Persons","description":"List the persons directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_note_replies":{"id":"affinity_list_note_replies","name":"Affinity List Note Replies","description":"Page through the replies on one note, including AI Notetaker replies.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID whose replies to read"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_notes":{"id":"affinity_list_notes","name":"Affinity List Notes","description":"Page through every note the caller can see. Replies are excluded.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return, e.g. [\\"repliesCount\\",\\"personsPreview\\",\\"companiesPreview\\",\\"opportunitiesPreview\\"]. Those four fields are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_opportunities":{"id":"affinity_list_opportunities","name":"Affinity List Opportunities","description":"Page through opportunities. Field data lives on the list entry, not here — read it through the list or saved view the opportunity belongs to.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these opportunity IDs, e.g. [1, 2, 3]"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_persons":{"id":"affinity_list_persons","name":"Affinity List Persons","description":"Page through persons. Persons come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these person IDs, e.g. [1, 2, 3]"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_reminders":{"id":"affinity_list_reminders","name":"Affinity List Reminders","description":"Page through the reminders the caller can see. Filter by status to surface what is overdue.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_saved_view_entries":{"id":"affinity_list_saved_view_entries","name":"Affinity List Saved View Entries","description":"Page through the rows of a saved view. The view\'s own filters and columns decide which rows and which field data come back.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"viewId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The saved view ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_saved_views":{"id":"affinity_list_saved_views","name":"Affinity List Saved Views","description":"List the saved views on a list that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_transcript_fragments":{"id":"affinity_list_transcript_fragments","name":"Affinity List Transcript Fragments","description":"Page through everything said in a meeting, segment by segment with the speaker.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"transcriptId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The transcript ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_transcripts":{"id":"affinity_list_transcripts","name":"Affinity List Transcripts","description":"Page through meeting transcript metadata. Read one transcript to get what was actually said.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_users":{"id":"affinity_list_users","name":"Affinity List Users","description":"Page through the internal users in the organization. Email addresses and roles are returned only to callers with the \\"Manage Users\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"term":{"type":"string","required":false,"visibility":"user-or-llm","description":"Case-insensitive match across first name, last name, and primary email"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over id or status, e.g. \\"status=active\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_search_companies":{"id":"affinity_search_companies","name":"Affinity Search Companies","description":"Search companies by filters, sorts, and a free-text term. Requires the \\"Export All Organizations directory\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_search_files":{"id":"affinity_search_files","name":"Affinity Search Files","description":"Search files by keyword, ordered by relevance. Narrow to specific files or to one company, or leave both unset to search the whole account.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to search for. Between 3 and 500 characters"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to these file IDs. Cannot be combined with Company ID"},"companyId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Restrict the search to one company\'s files. Cannot be combined with file IDs"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of files to return, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_search_list_entries":{"id":"affinity_search_list_entries","name":"Affinity Search List Entries","description":"Search the rows of one list by filters, sorts, and a free-text term. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID to search"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_search_notes":{"id":"affinity_search_notes","name":"Affinity Search Notes","description":"Search notes by keyword, ordered by relevance. Narrow to specific notes or to one company, or leave both unset to search the whole account.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to search for. Between 3 and 500 characters"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to these note IDs. Cannot be combined with Company ID"},"companyId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Restrict the search to one company\'s notes. Cannot be combined with note IDs"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of notes to return, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_search_persons":{"id":"affinity_search_persons","name":"Affinity Search Persons","description":"Search persons by filters, sorts, and a free-text term. Requires the \\"Export All People directory\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_semantic_search":{"id":"affinity_semantic_search","name":"Affinity Semantic Search","description":"Find companies from a description in plain language — industry, technology, stage, or business model. Currently searches companies only.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to look for, in plain language, e.g. \\"climate tech companies in our pipeline\\". Up to 500 characters"},"listIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to companies on these lists, e.g. [1, 2]"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of companies to return, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_update_entity_field_value":{"id":"affinity_update_entity_field_value","name":"Affinity Update Entity Field Value","description":"Write one non-list field value on a company or person. The value type must match how the field is defined.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to write the field on: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to write"},"value":{"type":"json","required":true,"visibility":"user-or-llm","description":"The new value as {type, data}, where type matches the field\'s value type. Examples: {\\"type\\":\\"text\\",\\"data\\":\\"Series B\\"}, {\\"type\\":\\"number\\",\\"data\\":42}, {\\"type\\":\\"dropdown\\",\\"data\\":{\\"dropdownOptionId\\":7}}, {\\"type\\":\\"person\\",\\"data\\":{\\"id\\":123}}, {\\"type\\":\\"person-multi\\",\\"data\\":[{\\"id\\":123}]}. Pass data as null to clear the field"}},"hostedApiKey":"none"},"affinity_update_list_entry_field":{"id":"affinity_update_list_entry_field","name":"Affinity Update List Entry Field","description":"Write one field value on a list row. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to write"},"value":{"type":"json","required":true,"visibility":"user-or-llm","description":"The new value as {type, data}, where type matches the field\'s value type. Examples: {\\"type\\":\\"text\\",\\"data\\":\\"Series B\\"}, {\\"type\\":\\"number\\",\\"data\\":42}, {\\"type\\":\\"dropdown\\",\\"data\\":{\\"dropdownOptionId\\":7}}, {\\"type\\":\\"person\\",\\"data\\":{\\"id\\":123}}, {\\"type\\":\\"person-multi\\",\\"data\\":[{\\"id\\":123}]}. Pass data as null to clear the field"}},"hostedApiKey":"none"},"affinity_update_list_field_dropdown_option":{"id":"affinity_update_list_field_dropdown_option","name":"Affinity Update List Field Dropdown Option","description":"Change a dropdown option on a list field. Every field is optional — supply only what should change, and only fields the option\'s kind actually has.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID to update"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Replacement option label. Supply at least one field to change"},"rank":{"type":"number","required":false,"visibility":"user-or-llm","description":"Sort order. Required on a ranked-dropdown or status-dropdown option"},"color":{"type":"string","required":false,"visibility":"user-or-llm","description":"Option color: white, gray, blue, green, purple, orange, or red. Required on a ranked-dropdown or status-dropdown option"},"statusCategory":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pipeline meaning of the option: open, won, lost, or on-hold. Status-dropdown options only"},"winRate":{"type":"number","required":false,"visibility":"user-or-llm","description":"Expected win rate of the status. Status-dropdown options only"}},"hostedApiKey":"none"},"affinity_update_note":{"id":"affinity_update_note","name":"Affinity Update Note","description":"Rewrite a note\'s body or replace which records it is attached to. Each list of IDs replaces that association wholesale, an empty list clears it, and omitting one leaves it untouched. A note\'s type cannot be changed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID to update"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"Replacement note body as HTML"},"companyIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached companies, e.g. [1, 2]. Send [] to detach every company; omit to leave them unchanged"},"personIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached persons, e.g. [1, 2]. Send [] to detach every person; omit to leave them unchanged"},"opportunityIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached opportunities, e.g. [1, 2]. Send [] to detach every opportunity; omit to leave them unchanged"}},"hostedApiKey":"none"},"agentmail_create_draft":{"id":"agentmail_create_draft","name":"Create Draft","description":"Create a new email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to create the draft in"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Draft subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text draft body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML draft body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"},"inReplyTo":{"type":"string","required":false,"visibility":"user-or-llm","description":"ID of message being replied to"},"sendAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to schedule sending"}},"hostedApiKey":"none"},"agentmail_create_inbox":{"id":"agentmail_create_inbox","name":"Create Inbox","description":"Create a new email inbox with AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"username":{"type":"string","required":false,"visibility":"user-or-llm","description":"Username for the inbox email address"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Domain for the inbox email address"},"displayName":{"type":"string","required":false,"visibility":"user-or-llm","description":"Display name for the inbox"}},"hostedApiKey":"none"},"agentmail_delete_draft":{"id":"agentmail_delete_draft","name":"Delete Draft","description":"Delete an email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to delete"}},"hostedApiKey":"none"},"agentmail_delete_inbox":{"id":"agentmail_delete_inbox","name":"Delete Inbox","description":"Delete an email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to delete"}},"hostedApiKey":"none"},"agentmail_delete_thread":{"id":"agentmail_delete_thread","name":"Delete Thread","description":"Delete an email thread in AgentMail (moves to trash, or permanently deletes if already in trash)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to delete"},"permanent":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Force permanent deletion instead of moving to trash"}},"hostedApiKey":"none"},"agentmail_forward_message":{"id":"agentmail_forward_message","name":"Forward Message","description":"Forward an email message to new recipients in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to forward"},"to":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Override subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Additional plain text to prepend"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"Additional HTML to prepend"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"}},"hostedApiKey":"none"},"agentmail_get_draft":{"id":"agentmail_get_draft","name":"Get Draft","description":"Get details of a specific email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox the draft belongs to"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to retrieve"}},"hostedApiKey":"none"},"agentmail_get_inbox":{"id":"agentmail_get_inbox","name":"Get Inbox","description":"Get details of a specific email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to retrieve"}},"hostedApiKey":"none"},"agentmail_get_message":{"id":"agentmail_get_message","name":"Get Message","description":"Get details of a specific email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to retrieve"}},"hostedApiKey":"none"},"agentmail_get_thread":{"id":"agentmail_get_thread","name":"Get Thread","description":"Get details of a specific email thread including messages in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to retrieve"}},"hostedApiKey":"none"},"agentmail_list_drafts":{"id":"agentmail_list_drafts","name":"List Drafts","description":"List email drafts in an inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list drafts from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of drafts to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"hostedApiKey":"none"},"agentmail_list_inboxes":{"id":"agentmail_list_inboxes","name":"List Inboxes","description":"List all email inboxes in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of inboxes to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"hostedApiKey":"none"},"agentmail_list_messages":{"id":"agentmail_list_messages","name":"List Messages","description":"List messages in an inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list messages from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of messages to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"hostedApiKey":"none"},"agentmail_list_threads":{"id":"agentmail_list_threads","name":"List Threads","description":"List email threads in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list threads from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of threads to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"},"labels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to filter threads by"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter threads before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter threads after this ISO 8601 timestamp"}},"hostedApiKey":"none"},"agentmail_reply_message":{"id":"agentmail_reply_message","name":"Reply to Message","description":"Reply to an existing email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to reply from"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to reply to"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text reply body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML reply body"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Override recipient email addresses (comma-separated)"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC email addresses (comma-separated)"},"replyAll":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Reply to all recipients of the original message"}},"hostedApiKey":"none"},"agentmail_send_draft":{"id":"agentmail_send_draft","name":"Send Draft","description":"Send an existing email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to send"}},"hostedApiKey":"none"},"agentmail_send_message":{"id":"agentmail_send_message","name":"Send Message","description":"Send an email message from an AgentMail inbox","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to send from"},"to":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient email address (comma-separated for multiple)"},"subject":{"type":"string","required":true,"visibility":"user-or-llm","description":"Email subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text email body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML email body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"}},"hostedApiKey":"none"},"agentmail_update_draft":{"id":"agentmail_update_draft","name":"Update Draft","description":"Update an existing email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to update"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Draft subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text draft body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML draft body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"},"sendAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to schedule sending"}},"hostedApiKey":"none"},"agentmail_update_inbox":{"id":"agentmail_update_inbox","name":"Update Inbox","description":"Update the display name of an email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to update"},"displayName":{"type":"string","required":true,"visibility":"user-or-llm","description":"New display name for the inbox"}},"hostedApiKey":"none"},"agentmail_update_message":{"id":"agentmail_update_message","name":"Update Message","description":"Add or remove labels on an email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to update"},"addLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to add to the message"},"removeLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to remove from the message"}},"hostedApiKey":"none"},"agentmail_update_thread":{"id":"agentmail_update_thread","name":"Update Thread Labels","description":"Add or remove labels on an email thread in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to update"},"addLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to add to the thread"},"removeLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to remove from the thread"}},"hostedApiKey":"none"},"agentphone_create_call":{"id":"agentphone_create_call","name":"Create Outbound Call","description":"Initiate an outbound voice call from an AgentPhone agent","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"agentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Agent that will handle the call"},"toNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Phone number to call in E.164 format (e.g. +14155551234)"},"fromNumberId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Phone number ID to use as caller ID. Must belong to the agent. If omitted, the agent\'s first assigned number is used."},"initialGreeting":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optional greeting spoken when the recipient answers"},"voice":{"type":"string","required":false,"visibility":"user-or-llm","description":"Voice ID override for this call (defaults to the agent\'s configured voice)"},"systemPrompt":{"type":"string","required":false,"visibility":"user-or-llm","description":"When provided, uses a built-in LLM for the conversation instead of forwarding to your webhook"}},"hostedApiKey":"none"},"agentphone_create_contact":{"id":"agentphone_create_contact","name":"Create Contact","description":"Create a new contact in AgentPhone","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"phoneNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Phone number in E.164 format (e.g. +14155551234)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact\'s full name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Contact\'s email address"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Freeform notes stored on the contact"}},"hostedApiKey":"none"},"agentphone_create_number":{"id":"agentphone_create_number","name":"Create Phone Number","description":"Provision a new SMS- and voice-enabled phone number","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Two-letter country code (e.g. US, CA). Defaults to US."},"areaCode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Preferred area code (US/CA only, e.g. \\"415\\"). Best-effort — may be ignored if unavailable."},"agentId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optionally attach the number to an agent immediately"}},"hostedApiKey":"none"},"agentphone_delete_contact":{"id":"agentphone_delete_contact","name":"Delete Contact","description":"Delete a contact by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"}},"hostedApiKey":"none"},"agentphone_get_call":{"id":"agentphone_get_call","name":"Get Call","description":"Fetch a call and its full transcript","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"callId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the call to retrieve"}},"hostedApiKey":"none"},"agentphone_get_call_transcript":{"id":"agentphone_get_call_transcript","name":"Get Call Transcript","description":"Get the full ordered transcript for a call","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"callId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the call to retrieve the transcript for"}},"hostedApiKey":"none"},"agentphone_get_contact":{"id":"agentphone_get_contact","name":"Get Contact","description":"Fetch a single contact by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"}},"hostedApiKey":"none"},"agentphone_get_conversation":{"id":"agentphone_get_conversation","name":"Get Conversation","description":"Get a conversation along with its recent messages","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"messageLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of recent messages to include (default 50, max 100)"}},"hostedApiKey":"none"},"agentphone_get_conversation_messages":{"id":"agentphone_get_conversation_messages","name":"Get Conversation Messages","description":"Get paginated messages for a conversation","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of messages to return (default 50, max 200)"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received after this ISO 8601 timestamp"}},"hostedApiKey":"none"},"agentphone_get_number_messages":{"id":"agentphone_get_number_messages","name":"Get Phone Number Messages","description":"Fetch messages received on a specific phone number","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"numberId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the phone number"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of messages to return (default 50, max 200)"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received after this ISO 8601 timestamp"}},"hostedApiKey":"none"},"agentphone_get_usage":{"id":"agentphone_get_usage","name":"Get Usage","description":"Retrieve current usage statistics for the AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"}},"hostedApiKey":"none"},"agentphone_get_usage_daily":{"id":"agentphone_get_usage_daily","name":"Get Daily Usage","description":"Get a daily breakdown of usage (messages, calls, webhooks) for the last N days","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"days":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of days to return (1-365, default 30)"}},"hostedApiKey":"none"},"agentphone_get_usage_monthly":{"id":"agentphone_get_usage_monthly","name":"Get Monthly Usage","description":"Get monthly usage aggregation (messages, calls, webhooks) for the last N months","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"months":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of months to return (1-24, default 6)"}},"hostedApiKey":"none"},"agentphone_list_calls":{"id":"agentphone_list_calls","name":"List Calls","description":"List voice calls for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"},"status":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by status (completed, in-progress, failed)"},"direction":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by direction (inbound, outbound)"},"type":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by call type (pstn, web)"},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search by phone number (matches fromNumber or toNumber)"}},"hostedApiKey":"none"},"agentphone_list_contacts":{"id":"agentphone_list_contacts","name":"List Contacts","description":"List contacts for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by name or phone number (case-insensitive contains)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 50, max 200)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"hostedApiKey":"none"},"agentphone_list_conversations":{"id":"agentphone_list_conversations","name":"List Conversations","description":"List conversations (message threads) for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"hostedApiKey":"none"},"agentphone_list_numbers":{"id":"agentphone_list_numbers","name":"List Phone Numbers","description":"List all phone numbers provisioned for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"hostedApiKey":"none"},"agentphone_react_to_message":{"id":"agentphone_react_to_message","name":"React to Message","description":"Send an iMessage tapback reaction to a message (iMessage only)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to react to"},"reaction":{"type":"string","required":true,"visibility":"user-or-llm","description":"Reaction type: love, like, dislike, laugh, emphasize, or question"}},"hostedApiKey":"none"},"agentphone_release_number":{"id":"agentphone_release_number","name":"Release Phone Number","description":"Release (delete) a phone number. This action is irreversible.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"numberId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the phone number to release"}},"hostedApiKey":"none"},"agentphone_send_message":{"id":"agentphone_send_message","name":"Send Message","description":"Send an outbound SMS or iMessage from an AgentPhone agent","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"agentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Agent sending the message"},"toNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient phone number in E.164 format (e.g. +14155551234)"},"body":{"type":"string","required":true,"visibility":"user-or-llm","description":"Message text to send"},"mediaUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optional URL of an image, video, or file to attach"},"numberId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Phone number ID to send from. If omitted, the agent\'s first assigned number is used."}},"hostedApiKey":"none"},"agentphone_update_contact":{"id":"agentphone_update_contact","name":"Update Contact","description":"Update a contact\'s fields","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"},"phoneNumber":{"type":"string","required":false,"visibility":"user-or-llm","description":"New phone number in E.164 format"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New contact name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"New email address"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"New freeform notes"}},"hostedApiKey":"none"},"agentphone_update_conversation":{"id":"agentphone_update_conversation","name":"Update Conversation","description":"Update conversation metadata (stored state). Pass null to clear existing metadata.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"metadata":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom key-value metadata to store on the conversation. Pass null to clear existing metadata."}},"hostedApiKey":"none"},"agiloft_async_status":{"id":"agiloft_async_status","name":"Agiloft Async Status","description":"Check whether an asynchronous Agiloft call, such as a run action button, has completed.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table the asynchronous call was made against"},"callbackId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Callback ID returned by the asynchronous call, e.g. from Run Action Button"}},"hostedApiKey":"none"},"agiloft_attach_file":{"id":"agiloft_attach_file","name":"Agiloft Attach File","description":"Attach a file to a field in an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to attach the file to"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"file":{"type":"file","required":true,"visibility":"user-or-llm","description":"File to attach"},"fileName":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name to assign to the file (defaults to original file name)"},"overwrite":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Replace the contents of the field instead of adding another file to it"}},"hostedApiKey":"none"},"agiloft_attachment_info":{"id":"agiloft_attachment_info","name":"Agiloft Attachment Info","description":"Get information about file attachments on a record field.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to check attachments on"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field to inspect"}},"hostedApiKey":"none"},"agiloft_create_record":{"id":"agiloft_create_record","name":"Agiloft Create Record","description":"Create a new record in an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record field values as a JSON object (e.g., {\\"first_name\\": \\"John\\", \\"status\\": \\"Active\\"})"}},"hostedApiKey":"none"},"agiloft_delete_record":{"id":"agiloft_delete_record","name":"Agiloft Delete Record","description":"Delete a record from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to delete"},"substituteIds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated IDs of records that adopt the dependants of the deleted record. Read only when the delete rule is REPLACE_WITH_ANOTHER."},"deleteRule":{"type":"string","required":false,"visibility":"user-or-llm","description":"How to treat records that depend on this one: ERROR_IF_DEPENDANTS (default — fails rather than cascading), APPLY_DELETE_WHERE_POSSIBLE, DELETE_WHERE_POSSIBLE_OTHERWISE_UNLINK, APPLY_UNLINK, UNLINK_WHERE_POSSIBLE_OTHERWISE_DELETE, or REPLACE_WITH_ANOTHER"}},"hostedApiKey":"none"},"agiloft_get_choice_line_id":{"id":"agiloft_get_choice_line_id","name":"Agiloft Get Choice Line ID","description":"Resolve the internal numeric ID of a choice-list value, for use in EWSelect WHERE clauses against choice fields.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"case\\", \\"contracts\\")"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Choice field name (e.g., \\"priority\\", \\"status\\")"},"value":{"type":"string","required":true,"visibility":"user-or-llm","description":"Choice display value to resolve (e.g., \\"High\\", \\"Active\\")"}},"hostedApiKey":"none"},"agiloft_list_tables":{"id":"agiloft_list_tables","name":"Agiloft List Tables","description":"List the tables and fields in an Agiloft knowledge base, to discover the logical names other operations need.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":false,"visibility":"user-or-llm","description":"Logical name of a single table to describe (e.g., \\"contacts\\"). Leave empty to list every table in the knowledge base."},"includeLinkedInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the source table and column behind each linked field"},"skipColumnsInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Return table names only, omitting field details, for a much smaller response"}},"hostedApiKey":"none"},"agiloft_lock_record":{"id":"agiloft_lock_record","name":"Agiloft Lock Record","description":"Lock, unlock, or check the lock status of an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to lock, unlock, or check"},"lockAction":{"type":"string","required":true,"visibility":"user-or-llm","description":"Action to perform: \\"lock\\", \\"unlock\\", or \\"check\\""},"force":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Unlock only: release a lock held by another user."}},"hostedApiKey":"none"},"agiloft_nlp_search":{"id":"agiloft_nlp_search","name":"Agiloft Natural Language Search","description":"Search Agiloft records by describing what you want in plain language, such as \\"active NDAs submitted last month\\".","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"nlpQuery":{"type":"string","required":true,"visibility":"user-or-llm","description":"The request in plain language, e.g. \\"Show me open, high-priority contracts\\". Structured field filters are not accepted — use Search Records for those."},"fields":{"type":"string","required":true,"visibility":"user-or-llm","description":"Comma-separated field names to return, e.g. \\"id, contract_title1, company_name\\""},"page":{"type":"string","required":false,"visibility":"user-or-llm","description":"Page number, starting from 0"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Records per page"}},"hostedApiKey":"none"},"agiloft_read_record":{"id":"agiloft_read_record","name":"Agiloft Read Record","description":"Read a record by ID from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to read"},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of field names to include in the response"}},"hostedApiKey":"none"},"agiloft_remove_attachment":{"id":"agiloft_remove_attachment","name":"Agiloft Remove Attachment","description":"Remove an attached file from a field in an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record containing the attachment"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"position":{"type":"string","required":true,"visibility":"user-or-llm","description":"Position index of the file to remove (starting from 0)"}},"hostedApiKey":"none"},"agiloft_retrieve_attachment":{"id":"agiloft_retrieve_attachment","name":"Agiloft Retrieve Attachment","description":"Download an attached file from an Agiloft record field.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record containing the attachment"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"position":{"type":"string","required":true,"visibility":"user-or-llm","description":"Position index of the file in the field (starting from 0)"}},"hostedApiKey":"none"},"agiloft_run_action_button":{"id":"agiloft_run_action_button","name":"Agiloft Run Action Button","description":"Run an action button on an Agiloft record, such as an approval or send-for-signature step.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"case\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to run the action button on"},"actionButtonField":{"type":"string","required":true,"visibility":"user-or-llm","description":"Logical name of the field holding the action button (e.g., \\"ab_field\\")"}},"hostedApiKey":"none"},"agiloft_saved_search":{"id":"agiloft_saved_search","name":"Agiloft Saved Search","description":"List the saved searches defined for an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Logical table name to list saved searches for (e.g., \\"contract\\")"}},"hostedApiKey":"none"},"agiloft_search_records":{"id":"agiloft_search_records","name":"Agiloft Search Records","description":"Search for records in an Agiloft table using a query.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name to search in (e.g., \\"contracts\\", \\"contacts.employees\\")"},"query":{"type":"string","required":false,"visibility":"user-or-llm","description":"Ad hoc EWSearch query. Combine conditions with && (and) or || (or) and quote every value — e.g. \\"summary~=\'test\'&&priority=\'High\'\\". Required unless a saved search is given."},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Label of a saved search defined on the table (e.g., \\"C: Status is Closed\\"). Can be combined with a query to narrow it further."},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of field names to include in the results"},"page":{"type":"string","required":false,"visibility":"user-or-llm","description":"Page number for paginated results (starting from 0)"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of records to return per page. Agiloft treats 0 as \\"all records\\", so leave it unset or use a positive value to keep result sizes bounded."}},"hostedApiKey":"none"},"agiloft_select_records":{"id":"agiloft_select_records","name":"Agiloft Select Records","description":"Select record IDs matching a SQL WHERE clause from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"where":{"type":"string","required":true,"visibility":"user-or-llm","description":"SQL WHERE clause using database column names (e.g., \\"summary like \'%new%\'\\" or \\"assigned_person=\'John Doe\'\\"). EWSelect has no page size and returns every matching ID, so append a database limit such as \\"limit 0,200\\" to bound the result."}},"hostedApiKey":"none"},"agiloft_update_record":{"id":"agiloft_update_record","name":"Agiloft Update Record","description":"Update an existing record in an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to update"},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Updated field values as a JSON object (e.g., {\\"status\\": \\"Active\\", \\"priority\\": \\"High\\"})"}},"hostedApiKey":"none"},"agiloft_upsert_record":{"id":"agiloft_upsert_record","name":"Agiloft Upsert Record","description":"Create an Agiloft record, or update it when a record already matches the given fields.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"match":{"type":"string","required":true,"visibility":"user-or-llm","description":"Field used to find an existing record (e.g., \\"ext_id\\"). Pick something that identifies a record uniquely — if more than one record matches, Agiloft writes nothing and returns a conflict."},"async":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Queue the write instead of waiting for it. Returns a callback ID instead of a record ID; pass that to Async Status to poll the result."},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Field values as a JSON object. On create these populate the new record; on update only the supplied fields change."}},"hostedApiKey":"none"},"ahrefs_anchors":{"id":"ahrefs_anchors","name":"Ahrefs Anchors","description":"Get the anchor text distribution for a target domain or URL\'s backlinks, showing how many links and referring domains use each anchor text.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live), \\"all_time\\" (default, includes lost backlinks), or \\"since:YYYY-MM-DD\\" (backlinks found since a date)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_backlinks":{"id":"ahrefs_backlinks","name":"Ahrefs Backlinks","description":"Get a list of backlinks pointing to a target domain or URL. Returns details about each backlink including source URL, anchor text, and domain rating.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live backlinks), \\"all_time\\" (default, includes lost backlinks), or \\"since:YYYY-MM-DD\\" (backlinks found since a date)."},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_backlinks_stats":{"id":"ahrefs_backlinks_stats","name":"Ahrefs Backlinks Stats","description":"Get backlink and referring domain totals for a target domain or URL, both currently live and across all time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_batch_analysis":{"id":"ahrefs_batch_analysis","name":"Ahrefs Batch Analysis","description":"Get bulk SEO metrics (Domain Rating, backlinks, referring domains, organic traffic, and more) for multiple domains or URLs in a single request. Useful for comparing many competitors at once.","version":"1.0.0","params":{"targets":{"type":"string","required":true,"visibility":"user-or-llm","description":"Comma-separated list of domains or URLs to analyze. Example: \\"example.com,competitor.com\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode applied to every target: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"protocol":{"type":"string","required":false,"visibility":"user-or-llm","description":"Protocol applied to every target: \\"both\\" (default), \\"http\\", or \\"https\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_broken_backlinks":{"id":"ahrefs_broken_backlinks","name":"Ahrefs Broken Backlinks","description":"Get a list of broken backlinks pointing to a target domain or URL. Useful for identifying link reclamation opportunities.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_domain_rating":{"id":"ahrefs_domain_rating","name":"Ahrefs Domain Rating","description":"Get the Domain Rating (DR) and Ahrefs Rank for a target domain. Domain Rating shows the strength of a website\'s backlink profile on a scale from 0 to 100.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain to analyze (e.g., example.com)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date for historical data in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_domain_rating_history":{"id":"ahrefs_domain_rating_history","name":"Ahrefs Domain Rating History","description":"Get the historical Domain Rating (DR) trend for a target domain or URL over a date range, grouped daily, weekly, or monthly.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_keyword_overview":{"id":"ahrefs_keyword_overview","name":"Ahrefs Keyword Overview","description":"Get detailed metrics for a keyword including search volume, keyword difficulty, CPC, clicks, and traffic potential.","version":"1.0.0","params":{"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The keyword to analyze"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for keyword data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_keywords_history":{"id":"ahrefs_keywords_history","name":"Ahrefs Keywords History","description":"Get the historical organic keyword ranking distribution for a target domain or URL over a date range: how many keywords rank in each position bucket at each point in time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_metrics":{"id":"ahrefs_metrics","name":"Ahrefs Metrics","description":"Get a one-call organic and paid search overview for a target domain or URL: organic traffic, organic keywords, paid traffic, paid keywords, and estimated traffic cost.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_metrics_history":{"id":"ahrefs_metrics_history","name":"Ahrefs Metrics History","description":"Get the historical organic and paid traffic trend for a target domain or URL over a date range: organic traffic/cost and paid traffic/cost at each point in time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_organic_competitors":{"id":"ahrefs_organic_competitors","name":"Ahrefs Organic Competitors","description":"Get domains that compete with a target domain or URL for the same organic keywords, ranked by keyword overlap.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_organic_keywords":{"id":"ahrefs_organic_keywords","name":"Ahrefs Organic Keywords","description":"Get organic keywords that a target domain or URL ranks for in Google search results. Returns keyword details including search volume, ranking position, and estimated traffic.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_paid_pages":{"id":"ahrefs_paid_pages","name":"Ahrefs Paid Pages","description":"Get a target domain\'s pages that receive paid search traffic, sorted by estimated paid traffic. Returns page URLs with their paid traffic, keyword counts, and estimated spend.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_competitors_overview":{"id":"ahrefs_rank_tracker_competitors_overview","name":"Ahrefs Rank Tracker Competitors Overview","description":"Get competitor rankings for the keywords tracked in an Ahrefs Rank Tracker project: each tracked keyword\'s volume and difficulty alongside every competitor\'s position, traffic, and traffic value. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report rankings for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"dateCompared":{"type":"string","required":false,"visibility":"user-only","description":"Comparison date in YYYY-MM-DD format, to compute position/traffic deltas"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_competitors_stats":{"id":"ahrefs_rank_tracker_competitors_stats","name":"Ahrefs Rank Tracker Competitors Stats","description":"Get aggregate competitor stats for an Ahrefs Rank Tracker project: each competitor\'s traffic, traffic value, average position, and share of voice across all tracked keywords. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report metrics for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_overview":{"id":"ahrefs_rank_tracker_overview","name":"Ahrefs Rank Tracker Overview","description":"Get ranking overview metrics for the keywords tracked in an Ahrefs Rank Tracker project: position, search volume, keyword difficulty, and estimated traffic. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report rankings for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"dateCompared":{"type":"string","required":false,"visibility":"user-only","description":"Comparison date in YYYY-MM-DD format, to compute position/traffic deltas"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_serp_overview":{"id":"ahrefs_rank_tracker_serp_overview","name":"Ahrefs Rank Tracker SERP Overview","description":"Get the full SERP (search engine results page) for a keyword tracked in an Ahrefs Rank Tracker project, including every ranking URL with its position, title, and authority metrics. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The tracked keyword to retrieve SERP data for"},"country":{"type":"string","required":true,"visibility":"user-or-llm","description":"Country code for the tracked keyword. Example: \\"us\\", \\"gb\\", \\"de\\""},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"topPositions":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of top organic positions to return (defaults to all available)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Timestamp to return the last available SERP Overview at, in YYYY-MM-DDThh:mm:ss format"},"locationId":{"type":"number","required":false,"visibility":"user-or-llm","description":"Location ID of the tracked keyword, if tracked at a specific location"},"languageCode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Language code of the tracked keyword"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_refdomains_history":{"id":"ahrefs_refdomains_history","name":"Ahrefs Referring Domains History","description":"Get the historical referring domains trend for a target domain or URL over a date range, grouped daily, weekly, or monthly.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_referring_domains":{"id":"ahrefs_referring_domains","name":"Ahrefs Referring Domains","description":"Get a list of domains that link to a target domain or URL. Returns unique referring domains with their domain rating, backlink counts, and discovery dates.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live), \\"all_time\\" (default, includes lost domains), or \\"since:YYYY-MM-DD\\" (domains found since a date)."},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_related_terms":{"id":"ahrefs_related_terms","name":"Ahrefs Related Terms","description":"Get keyword ideas related to a seed keyword: terms the same top-ranking pages also rank for (\\"also rank for\\") or also discuss (\\"also talk about\\"), with volume, difficulty, and CPC.","version":"1.0.0","params":{"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The seed keyword to find related terms for"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for keyword data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"terms":{"type":"string","required":false,"visibility":"user-or-llm","description":"Type of related keywords to return: \\"also_rank_for\\", \\"also_talk_about\\", or \\"all\\" (default: \\"all\\")"},"viewFor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Whether to derive related terms from the top 10 or top 100 ranking pages (default: \\"top_10\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_site_audit_page_explorer":{"id":"ahrefs_site_audit_page_explorer","name":"Ahrefs Site Audit Page Explorer","description":"Get crawled pages from an Ahrefs Site Audit project with health and SEO metrics: HTTP status, title, link counts, backlinks, indexability, and traffic. Optionally filter to pages affected by a specific issue.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Site Audit project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Crawl date in YYYY-MM-DDThh:mm:ss format (defaults to the most recent crawl)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip, for pagination"},"issueId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Only return pages affected by this issue ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_top_pages":{"id":"ahrefs_top_pages","name":"Ahrefs Top Pages","description":"Get the top pages of a target domain sorted by organic traffic. Returns page URLs with their traffic, keyword counts, and estimated traffic value.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"airtable_create_records":{"id":"airtable_create_records","name":"Airtable Create Records","description":"Write new records to an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to create, each with a `fields` object"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_delete_records":{"id":"airtable_delete_records","name":"Airtable Delete Records","description":"Delete one or more records from an Airtable table by ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordIds":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of record IDs to delete (each starts with \\"rec\\", e.g., [\\"recXXXXXXXXXXXXXX\\"]). Pass a single-element array to delete one record."}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_get_base_schema":{"id":"airtable_get_base_schema","name":"Airtable Get Base Schema","description":"Get the schema of all tables, fields, and views in an Airtable base","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_get_record":{"id":"airtable_get_record","name":"Airtable Get Record","description":"Retrieve a single record from an Airtable table by its ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record ID to retrieve (starts with \\"rec\\", e.g., \\"recXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_bases":{"id":"airtable_list_bases","name":"Airtable List Bases","description":"List all bases the authenticated user has access to","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination offset for retrieving additional bases"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_records":{"id":"airtable_list_records","name":"Airtable List Records","description":"Read records from an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"maxRecords":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of records to return (default: all records)"},"filterFormula":{"type":"string","required":false,"visibility":"user-or-llm","description":"Formula to filter records (e.g., \\"({Field Name} = \'Value\')\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_tables":{"id":"airtable_list_tables","name":"Airtable List Tables","description":"List all tables and their schema in an Airtable base","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_update_multiple_records":{"id":"airtable_update_multiple_records","name":"Airtable Update Multiple Records","description":"Update multiple existing records in an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to update, each with an `id` and a `fields` object"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_update_record":{"id":"airtable_update_record","name":"Airtable Update Record","description":"Update an existing record in an Airtable table by ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record ID to update (starts with \\"rec\\", e.g., \\"recXXXXXXXXXXXXXX\\")"},"fields":{"type":"json","required":true,"visibility":"user-or-llm","description":"An object containing the field names and their new values"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_upsert_records":{"id":"airtable_upsert_records","name":"Airtable Upsert Records","description":"Update existing records or create new ones in an Airtable table, matching on the specified merge fields","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to upsert, each with a `fields` object"},"fieldsToMergeOn":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of field names used to match existing records (max 3). A record is updated when all merge fields match, otherwise it is created. Example: [\\"Name\\"]"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"algolia_add_record":{"id":"algolia_add_record","name":"Algolia Add Record","description":"Add or replace a record in an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":false,"visibility":"user-or-llm","description":"Object ID for the record (auto-generated if not provided)"},"record":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object representing the record to add"}},"hostedApiKey":"none"},"algolia_batch_operations":{"id":"algolia_batch_operations","name":"Algolia Batch Operations","description":"Perform batch add, update, partial update, or delete operations on records in an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"requests":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of batch operations. Each item has \\"action\\" (addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject, delete, clear) and \\"body\\" (the record data; must include objectID for update/delete; use an empty object {} for the index-level delete/clear actions)"}},"hostedApiKey":"none"},"algolia_browse_records":{"id":"algolia_browse_records","name":"Algolia Browse Records","description":"Browse and iterate over all records in an Algolia index using cursor pagination","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key (must have browse ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to browse"},"query":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search query to filter browsed records"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter string to narrow down results"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of hits per page (default: 1000, max: 1000)"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous browse response for pagination"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search"}},"hostedApiKey":"none"},"algolia_clear_records":{"id":"algolia_clear_records","name":"Algolia Clear Records","description":"Clear all records from an Algolia index while keeping settings, synonyms, and rules","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to clear"}},"hostedApiKey":"none"},"algolia_copy_move_index":{"id":"algolia_copy_move_index","name":"Algolia Copy/Move Index","description":"Copy or move an Algolia index to a new destination","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the source index"},"operation":{"type":"string","required":true,"visibility":"user-or-llm","description":"Operation to perform: \\"copy\\" or \\"move\\""},"destination":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the destination index"},"scope":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of scopes to copy (only for \\"copy\\" operation): [\\"settings\\", \\"synonyms\\", \\"rules\\"]. Omit to copy everything including records."}},"hostedApiKey":"none"},"algolia_delete_by_filter":{"id":"algolia_delete_by_filter","name":"Algolia Delete By Filter","description":"Delete all records matching a filter from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter expression to match records for deletion (e.g., \\"category:outdated\\")"},"facetFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of facet filters (e.g., [\\"brand:Acme\\"])"},"numericFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of numeric filters (e.g., [\\"price > 100\\"])"},"tagFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of tag filters using the _tags attribute (e.g., [\\"published\\"])"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search filter (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search filter"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search filter"}},"hostedApiKey":"none"},"algolia_delete_index":{"id":"algolia_delete_index","name":"Algolia Delete Index","description":"Delete an entire Algolia index and all its records","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to delete"}},"hostedApiKey":"none"},"algolia_delete_record":{"id":"algolia_delete_record","name":"Algolia Delete Record","description":"Delete a record by objectID from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to delete"}},"hostedApiKey":"none"},"algolia_get_record":{"id":"algolia_get_record","name":"Algolia Get Record","description":"Get a record by objectID from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to retrieve"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"}},"hostedApiKey":"none"},"algolia_get_records":{"id":"algolia_get_records","name":"Algolia Get Records","description":"Retrieve multiple records by objectID from one or more Algolia indices","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Default index name for all requests"},"requests":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of objects specifying records to retrieve. Each must have \\"objectID\\" and optionally \\"indexName\\" and \\"attributesToRetrieve\\"."}},"hostedApiKey":"none"},"algolia_get_settings":{"id":"algolia_get_settings","name":"Algolia Get Settings","description":"Retrieve the settings of an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"}},"hostedApiKey":"none"},"algolia_get_task_status":{"id":"algolia_get_task_status","name":"Algolia Get Task Status","description":"Check whether an Algolia indexing task has finished publishing","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index the task ran against"},"taskID":{"type":"number","required":true,"visibility":"user-or-llm","description":"The taskID returned by a previous write operation"}},"hostedApiKey":"none"},"algolia_list_indices":{"id":"algolia_list_indices","name":"Algolia List Indices","description":"List all indices in an Algolia application","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for paginating indices (default: not paginated)"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of indices per page (default: 100)"}},"hostedApiKey":"none"},"algolia_partial_update_record":{"id":"algolia_partial_update_record","name":"Algolia Partial Update Record","description":"Partially update a record in an Algolia index without replacing it entirely","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to update"},"attributes":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object with attributes to update. Supports built-in operations like {\\"stock\\": {\\"_operation\\": \\"Decrement\\", \\"value\\": 1}}"},"createIfNotExists":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to create the record if it does not exist (default: true)"}},"hostedApiKey":"none"},"algolia_search":{"id":"algolia_search","name":"Algolia Search","description":"Search an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to search"},"query":{"type":"string","required":true,"visibility":"user-or-llm","description":"Search query text"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of hits per page (default: 20)"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number to retrieve (default: 0)"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter string (e.g., \\"category:electronics AND price < 100\\")"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"},"facets":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of facet attribute names to retrieve counts for (use \\"*\\" for all)"},"getRankingInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to include detailed ranking information in each hit"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search"}},"hostedApiKey":"none"},"algolia_update_settings":{"id":"algolia_update_settings","name":"Algolia Update Settings","description":"Update the settings of an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have editSettings ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"settings":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object with settings to update (e.g., {\\"searchableAttributes\\": [\\"name\\", \\"description\\"], \\"customRanking\\": [\\"desc(popularity)\\"]})"},"forwardToReplicas":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to apply changes to replica indices (default: false)"}},"hostedApiKey":"none"},"amplitude_event_segmentation":{"id":"amplitude_event_segmentation","name":"Amplitude Event Segmentation","description":"Query event analytics data with segmentation. Get event counts, uniques, averages, and more.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"eventType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Event type name to analyze"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric type: uniques, totals, pct_dau, average, histogram, sums, value_avg, or formula (default: uniques)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by (prefix custom user properties with \\"gp:\\")"},"groupBy2":{"type":"string","required":false,"visibility":"user-or-llm","description":"Second property name to group by (prefix custom user properties with \\"gp:\\")"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of group-by values (max 1000)"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON array of filter objects applied to the event, e.g. [{\\"subprop_type\\":\\"event\\",\\"subprop_key\\":\\"city\\",\\"subprop_op\\":\\"is\\",\\"subprop_value\\":[\\"San Francisco\\"]}]"},"formula":{"type":"string","required":false,"visibility":"user-or-llm","description":"Required when metric is \\"formula\\", e.g. \\"UNIQUES(A)/UNIQUES(B)\\""},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_funnels":{"id":"amplitude_funnels","name":"Amplitude Funnels","description":"Analyze conversion rates and drop-off between a sequence of events.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"events":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON array of event objects, one per funnel step in order, e.g. [{\\"event_type\\":\\"signup\\"},{\\"event_type\\":\\"purchase\\"}]"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Funnel ordering: \\"ordered\\", \\"unordered\\", or \\"sequential\\" (default: ordered)"},"userType":{"type":"string","required":false,"visibility":"user-or-llm","description":"User type: \\"new\\" or \\"active\\" (default: active)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: -300000 (real-time), -3600000 (hourly), 1 (daily), 7 (weekly), or 30 (monthly)"},"conversionWindowSeconds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Conversion window in seconds (default: 2592000, i.e. 30 days)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property to group by (limit: one; prefix custom properties with \\"gp:\\")"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of group-by values (default: 100, max: 1000)"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_get_active_users":{"id":"amplitude_get_active_users","name":"Amplitude Get Active Users","description":"Get active or new user counts over a date range from the Dashboard REST API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric type: \\"active\\" or \\"new\\" (default: active)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_get_revenue":{"id":"amplitude_get_revenue","name":"Amplitude Get Revenue","description":"Get revenue LTV data including ARPU, ARPPU, total revenue, and paying user counts.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric: 0 (ARPU), 1 (ARPPU), 2 (Total Revenue), 3 (Paying Users)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by (limit: one)"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_group_identify":{"id":"amplitude_group_identify","name":"Amplitude Group Identify","description":"Set group-level properties in Amplitude. Supports $set, $setOnce, $add, $append, $unset operations.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"groupType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Group classification (e.g., \\"company\\", \\"org_id\\")"},"groupValue":{"type":"string","required":true,"visibility":"user-or-llm","description":"Specific group identifier (e.g., \\"Acme Corp\\")"},"groupProperties":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON object of group properties. Use operations like $set, $setOnce, $add, $append, $unset."},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_identify_user":{"id":"amplitude_identify_user","name":"Amplitude Identify User","description":"Set user properties in Amplitude using the Identify API. Supports $set, $setOnce, $add, $append, $unset operations.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"User ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"userProperties":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON object of user properties. Use operations like $set, $setOnce, $add, $append, $unset."},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_list_events":{"id":"amplitude_list_events","name":"Amplitude List Events","description":"List all event types in the Amplitude project with their weekly totals and unique counts.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_realtime_active_users":{"id":"amplitude_realtime_active_users","name":"Amplitude Real-time Active Users","description":"Get real-time active user counts at 5-minute granularity for the last 2 days.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_retention":{"id":"amplitude_retention","name":"Amplitude Retention","description":"Measure how many users return to perform an action after a starting action.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"startEvent":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON starting event object, e.g. {\\"event_type\\":\\"_new\\"} or {\\"event_type\\":\\"_active\\"}"},"returnEvent":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON returning event object, e.g. {\\"event_type\\":\\"_all\\"} or {\\"event_type\\":\\"_active\\"}"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"retentionMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Retention type: \\"bracket\\", \\"rolling\\", or \\"n-day\\" (default: n-day)"},"retentionBrackets":{"type":"string","required":false,"visibility":"user-or-llm","description":"Required when Retention Mode is \\"bracket\\". Day ranges, e.g. [[0,4]]"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property to group by (limit: one; prefix custom properties with \\"gp:\\")"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_send_event":{"id":"amplitude_send_event","name":"Amplitude Send Event","description":"Track an event in Amplitude using the HTTP V2 API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"User ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"eventType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the event (e.g., \\"page_view\\", \\"purchase\\")"},"eventProperties":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON object of custom event properties"},"userProperties":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON object of user properties to set (supports $set, $setOnce, $add, $append, $unset)"},"time":{"type":"string","required":false,"visibility":"user-or-llm","description":"Event timestamp in milliseconds since epoch"},"sessionId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Session start time in milliseconds since epoch"},"insertId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Unique ID for deduplication (within 7-day window)"},"appVersion":{"type":"string","required":false,"visibility":"user-or-llm","description":"Application version string"},"platform":{"type":"string","required":false,"visibility":"user-or-llm","description":"Platform (e.g., \\"Web\\", \\"iOS\\", \\"Android\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Two-letter country code"},"language":{"type":"string","required":false,"visibility":"user-or-llm","description":"Language code (e.g., \\"en\\")"},"ip":{"type":"string","required":false,"visibility":"user-or-llm","description":"IP address for geo-location"},"price":{"type":"string","required":false,"visibility":"user-or-llm","description":"Price of the item purchased"},"quantity":{"type":"string","required":false,"visibility":"user-or-llm","description":"Quantity of items purchased"},"revenue":{"type":"string","required":false,"visibility":"user-or-llm","description":"Revenue amount"},"productId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Product identifier"},"revenueType":{"type":"string","required":false,"visibility":"user-or-llm","description":"Revenue type (e.g., \\"purchase\\", \\"refund\\")"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_user_activity":{"id":"amplitude_user_activity","name":"Amplitude User Activity","description":"Get the event stream for a specific user by their Amplitude ID.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"amplitudeId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Amplitude internal user ID"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Offset for pagination (default 0)"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of events to return (default 1000, max 1000)"},"direction":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort direction: \\"latest\\" or \\"earliest\\" (default: latest)"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_user_profile":{"id":"amplitude_user_profile","name":"Amplitude User Profile","description":"Get a user profile including properties, cohort memberships, and computed properties. Not available for EU data-residency projects.","version":"1.0.0","params":{"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"External user ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"getAmpProps":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include Amplitude user properties (true/false, default: false)"},"getCohortIds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include cohort IDs the user belongs to (true/false, default: false)"},"getComputations":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include computed user properties (true/false, default: false)"}},"hostedApiKey":"none"},"amplitude_user_search":{"id":"amplitude_user_search","name":"Amplitude User Search","description":"Search for a user by User ID, Device ID, or Amplitude ID using the Dashboard REST API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"user":{"type":"string","required":true,"visibility":"user-or-llm","description":"User ID, Device ID, or Amplitude ID to search for"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"apify_get_dataset_items":{"id":"apify_get_dataset_items","name":"APIFY Get Dataset Items","description":"Retrieve items stored in an APIFY dataset","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"datasetId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Dataset ID to read items from. Example: \\"9RnD3Pql2vGZkc5H5\\""},"itemLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Max items to return (1-250000). Default: all items. Example: 500"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to skip at the start. Default: 0"},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of fields to include. Example: \\"title,url,price\\""}},"hostedApiKey":"none"},"apify_get_run":{"id":"apify_get_run","name":"APIFY Get Run","description":"Get the status and details of an APIFY actor run","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"runId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor run ID to fetch. Example: \\"HG7ML7M8z78YcAPEB\\""}},"hostedApiKey":"none"},"apify_run_actor_async":{"id":"apify_run_actor_async","name":"APIFY Run Actor (Async)","description":"Start an APIFY Actor run and poll it within the same workflow step until completion or the polling deadline","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"actorId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor ID or username/actor-name. Examples: \\"apify/web-scraper\\", \\"janedoe/my-actor\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor input as JSON string. Example: { \\"startUrls\\": [ { \\"url\\": \\"https://example.com\\" } ], \\"maxPages\\": 10 }"},"waitForFinish":{"type":"number","required":false,"visibility":"user-or-llm","description":"Initial wait time in seconds (0-60) before polling starts. Example: 30"},"itemLimit":{"type":"number","required":false,"default":100,"visibility":"user-or-llm","description":"Max dataset items to fetch (1-250000). Default: 100. Example: 500"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the actor run (128-32768). Example: 1024 for 1GB, 2048 for 2GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the actor run. Example: 300 for 5 minutes, 3600 for 1 hour"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\", \\"build-tag-name\\""}},"hostedApiKey":"none"},"apify_run_actor_sync":{"id":"apify_run_actor_sync","name":"APIFY Run Actor (Sync)","description":"Run an APIFY actor synchronously and get results (max 5 minutes)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"actorId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor ID or username/actor-name. Examples: \\"apify/web-scraper\\", \\"janedoe/my-actor\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor input as JSON string. Example: { \\"startUrls\\": [ { \\"url\\": \\"https://example.com\\" } ], \\"maxPages\\": 10 }"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the actor run (128-32768). Example: 1024 for 1GB, 2048 for 2GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the actor run. Example: 300 for 5 minutes, 3600 for 1 hour"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\", \\"build-tag-name\\""}},"hostedApiKey":"none"},"apify_run_task":{"id":"apify_run_task","name":"APIFY Run Task","description":"Run a saved APIFY actor task synchronously and get dataset items (max 5 minutes)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task ID or username/task-name. Examples: \\"janedoe/my-task\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON string that overrides the task\'s saved input. Example: { \\"startUrls\\": [ { \\"url\\": \\"https://example.com\\" } ] }"},"itemLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Max dataset items to return (1-250000). Example: 500"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the run (128-32768). Example: 1024 for 1GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the run. Example: 300 for 5 minutes"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\""}},"hostedApiKey":"none"},"apollo_account_bulk_create":{"id":"apollo_account_bulk_create","name":"Apollo Bulk Create Accounts","description":"Create up to 100 accounts at once in your Apollo database. Set run_dedupe=true to deduplicate by domain, organization_id, and name. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"accounts":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of accounts to create (max 100). Each account should include a name, and may optionally include domain, phone, phone_status_cd, raw_address, owner_id, linkedin_url, facebook_url, twitter_url, salesforce_id, and hubspot_id."},"append_label_names":{"type":"array","required":false,"visibility":"user-only","description":"Array of label names to add to ALL accounts in this request"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, performs aggressive deduplication by domain, organization_id, and name (defaults to false)"}},"hostedApiKey":"none"},"apollo_account_bulk_update":{"id":"apollo_account_bulk_update","name":"Apollo Bulk Update Accounts","description":"Update up to 1000 existing accounts at once in your Apollo database (higher limit than contacts!). Each account must include an id field. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"account_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of account IDs to update with the same values (max 1000). Use with name/owner_id for uniform updates. Use either this OR account_attributes."},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this name to all accounts"},"owner_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this owner to all accounts"},"account_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this account stage to all accounts"},"account_attributes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of account objects with individual updates (each must include id). Example: [{\\"id\\": \\"acc1\\", \\"name\\": \\"Acme\\", \\"owner_id\\": \\"u1\\", \\"account_stage_id\\": \\"s1\\", \\"typed_custom_fields\\": {\\"field_id\\": \\"value\\"}}]"},"async":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, processes the update asynchronously. Only supported when using account_ids; returns 422 if used with account_attributes."}},"hostedApiKey":"none"},"apollo_account_create":{"id":"apollo_account_create","name":"Apollo Create Account","description":"Create a new account (company) in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Company name (e.g., \\"Acme Corporation\\")"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain without www. prefix (e.g., \\"acme.com\\")"},"phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number for the account"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo user ID of the account owner"},"account_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo ID for the account stage to assign this account to"},"raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate location (e.g., \\"San Francisco, CA, USA\\")"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_account_search":{"id":"apollo_account_search","name":"Apollo Search Accounts","description":"Search your team\'s accounts in Apollo. Display limit: 50,000 records (100 records per page, 500 pages max). Use filters to narrow results. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"q_organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter accounts by organization name (partial-match search)"},"account_stage_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by account stage IDs"},"account_label_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by account label IDs"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"account_last_activity_date\\", \\"account_created_at\\", or \\"account_updated_at\\""},"sort_ascending":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Sort ascending when true. Defaults to descending."},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_account_update":{"id":"apollo_account_update","name":"Apollo Update Account","description":"Update an existing account in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"account_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the account to update (e.g., \\"acc_abc123\\")"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company name (e.g., \\"Acme Corporation\\")"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain (e.g., \\"acme.com\\")"},"phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company phone number"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo user ID of the account owner"},"account_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo ID for the account stage to assign this account to"},"raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate location (e.g., \\"San Francisco, CA, USA\\")"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_contact_bulk_create":{"id":"apollo_contact_bulk_create","name":"Apollo Bulk Create Contacts","description":"Create up to 100 contacts at once in your Apollo database. Supports deduplication to prevent creating duplicate contacts. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"contacts":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of contacts to create (max 100). Each contact may include first_name, last_name, email, title, organization_name, account_id, owner_id, contact_stage_id, linkedin_url, phone (single string) or phone_numbers (array of {raw_number, position}), contact_emails, typed_custom_fields, and CRM IDs (salesforce_contact_id, hubspot_id, team_id) for cross-system matching"},"append_label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Label names to add to all contacts in this request (e.g., [\\"Hot Lead\\"])"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-only","description":"Enable deduplication to prevent creating duplicate contacts. When true, existing contacts are returned without modification"}},"hostedApiKey":"none"},"apollo_contact_bulk_update":{"id":"apollo_contact_bulk_update","name":"Apollo Bulk Update Contacts","description":"Update up to 100 existing contacts at once in your Apollo database. Each contact must include an id field. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"contact_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of contact IDs to update. Must be paired with an object-form contact_attributes specifying the fields to apply uniformly to all listed contacts."},"contact_attributes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Required. Either an array of per-contact updates (each with id) — used standalone — or a single object of attributes to apply to all contact_ids. Supported fields: owner_id, email, organization_name, title, first_name, last_name, account_id, present_raw_address, linkedin_url, typed_custom_fields"},"async":{"type":"boolean","required":false,"visibility":"user-only","description":"Force asynchronous processing. Automatically enabled for >100 contacts"}},"hostedApiKey":"none"},"apollo_contact_create":{"id":"apollo_contact_create","name":"Apollo Create Contact","description":"Create a new contact in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"first_name":{"type":"string","required":true,"visibility":"user-or-llm","description":"First name of the contact"},"last_name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Last name of the contact"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address of the contact"},"title":{"type":"string","required":false,"visibility":"user-or-llm","description":"Job title (e.g., \\"VP of Sales\\", \\"Software Engineer\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo account ID to associate with (e.g., \\"acc_abc123\\")"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the contact owner (accepted by Apollo but not officially documented for POST /contacts)"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the contact\'s employer (e.g., \\"Apollo\\")"},"website_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate website URL (e.g., \\"https://www.apollo.io/\\")"},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Lists/labels to add the contact to (e.g., [\\"Prospects\\"])"},"contact_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the contact stage"},"present_raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal location for the contact (e.g., \\"Atlanta, United States\\")"},"direct_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number"},"corporate_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Work/office phone number"},"mobile_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Mobile phone number"},"home_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Home phone number"},"other_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Alternative phone number"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom field values keyed by custom field ID"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, Apollo deduplicates against existing contacts"}},"hostedApiKey":"none"},"apollo_contact_search":{"id":"apollo_contact_search","name":"Apollo Search Contacts","description":"Search your team\'s contacts in Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"q_keywords":{"type":"string","required":false,"visibility":"user-or-llm","description":"Keywords to search for"},"contact_stage_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by contact stage IDs"},"contact_label_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by Apollo label IDs (lists)"},"sort_by_field":{"type":"string","required":false,"visibility":"user-only","description":"Sort field: contact_last_activity_date, contact_email_last_opened_at, contact_email_last_clicked_at, contact_created_at, or contact_updated_at"},"sort_ascending":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, sort ascending. Must be used together with sort_by_field"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_contact_update":{"id":"apollo_contact_update","name":"Apollo Update Contact","description":"Update an existing contact in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"contact_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the contact to update (e.g., \\"con_abc123\\")"},"first_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"First name of the contact"},"last_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Last name of the contact"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address"},"title":{"type":"string","required":false,"visibility":"user-or-llm","description":"Job title (e.g., \\"VP of Sales\\", \\"Software Engineer\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo account ID (e.g., \\"acc_abc123\\")"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the contact owner (accepted by Apollo but not officially documented for PATCH /contacts/{id})"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the contact\'s employer (e.g., \\"Apollo\\")"},"website_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate website URL (e.g., \\"https://www.apollo.io/\\")"},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Lists/labels to add the contact to (e.g., [\\"Prospects\\"])"},"contact_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the contact stage"},"present_raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal location for the contact (e.g., \\"Atlanta, United States\\")"},"direct_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number"},"corporate_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Work/office phone number"},"mobile_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Mobile phone number"},"home_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Home phone number"},"other_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Alternative phone number"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom field values keyed by custom field ID"}},"hostedApiKey":"none"},"apollo_email_accounts":{"id":"apollo_email_accounts","name":"Apollo Get Email Accounts","description":"Get list of team\'s linked email accounts in Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"}},"hostedApiKey":"none"},"apollo_opportunity_create":{"id":"apollo_opportunity_create","name":"Apollo Create Opportunity","description":"Create a new deal for an account in your Apollo database (master key required)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the opportunity/deal (e.g., \\"Enterprise License - Q1\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"ID of the account this opportunity belongs to (e.g., \\"acc_abc123\\")"},"amount":{"type":"string","required":false,"visibility":"user-or-llm","description":"Monetary value as a plain number string with no commas or currency symbols"},"opportunity_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the opportunity stage"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the opportunity owner"},"closed_date":{"type":"string","required":false,"visibility":"user-or-llm","description":"Expected close date in YYYY-MM-DD format"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_opportunity_get":{"id":"apollo_opportunity_get","name":"Apollo Get Opportunity","description":"Retrieve complete details of a specific deal/opportunity by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"opportunity_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the opportunity to retrieve (e.g., \\"opp_abc123\\")"}},"hostedApiKey":"none"},"apollo_opportunity_search":{"id":"apollo_opportunity_search","name":"Apollo Search Opportunities","description":"Search and list all deals/opportunities in your team\'s Apollo account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"amount\\", \\"is_closed\\", or \\"is_won\\""},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_opportunity_update":{"id":"apollo_opportunity_update","name":"Apollo Update Opportunity","description":"Update an existing deal/opportunity in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"opportunity_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the opportunity to update (e.g., \\"opp_abc123\\")"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the opportunity/deal (e.g., \\"Enterprise License - Q1\\")"},"amount":{"type":"string","required":false,"visibility":"user-or-llm","description":"Monetary value as a plain number string with no commas or currency symbols"},"opportunity_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the opportunity stage"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the opportunity owner"},"closed_date":{"type":"string","required":false,"visibility":"user-or-llm","description":"Expected close date in YYYY-MM-DD format"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_organization_bulk_enrich":{"id":"apollo_organization_bulk_enrich","name":"Apollo Bulk Organization Enrichment","description":"Enrich data for up to 10 organizations at once using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"domains":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of company domains to enrich (max 10, no www. or @, e.g., [\\"apollo.io\\", \\"stripe.com\\"])"}},"hostedApiKey":"none"},"apollo_organization_enrich":{"id":"apollo_organization_enrich","name":"Apollo Organization Enrichment","description":"Enrich data for a single organization using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"domain":{"type":"string","required":true,"visibility":"user-or-llm","description":"Company domain (e.g., \\"apollo.io\\", \\"acme.com\\")"}},"hostedApiKey":"none"},"apollo_organization_search":{"id":"apollo_organization_search","name":"Apollo Organization Search","description":"Search Apollo\'s database for companies using filters","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"organization_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Company HQ locations (cities, US states, or countries)"},"organization_not_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Exclude companies whose HQ is in these locations"},"organization_num_employees_ranges":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employee count ranges as \\"min,max\\" strings (e.g., [\\"1,10\\", \\"250,500\\", \\"10000,20000\\"])"},"q_organization_keyword_tags":{"type":"array","required":false,"visibility":"user-or-llm","description":"Industry or keyword tags"},"q_organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Organization name to search for (e.g., \\"Acme\\", \\"TechCorp\\")"},"organization_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Apollo organization IDs to include (e.g., [\\"5e66b6381e05b4008c8331b8\\"])"},"q_organization_domains_list":{"type":"array","required":false,"visibility":"user-or-llm","description":"Domain names to filter by (no www. or @, up to 1,000)"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_people_bulk_enrich":{"id":"apollo_people_bulk_enrich","name":"Apollo Bulk People Enrichment","description":"Enrich data for up to 10 people at once using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"people":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of people to enrich (max 10)"},"reveal_personal_emails":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal personal email addresses (uses credits)"},"reveal_phone_number":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal phone numbers (uses credits, requires webhook_url)"},"webhook_url":{"type":"string","required":false,"visibility":"user-only","description":"Webhook URL for async phone number delivery (required when reveal_phone_number is true)"}},"hostedApiKey":"none"},"apollo_people_enrich":{"id":"apollo_people_enrich","name":"Apollo People Enrichment","description":"Enrich data for a single person using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"first_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"First name of the person"},"last_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Last name of the person"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Full name of the person (alternative to first_name/last_name)"},"id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the person"},"hashed_email":{"type":"string","required":false,"visibility":"user-or-llm","description":"MD5 or SHA-256 hashed email"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address of the person"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company name where the person works"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain (e.g., \\"apollo.io\\", \\"acme.com\\")"},"linkedin_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"LinkedIn profile URL"},"reveal_personal_emails":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal personal email addresses (uses credits)"},"reveal_phone_number":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal phone numbers (uses credits, requires webhook_url)"},"webhook_url":{"type":"string","required":false,"visibility":"user-only","description":"Webhook URL for async phone number delivery (required when reveal_phone_number is true)"}},"hostedApiKey":"none"},"apollo_people_search":{"id":"apollo_people_search","name":"Apollo People Search","description":"Search Apollo\'s database for people using demographic filters","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"person_titles":{"type":"array","required":false,"visibility":"user-or-llm","description":"Job titles to search for (e.g., [\\"CEO\\", \\"VP of Sales\\"])"},"include_similar_titles":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to return people with job titles similar to person_titles"},"person_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Locations to search in (e.g., [\\"San Francisco, CA\\", \\"New York, NY\\"])"},"person_seniorities":{"type":"array","required":false,"visibility":"user-or-llm","description":"Seniority levels (one of: owner, founder, c_suite, partner, vp, head, director, manager, senior, entry, intern)"},"organization_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Apollo organization IDs to filter by (e.g., [\\"5e66b6381e05b4008c8331b8\\"])"},"organization_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Company names to search within (legacy filter)"},"organization_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Headquarters locations of the people\'s current employer (e.g., [\'texas\', \'tokyo\', \'spain\'])"},"q_organization_domains_list":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employer domain names (e.g., [\\"apollo.io\\", \\"microsoft.com\\"]) — up to 1,000, no www. or @"},"organization_num_employees_ranges":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employee count ranges for the person\'s current employer. Each entry is \\"min,max\\" (e.g., [\\"1,10\\", \\"250,500\\", \\"10000,20000\\"])"},"contact_email_status":{"type":"array","required":false,"visibility":"user-or-llm","description":"Email statuses to filter by: \\"verified\\", \\"unverified\\", \\"likely to engage\\", \\"unavailable\\""},"q_keywords":{"type":"string","required":false,"visibility":"user-or-llm","description":"Keywords to search for"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination, default 1 (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, default 25, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_sequence_add_contacts":{"id":"apollo_sequence_add_contacts","name":"Apollo Add Contacts to Sequence","description":"Add contacts to an Apollo sequence","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"sequence_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the sequence to add contacts to (e.g., \\"seq_abc123\\")"},"contact_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of contact IDs to add to the sequence (e.g., [\\"con_abc123\\", \\"con_def456\\"]). Either contact_ids or label_names must be provided."},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of label names to identify contacts to add to the sequence. Either contact_ids or label_names must be provided."},"send_email_from_email_account_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the email account to send from. Use the Get Email Accounts operation to look this up."},"send_email_from_email_address":{"type":"string","required":false,"visibility":"user-only","description":"Specific email address to send from within the email account."},"sequence_no_email":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if they have no email address"},"sequence_unverified_email":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts with unverified email addresses"},"sequence_job_change":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts who recently changed jobs"},"sequence_active_in_other_campaigns":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts active in other campaigns"},"sequence_finished_in_other_campaigns":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts who finished other campaigns"},"sequence_same_company_in_same_campaign":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if others from the same company are in the sequence"},"contacts_without_ownership_permission":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts without ownership permission"},"add_if_in_queue":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if they are in the queue"},"contact_verification_skipped":{"type":"boolean","required":false,"visibility":"user-only","description":"Skip contact verification when adding"},"user_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the user performing the action"},"status":{"type":"string","required":false,"visibility":"user-only","description":"Initial status for added contacts: \\"active\\" or \\"paused\\""},"auto_unpause_at":{"type":"string","required":false,"visibility":"user-only","description":"ISO 8601 datetime to automatically unpause contacts"}},"hostedApiKey":"none"},"apollo_sequence_search":{"id":"apollo_sequence_search","name":"Apollo Search Sequences","description":"Search for sequences/campaigns in your team\'s Apollo account (master key required)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"q_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search sequences by name (e.g., \\"Outbound Q1\\", \\"Follow-up\\")"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_task_create":{"id":"apollo_task_create","name":"Apollo Create Task","description":"Create one or more tasks in Apollo (one task per contact_id, master key required)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"user_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the Apollo user the task is assigned to"},"contact_ids":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of contact IDs. One task is created per contact."},"priority":{"type":"string","required":false,"visibility":"user-or-llm","description":"Task priority: \\"high\\", \\"medium\\", or \\"low\\" (defaults to \\"medium\\")"},"due_at":{"type":"string","required":true,"visibility":"user-or-llm","description":"Due date/time in ISO 8601 format (e.g., \\"2024-12-31T23:59:59Z\\")"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task type: \\"call\\", \\"outreach_manual_email\\", \\"linkedin_step_connect\\", \\"linkedin_step_message\\", \\"linkedin_step_view_profile\\", \\"linkedin_step_interact_post\\", or \\"action_item\\""},"status":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task status: \\"scheduled\\", \\"completed\\", or \\"skipped\\""},"note":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-form note providing context for the task"}},"hostedApiKey":"none"},"apollo_task_search":{"id":"apollo_task_search","name":"Apollo Search Tasks","description":"Search for tasks in Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"task_due_at\\" or \\"task_priority\\""},"open_factor_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Filter by status. Common values: [\\"task_types\\"] for open tasks, [\\"task_completed_at\\"] for completed tasks."},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"appconfig_create_application":{"id":"appconfig_create_application","name":"AppConfig Create Application","description":"Create an application in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the application to create"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the application"}},"hostedApiKey":"none"},"appconfig_create_configuration_profile":{"id":"appconfig_create_configuration_profile","name":"AppConfig Create Configuration Profile","description":"Create a configuration profile in an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to create the configuration profile in"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the configuration profile"},"locationUri":{"type":"string","required":true,"visibility":"user-or-llm","description":"Where the configuration is stored. Use \\"hosted\\" for AppConfig-hosted configurations, or an SSM/S3 URI"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the configuration profile"},"retrievalRoleArn":{"type":"string","required":false,"visibility":"user-or-llm","description":"ARN of an IAM role to retrieve the configuration (required for non-hosted URIs)"},"type":{"type":"string","required":false,"visibility":"user-or-llm","description":"Profile type: AWS.Freeform (default) or AWS.AppConfig.FeatureFlags"}},"hostedApiKey":"none"},"appconfig_create_environment":{"id":"appconfig_create_environment","name":"AppConfig Create Environment","description":"Create an environment for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to create the environment in"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the environment to create"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the environment"}},"hostedApiKey":"none"},"appconfig_create_hosted_configuration_version":{"id":"appconfig_create_hosted_configuration_version","name":"AppConfig Create Hosted Configuration Version","description":"Create a new hosted configuration version for an AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to add the version to"},"content":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration content (e.g., a JSON or YAML document)"},"contentType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Content type of the configuration (e.g., application/json, text/plain)"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the configuration version"},"latestVersionNumber":{"type":"number","required":false,"visibility":"user-or-llm","description":"The version number of the latest version, used for optimistic concurrency"},"versionLabel":{"type":"string","required":false,"visibility":"user-or-llm","description":"A user-defined label for the configuration version"}},"hostedApiKey":"none"},"appconfig_delete_application":{"id":"appconfig_delete_application","name":"AppConfig Delete Application","description":"Delete an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to delete"}},"hostedApiKey":"none"},"appconfig_delete_configuration_profile":{"id":"appconfig_delete_configuration_profile","name":"AppConfig Delete Configuration Profile","description":"Delete an AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to delete"}},"hostedApiKey":"none"},"appconfig_delete_environment":{"id":"appconfig_delete_environment","name":"AppConfig Delete Environment","description":"Delete an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to delete"}},"hostedApiKey":"none"},"appconfig_delete_hosted_configuration_version":{"id":"appconfig_delete_hosted_configuration_version","name":"AppConfig Delete Hosted Configuration Version","description":"Delete a specific hosted configuration version from an AppConfig profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID that owns the version"},"versionNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The version number to delete"}},"hostedApiKey":"none"},"appconfig_get_application":{"id":"appconfig_get_application","name":"AppConfig Get Application","description":"Get details about a single AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to retrieve"}},"hostedApiKey":"none"},"appconfig_get_configuration":{"id":"appconfig_get_configuration","name":"AppConfig Get Configuration","description":"Retrieve the latest deployed configuration for an AppConfig application, environment, and profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID or name to retrieve configuration for"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID or name to retrieve configuration for"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID or name to retrieve"}},"hostedApiKey":"none"},"appconfig_get_configuration_profile":{"id":"appconfig_get_configuration_profile","name":"AppConfig Get Configuration Profile","description":"Get details about a single AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to retrieve"}},"hostedApiKey":"none"},"appconfig_get_deployment":{"id":"appconfig_get_deployment","name":"AppConfig Get Deployment","description":"Get details about a specific AWS AppConfig deployment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployment"},"deploymentNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The sequence number of the deployment"}},"hostedApiKey":"none"},"appconfig_get_environment":{"id":"appconfig_get_environment","name":"AppConfig Get Environment","description":"Get details about a single AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to retrieve"}},"hostedApiKey":"none"},"appconfig_get_hosted_configuration_version":{"id":"appconfig_get_hosted_configuration_version","name":"AppConfig Get Hosted Configuration Version","description":"Retrieve a specific hosted configuration version from an AppConfig profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to read the version from"},"versionNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The version number to retrieve"}},"hostedApiKey":"none"},"appconfig_list_applications":{"id":"appconfig_list_applications","name":"AppConfig List Applications","description":"List applications in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of applications to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_configuration_profiles":{"id":"appconfig_list_configuration_profiles","name":"AppConfig List Configuration Profiles","description":"List configuration profiles for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profiles"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of configuration profiles to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_deployment_strategies":{"id":"appconfig_list_deployment_strategies","name":"AppConfig List Deployment Strategies","description":"List deployment strategies available in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of deployment strategies to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_deployments":{"id":"appconfig_list_deployments","name":"AppConfig List Deployments","description":"List deployments for an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployments"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployments"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of deployments to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_environments":{"id":"appconfig_list_environments","name":"AppConfig List Environments","description":"List environments for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environments"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of environments to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_hosted_configuration_versions":{"id":"appconfig_list_hosted_configuration_versions","name":"AppConfig List Hosted Configuration Versions","description":"List hosted configuration versions for an AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to list versions for"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of versions to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_start_deployment":{"id":"appconfig_start_deployment","name":"AppConfig Start Deployment","description":"Start deploying a configuration version to an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to deploy in"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to deploy to"},"deploymentStrategyId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The deployment strategy ID to use"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to deploy"},"configurationVersion":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration version to deploy"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the deployment"}},"hostedApiKey":"none"},"appconfig_stop_deployment":{"id":"appconfig_stop_deployment","name":"AppConfig Stop Deployment","description":"Stop an in-progress AWS AppConfig deployment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployment"},"deploymentNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The sequence number of the deployment to stop"}},"hostedApiKey":"none"},"appconfig_update_application":{"id":"appconfig_update_application","name":"AppConfig Update Application","description":"Update the name or description of an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the application"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the application"}},"hostedApiKey":"none"},"appconfig_update_configuration_profile":{"id":"appconfig_update_configuration_profile","name":"AppConfig Update Configuration Profile","description":"Update the name, description, or retrieval role of an AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the configuration profile"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the configuration profile"},"retrievalRoleArn":{"type":"string","required":false,"visibility":"user-or-llm","description":"New ARN of the IAM role used to retrieve the configuration"}},"hostedApiKey":"none"},"appconfig_update_environment":{"id":"appconfig_update_environment","name":"AppConfig Update Environment","description":"Update the name or description of an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the environment"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the environment"}},"hostedApiKey":"none"},"arxiv_get_author_papers":{"id":"arxiv_get_author_papers","name":"ArXiv Get Author Papers","description":"Search for papers by a specific author on ArXiv.","version":"1.0.0","params":{"authorName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Author name to search for"},"maxResults":{"type":"number","required":false,"visibility":"user-only","description":"Maximum number of results to return (default: 10, max: 2000)"}},"hostedApiKey":"none"},"arxiv_get_paper":{"id":"arxiv_get_paper","name":"ArXiv Get Paper","description":"Get detailed information about a specific ArXiv paper by its ID.","version":"1.0.0","params":{"paperId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ArXiv paper ID (e.g., \\"1706.03762\\")"}},"hostedApiKey":"none"},"arxiv_search":{"id":"arxiv_search","name":"ArXiv Search","description":"Search for academic papers on ArXiv by keywords, authors, titles, or other fields.","version":"1.0.0","params":{"searchQuery":{"type":"string","required":true,"visibility":"user-or-llm","description":"The search query to execute"},"searchField":{"type":"string","required":false,"visibility":"user-only","description":"Field to search in: all, ti (title), au (author), abs (abstract), co (comment), jr (journal), cat (category), rn (report number)"},"maxResults":{"type":"number","required":false,"visibility":"user-only","description":"Maximum number of results to return (default: 10, max: 2000)"},"sortBy":{"type":"string","required":false,"visibility":"user-only","description":"Sort by: relevance, lastUpdatedDate, submittedDate (default: relevance)"},"sortOrder":{"type":"string","required":false,"visibility":"user-only","description":"Sort order: ascending, descending (default: descending)"}},"hostedApiKey":"none"},"asana_add_comment":{"id":"asana_add_comment","name":"Asana Add Comment","description":"Add a comment (story) to an Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana task GID (numeric string)"},"text":{"type":"string","required":true,"visibility":"user-or-llm","description":"The text content of the comment"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_add_followers":{"id":"asana_add_followers","name":"Asana Add Followers","description":"Add one or more followers to an Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana task (numeric string)"},"followers":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of user GIDs to add as followers to the task"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_project":{"id":"asana_create_project","name":"Asana Create Project","description":"Create a new project in an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) where the project will be created"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the project"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the project"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_section":{"id":"asana_create_section","name":"Asana Create Section","description":"Create a new section in an Asana project","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana project (numeric string) to add the section to"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the section"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_subtask":{"id":"asana_create_subtask","name":"Asana Create Subtask","description":"Create a subtask under an existing Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the parent Asana task (numeric string)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the subtask"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the subtask"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"User GID to assign the subtask to"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_task":{"id":"asana_create_task","name":"Asana Create Task","description":"Create a new task in Asana","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) where the task will be created"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the task"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the task"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"User GID to assign the task to"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_delete_task":{"id":"asana_delete_task","name":"Asana Delete Task","description":"Delete an Asana task by its GID (moves it to the trash)","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana task to delete (numeric string)"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_project":{"id":"asana_get_project","name":"Asana Get Project","description":"Retrieve a single Asana project by its GID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana project GID (numeric string) to retrieve"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_projects":{"id":"asana_get_projects","name":"Asana Get Projects","description":"Retrieve all projects from an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to retrieve projects from"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_task":{"id":"asana_get_task","name":"Asana Get Task","description":"Retrieve a single task by GID or get multiple tasks with filters","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":false,"visibility":"user-or-llm","description":"The globally unique identifier (GID) of the task. If not provided, will get multiple tasks."},"workspace":{"type":"string","required":false,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to filter tasks (required when not using taskGid)"},"project":{"type":"string","required":false,"visibility":"user-or-llm","description":"Asana project GID (numeric string) to filter tasks"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of tasks to return (default: 50)"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_list_sections":{"id":"asana_list_sections","name":"Asana List Sections","description":"List all sections in an Asana project","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana project (numeric string) to list sections from"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_list_workspaces":{"id":"asana_list_workspaces","name":"Asana List Workspaces","description":"List all Asana workspaces and organizations the authenticated user belongs to","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_search_tasks":{"id":"asana_search_tasks","name":"Asana Search Tasks","description":"Search for tasks in an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to search tasks in"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Text to search for in task names"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter tasks by assignee user GID"},"projects":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of Asana project GIDs (numeric strings) to filter tasks by"},"completed":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Filter by completion status"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_update_task":{"id":"asana_update_task","name":"Asana Update Task","description":"Update an existing task in Asana","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana task GID (numeric string) of the task to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated name for the task"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated notes or description for the task"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated assignee user GID"},"completed":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Mark task as completed or not completed"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"ashby_add_candidate_tag":{"id":"ashby_add_candidate_tag","name":"Ashby Add Candidate Tag","description":"Adds a tag to a candidate in Ashby and returns the updated candidate.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to add the tag to"},"tagId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the tag to add"}},"hostedApiKey":"none"},"ashby_anonymize_candidate":{"id":"ashby_anonymize_candidate","name":"Ashby Anonymize Candidate","description":"Remove personally identifiable information from an Ashby candidate while retaining the candidate record and its applications. This operation does not delete the candidate. Requires the candidatesWrite permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"UUID of the candidate to anonymize"}},"hostedApiKey":"none"},"ashby_change_application_source":{"id":"ashby_change_application_source","name":"Ashby Change Application Source","description":"Changes the source attributed to an existing application, so programmatically created applications report correctly on the recruiting side. Requires the candidatesWrite permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"UUID of the application whose source should change"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to attribute the application to, as returned by List Sources. Omit only when unsetSource is true."},"unsetSource":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Set true to deliberately clear the application source. Required to unset, so that a missing or empty sourceId cannot wipe attribution by accident."}},"hostedApiKey":"none"},"ashby_change_application_stage":{"id":"ashby_change_application_stage","name":"Ashby Change Application Stage","description":"Moves an application to a different interview stage. Requires an archive reason when moving to an Archived stage.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the application to update the stage of"},"interviewStageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the interview stage to move the application to"},"archiveReasonId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Archive reason UUID. Required when moving to an Archived stage, ignored otherwise"},"archiveEmail":{"type":"json","required":false,"visibility":"user-or-llm","description":"Archive email configuration with communicationTemplateId and optional sendAt ISO 8601 timestamp. Pass null or omit to send no archive email."}},"hostedApiKey":"none"},"ashby_create_application":{"id":"ashby_create_application","name":"Ashby Create Application","description":"Creates a new application for a candidate on a job. Optionally specify interview plan, stage, source, and credited user.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to consider for the job"},"jobId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the job to consider the candidate for"},"interviewPlanId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the interview plan to use (defaults to the job default plan)"},"interviewStageId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the interview stage to place the application in, or FirstPreInterviewScreen (defaults to the first Lead stage)"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to set on the application"},"creditedToUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the user the application is credited to"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to set as the application creation date (defaults to now)"},"applicationHistory":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional documented application history entries to create with the application"}},"hostedApiKey":"none"},"ashby_create_candidate":{"id":"ashby_create_candidate","name":"Ashby Create Candidate","description":"Creates a new candidate record in Ashby.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"The candidate full name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary email address for the candidate"},"phoneNumber":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number for the candidate"},"linkedInUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"LinkedIn profile URL"},"githubUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"GitHub profile URL"},"website":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal website URL"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to attribute the candidate to"},"creditedToUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the Ashby user to credit with sourcing this candidate"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"Backdated creation timestamp in ISO 8601 (e.g. 2024-01-01T00:00:00Z). Defaults to now."},"alternateEmailAddresses":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of additional email address strings to add to the candidate, e.g. [\\"a@x.com\\",\\"b@y.com\\"]"},"location":{"type":"json","required":false,"visibility":"user-or-llm","description":"Candidate location object with optional city, region, and country"}},"hostedApiKey":"none"},"ashby_create_note":{"id":"ashby_create_note","name":"Ashby Create Note","description":"Creates a note on a candidate in Ashby. Supports plain text and HTML content (bold, italic, underline, links, lists, code).","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"onBehalfOfUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Active Ashby user UUID to attribute this mutation to; the API key must permit on-behalf-of calls"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to add the note to"},"note":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note content. If noteType is text/html, supports: , , , ,