# Amazon Devices Builder Tools for AI

**English** | [日本語](README.ja.md)

> 📢 **What's new:** to see the changes in each version, open the [Code tab](https://www.npmjs.com/package/@amazon-devices/amazon-devices-buildertools-mcp?activeTab=code) on npm and select `RELEASE_NOTES.md`.

Amazon Devices Builder Tools for AI is a suite of AI-powered development tools for Fire TV - including ADBT Model Context Protocol (MCP) Server and Agent skills. These capabilities make your coding agents such as Claude, Cursor, and Kiro aware of specialized Fire TV knowledge and best practices, eliminating guesswork from development and debugging tasks.

## Why Amazon Devices Builder Tools?

Coding agents such as Claude, Cursor, and Kiro are excellent at writing code, but Amazon device development is **device-specific, multi-step, and environment-heavy**. Building a Vega app, migrating a FireOS (FOS) app to Vega, measuring performance against real KPIs, following the correct debugging flow, and applying platform rules each depend on Vega and FireOS knowledge and procedures that live outside a general model's training data.

Amazon Devices Builder Tools supplies that missing layer as **purpose-built tools + skills**, grounded in curated, versioned Amazon knowledge so your agent follows an Amazon-authored procedure instead of reconstructing one from a fixed training snapshot. This covers the high-value, device-specific work a general model handles least reliably: app migration (FireOS → Vega), real KPI performance measurement, crash debugging, platform best practices and environment setup, and grounded answers from current documentation each documented in detail below.

Pair the Builder Tools with your coding agent to give it Vega and FireOS expertise it doesn't have on its own Amazon-authored workflows and current documentation, so it spends less time guessing and more time shipping.

## Capabilities

The Amazon Devices Builder Tools provides the following capabilities:

| App Dev Area                   | Description                                                                                      | Example Prompts                                                                                                                                                                                                                                                                                                                      |
| ------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Onboarding**                 | Onboard to Vega app development using AI agents with setup guidance and Q&A support              | <ul><li>`Help me set up Vega app project and test my VPKG on Virtual Device?`</li><li>`Help me setup Vega SDK?`</li><li>`Build and run the app on Virtual device/Connected Device.`</li><li>`Can you tell me about vega app development?`</li><li>`What is the Vega CLI command for measuring cpu usage on a Vega device?`</li></ul> |
| **Performance**                | Debug and fix Time to First Frame (TTFF), Time to Fully Drawn (TTFD), and UI re-rendering issues | <ul><li>`Why is the TTFF higher for my Vega app?`</li><li>`Can you help me debug and fix Time to First Frame issue in my Vega app?`</li><li>`Why is the TTFD higher for my Vega app?`</li><li>`Can you help me minimize unnecessary re-renders in my app?`</li><li>`Find any re-rendering issues in my app.`</li></ul>               |
| **Performance Best Practices** | Analyze components and code to ensure they follow React Native Vega performance best practices   | <ul><li>`Help me analyze if this component is following React Native Vega performance best practices`</li></ul>                                                                                                                                                                                                                      |
| **Best Practices**             | Validate manifest files and implement Vega components following best practices                   | <ul><li>`Can you help me upgrade my MovieCarousel.tsx from Carousel V1 to V2?`</li><li>`Can you help me implement Carousel?`</li><li>`Can you validate my manifest file and update as needed for my app?`</li></ul>                                                                                                                  |
| **UI Development**             | Create Vega app UI from screenshots and design mockups                                           | <ul><li>`I have an image at {image_path}. Create a Vega app by creating a new folder using the sample template, update the sample test app to match the image, and confirm that the app can be built and run.`</li></ul>                                                                                                             |
| **Focus Management**           | Implement D-Pad navigation and focus management for TV interfaces                                | <ul><li>`Can you create an app with 2 buttons to show case focus management?`</li></ul>                                                                                                                                                                                                                                              |
| **Accessibility**              | Implementation guidance for Fire TV accessibility in Vega React Native apps — the semantics assistive technologies use to present each control: labels, roles, states, hints, screen and container context, and live regions. | <ul><li>`How do I label an icon-only button in Vega React Native app so VoiceView announces it?`</li><li>`What role should I use for a custom checkbox in my Vega React Native app?`</li><li>`How do I announce a loading state change to VoiceView in my Vega React Native app?`</li></ul> |
| **Captions & Audio Description** | Implementation guidance for honoring the OS caption and audio-description settings in Vega apps, for both VegaScript and WebView players. | <ul><li>`How do I honor the user's caption settings in my Vega video app?`</li><li>`How do I auto-select the audio description track based on the OS setting?`</li></ul> |
| **Give Feedback**              | Provide feedback to Amazon about your experience with the MCP                                    | <ul><li>`I want to provide feedback`</li><li>`How can I provide vega mcp feedback?`</li></ul>                                                                                                                                                                                                                                        |
| **Crash Analysis**              | Diagnose JavaScript, Native, LMK, and ANR crashes with automated ACR analysis                    | <ul><li>`Why did my app crash?`</li><li>`Help me analyze this ACR file /path/to/crash.acr`</li></ul>                                                                                                                                                                                                                                                |
| **Key Input Latency**          | Diagnose and resolve key input latency issues through JS Thread performance and input event analysis | <ul><li>`Why is my app responding slowly to key presses?`</li><li>`Help me diagnose key input latency in my Vega app`</li><li>`My button clicks feel laggy, can you help?`</li></ul>                                                                                                                                                 |
| **UI Fluidity**                | Diagnose UI fluidity KPI failures through component re-rendering and CPU performance analysis    | <ul><li>`My app's UI fluidity score is low, help me diagnose it`</li><li>`Help me fix frame drops and jank in my Vega app`</li><li>`Why is scrolling not smooth in my app?`</li></ul>                                                                                                                                                |
| **React Native DevTools** *(RN 0.83+)* | Bring up React Native DevTools on-device (Profiler, Network, Performance, and more) to debug re-render, UI-fluidity, and network issues — with version-aware routing, resumable bring-up, and recommended fixes | <ul><li>`Which component is re-rendering?`</li><li>`Open RN DevTools for my app`</li><li>`Why is the app janky?`</li><li>`Help me profile my app`</li></ul> |
| **App Porting** *(Beta)*       | Port FireOS apps to Vega or wrap a web URL as a Vega app, with auto-detection of app type. Supports four input paths: FOS WebView → Vega WebView, FOS React Native → VegaScript, FOS Native (Java/Kotlin) → VegaScript *(partial support)*, and Web URL → Vega WebView. | <ul><li>`Port my TV app to Vega`</li><li>`Help me migrate my FireOS app at /path/to/fos-app to Vega`</li><li>`Port my FOS React Native app to VegaScript`</li><li>`Convert my FOS WebView app to a Vega Web App`</li><li>`Wrap https://example.com as a Vega WebView app`</li></ul> |
| **React Native Upgrade**       | AI-assisted, interactive turn-based workflow to upgrade React Native versions (e.g. 0.72 → 0.83) in Vega apps. Detects current versions, generates a prioritized TODO plan, tracks progress with checkpoints, and applies changes one at a time with stop points for review. | <ul><li>`Upgrade my Vega app from React Native 0.72 to 0.83`</li><li>`Help me migrate my React Native for Vega app to the latest version`</li><li>`Start an AI-assisted React Native upgrade for /path/to/my-vega-app`</li></ul> |
| **Fire TV Android SDK Upgrade** | Assess and upgrade third-party Fire TV apps across Android API levels 30 through 36, one level and one behavioral change at a time, with evidence review and explicit approval before each edit. | <ul><li>`Upgrade my Fire TV app from targetSdkVersion 30 to 35`</li><li>`What changes when my Fire TV app targets Android API 35?`</li></ul> |
| **Scalable UI Audit** | Audit a Fire TV / Android TV app for Scalable UI readiness on non-1080p canvases (720p/900p/1440p), flagging raw-pixel sizing, absolute-position, and canvas-blind image-decode issues that break up- or down-scaling | <ul><li>`Audit my Fire TV app for Scalable UI readiness`</li><li>`Will my app's layout scale to a 1440p canvas?`</li><li>`Find hardcoded pixel sizes that break on 720p`</li></ul> |
| **Appstore IAP Integration**   | Integrate and test Amazon Appstore In-App Purchasing (IAP) SDK in Vega apps                      | <ul><li>`Help me integrate IAP in my Vega app`</li><li>`How do I set up In-App Purchasing for my Vega app?`</li><li>`Help me test IAP in my Vega app`</li></ul>                                                                                                                                                                      |
| **FireTV Content Personalization Integration** | Integrate and test Content Personalization feature in Vega apps | <ul><li>`Help me integrate Content Personalization in my Vega app`</li><li>`Help me test Continue Watching row on FireTV`</li></ul> |
| **FireTV Content Launcher Integration** | Integrate Content Launcher (Universal Search and Browse), Account Login, and voice transport controls in Vega apps | <ul><li>`Help me integrate Content Launcher in my Vega app`</li><li>`Help me test Content Launcher on FireTV`</li></ul> |
| **FireTV Live TV Integration** | Integrate and test Live TV (Linear channels) in Vega apps — EPG channel sync and channel tuning/playback | <ul><li>`Help me integrate Live TV in my Vega app`</li><li>`Help me test Live TV on FireTV`</li></ul> |
| **FireTV EMBER Catalog Integration** | Generate and validate an additive EMBER catalog adapter from an existing content system | <ul><li>`Help me build an EMBER catalog adapter for my system`</li><li>`Help me validate my EMBER catalog output`</li></ul> |
| **SDK & CLI**                  | Install/update SDK and efficiently run CLI tools via spec-driven CLI                             | <ul><li>`Install/update SDK from AI agents`</li><li>`Build my app`</li><li>`Run my app on virtual device`</li><li>`Run my app on physical device`</li><li>`Run KPI Visualizer and get performance results`</li></ul>                                                                                                                 |
| **Remote Knowledge Search**    | Search and retrieve documentation from developer.amazon.com and community.amazondeveloper.com to get AI assistance on any documented app development topic beyond curated local workflows | <ul><li>`How can I do a beta test of my Vega app?`</li><li>`What are the accessibility guidelines for Vega apps?`</li><li>`How do I submit my app to the Amazon Appstore?`</li><li>`What DRM options are available for Vega?`</li></ul>                                                                                                |
| **Media Playback**               | Add media playback to Vega apps using W3C MSE/EME APIs with adaptive streaming (HLS/DASH), DRM support, Shaka Player integration, headless playback architecture, and media controls | <ul><li>`Add a simple media playback implementation to my Vega app at /path/to/my-vega-app using https://example.com/stream.m3u8`</li><li>`Add DRM-protected playback to my app using Widevine with license URL https://license.example.com`</li><li>`Implement headless media playback architecture in my Vega app to decouple playback from the UI thread`</li><li>`Update Shaka Player from version x to version y in my Vega media playback app`</li><li>`Add captions and subtitle support to my media playback app`</li></ul> |

## Skills

Skills are modular instruction packages installed to the agent's local skills directory via `init-context`. They provide domain-specific guidance that agents can activate on demand without MCP round-trips.

| Skill | Description |
|---|---|
| amazon-devices-android-sdk-uplevel | Routes third-party Fire TV Android `targetSdkVersion` upgrades through focused API guidance and an interactive, approval-gated workflow |
| amazon-devices-scalable-ui-audit | Audits an Android TV / Fire TV app for Scalable UI readiness on any non-1080p canvas (720p/900p/1440p, up- and down-scale). Read-only fan-out scan across XML, Compose, code-side sizing, and React Native styles; flags raw-pixel and canvas-blind image-decode defects and recommends fixes |
| amazon-devices-vega-app-manifest | Required manifest.toml configuration for Vega apps including package identifiers, capabilities, and privileges |
| amazon-devices-vega-app-migration | Migrate an existing Fire TV / FireOS app to a React Native for Vega app |
| amazon-devices-vega-app-performance | Performance optimization, KPI targets, and diagnostics for Vega applications |
| amazon-devices-vega-audio-description | Read the OS "audio description preferred" setting so a Vega app auto-selects a described audio track |
| amazon-devices-vega-best-practices | Performance guidelines, development workflow, and architecture recommendations for Vega apps |
| amazon-devices-vega-build-and-run | Complete guide for building, deploying, and running React Native for Vega applications |
| amazon-devices-vega-caption-settings | Read the OS closed-captioning settings and render app-drawn captions that match them (on/off, size, color, font, edge, opacity) |
| amazon-devices-vega-developer-mode-init | Enable Developer Mode on Fire TV (Vega OS) devices for developer shell access and VDA connectivity |
| amazon-devices-vega-focus-management | Cartesian focus management for D-Pad navigation with TVFocusGuideView and FocusManager |
| amazon-devices-vega-matter-casting | Add Matter Casting to a Vega content app so a phone can launch content and control playback, using Content Launcher, Media Controls, and Account Login clusters |
| amazon-devices-vega-media-player | W3C MSE/EME standard media playback with DRM support, adaptive streaming, and VideoPlayer component |
| amazon-devices-vega-navigation | Stack, tab, and drawer navigation using Amazon-specific react-navigation packages |
| amazon-devices-vega-rn-upgrade | Interactive, turn-based workflow to upgrade React Native for Vega apps to a newer RN version (e.g. 0.72 → 0.83) with TODO plan, checkpoint tracking, and stop points before each change |
| amazon-devices-vega-setup-sdk | Installs and configures the Vega SDK with prerequisite checks and verification |
| amazon-devices-vega-ui-components | High performance Vega UI Components with native bindings such as Carousel |
| amazon-devices-vega-webview-audio-description | Bridge the OS audio-description setting from a Vega host into a WebView so the page's own player selects the described track |
| amazon-devices-vega-webview-caption-settings | Bridge the OS caption settings into a WebView and render app-drawn captions that match them |
| vega-multi-tv-migration | Amazon developer led community skill to migrate Vega apps to a cross-device React Native monorepo including Fire OS |

## Get started

Run the following command in your **Bash/ZSH terminal** (not within agent chat window) to install Amazon Devices Builder Tools for AI and the context document for your preferred AI agent. Then start a new chat session in your agent, to begin using the tools.

```bash
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context
```

> 💡 Two guidance modes: by default `init-context` installs a steering document into your workspace, which your AI agent picks up automatically in every session in that workspace. Alternatively, pass `--install-agent` to install **adbt-dev** — a dedicated, opt-in Amazon Devices agent that provides the same guidance but only when you explicitly invoke adbt-dev, with no always-on steering doc. See [adbt-dev](#adbt-dev-optional-agent-registration) below.

This command supports both **interactive** and **non-interactive** modes:

**Interactive Mode (default):**

1. **Display available AI agents** and their context file requirements
2. **Let you select your preferred AI agent** from the supported list
3. **Update selected agent's MCP settings** to configure the Amazon Devices Builder Tools MCP server
4. **Ask for context installation directory** (defaults to current working directory)
5. **Handle existing context files** by offering to merge or update content
6. **Create the appropriate context file** in the correct location for your chosen AI agent

**Non-Interactive Mode:**
Use command-line options to skip prompts and automate the setup process.

### Command Line Options

```bash
init-context [options]

Options:
  -a, --agent <type>               Target AI agent (cursor, cline, kiro, claude-code-cli,
                                   github-copilot, other)
  -p, --context-document-path      Path to save context document
  -d, --skip-context-document      Skip context document installation (MCP config only)
  -m, --skip-mcp-config            Skip MCP configuration (context document only)
  -c, --clean                      Clean opposing artifacts before install (agent mode: delete
                                   steering; steering mode: delete agent file)
      --install-agent              Install adbt-dev, a dedicated Amazon Devices agent, for the
                                   selected host instead of the always-on steering doc (opt-in;
                                   see "adbt-dev" below)
  -f, --force                      Skip all confirmation prompts and force overwrite
      --update                     Refresh only what is already installed for --agent, without
                                   prompts (see "Updating installed context" below)
  -h, --help                       Show help for init-context command
```

### Example Usage

```bash
# Navigate to your project directory
cd my-vega-project

# Interactive mode (default)
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context

# Non-interactive with specific agent
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent cursor --force
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context -a cursor -f

# Install the adbt-dev for the selected host (instead of the steering doc)
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent kiro --install-agent

# MCP config only (skip context document)
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent cursor --skip-context-document
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context -a cursor -d

# Context document only with custom path (skip MCP config)
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent kiro --context-document-path ./docs --skip-mcp-config
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context -a kiro -p ./docs -m

# Show help
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --help
```

### Updating installed context

When a new release is available, `--update` refreshes exactly what `init-context` already installed for an agent, with no prompts:

```bash
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent kiro --update

# Steering doc in a custom folder
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent cursor --update --context-document-path "./docs"
```

`--update` refreshes, only where installed:

- The Amazon Devices block in the steering doc (left untouched when already current). A legacy `react_native_for_vega_get_started.md` is migrated: the new steering doc is written in the same folder, then the legacy file is backed up to `.bak`.
- ADBT skills and their licenses (skills no longer shipped are removed), and the Amazon Developers led community skills.
- The adbt-dev agent file.
- The MCP entry: the legacy `vega-devtools-mcp` entry is removed and the current entry is added only if absent. An existing `amazon-devices-buildertools-mcp` entry is never modified, so custom launchers and a disabled state are kept.

It never sets up a steering doc, agent file or MCP entry you don't already have (current or legacy), never switches between steering and agent mode, and never touches `.adbt-config.json`. A corrupted file is skipped with a warning and the other artifacts are still refreshed. The command prints a per-artifact summary and exits non-zero only if a refresh failed. `--update` requires `--agent` and can't be combined with `--install-agent`, `--clean`, `--force`, `--skip-context-document` or `--skip-mcp-config`.

### Using with Other AI Agents

If your AI agent isn't in the supported list, select **"Other/Custom Agent"** which provides:

- **View full content**: Display the complete context for manual copying
- **Manual setup**: Copy the content to your agent's configuration directory

> ℹ️ Important: Start the MCP Server from Agent's MCP config, if not already started - check your current running MCPs to ensure the amazon-devices-buildertools-mcp is listed as running/connected.

## adbt-dev (optional agent registration)

By default, `init-context` installs a steering/context document that is always active in your sessions. As an alternative, you can install **adbt-dev** — a dedicated, opt-in agent that provides Amazon Devices guidance only when you explicitly invoke it, with no always-on steering doc.

Installing the agent is an **elective** choice: pass the `--install-agent` option to `init-context`. Without it, `init-context` behaves as before (steering doc installed, no agent).

```bash
# Install the adbt-dev for your selected host instead of the steering doc
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent kiro --install-agent
```

When `--install-agent` is set, `init-context`:

1. Registers the agent for the selected host (writes the host-native agent file)
2. Skips steering doc installation (guidance comes from the agent on demand)
3. Removes any existing ADBT steering doc for that host (backed up to `.bak`, or hard-deleted when combined with `--clean`)

### Per-host output files

Depending on the selected host, the agent file is written to the host's agent discovery directory:

| Host | Output file | Format |
|------|------------|--------|
| Kiro | `~/.kiro/agents/adbt-dev.json` | JSON agent spec |
| Claude Code | `~/.claude/agents/adbt-dev.md` | YAML frontmatter + markdown |
| GitHub Copilot | `~/.copilot/agents/adbt-dev.md` | YAML frontmatter + markdown |
| Cursor, Codex, OpenCode, Cline, Gemini CLI | `~/.agents/adbt-dev.md` | Markdown reference |

### How to invoke the agent

After registration:

- **Kiro:** `/agent adbt-dev`
- **Claude Code:** `claude --agent adbt-dev`
- **GitHub Copilot:** `copilot` → `/agent adbt-dev`
- **AGENTS.md hosts (Cursor, Codex, OpenCode, Cline, Gemini CLI):** reference `~/.agents/adbt-dev.md` from your project's `AGENTS.md`

### Switching between agent and steering modes

- To switch **from** steering **to** agent mode cleanly, add `--clean` so the existing steering doc is hard-deleted rather than backed up:

  ```bash
  npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent kiro --force --install-agent --clean
  ```

- To switch **back** from agent mode to steering mode, run `init-context` without `--install-agent` and add `--clean` to remove the agent file first:

  ```bash
  npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context --agent kiro --force --clean
  ```

- To remove **all** ADBT artifacts for a host (agent, steering, MCP config), use `clean-context`:

  ```bash
  npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest clean-context --agent kiro --force
  ```

## Platform Configuration

Amazon Devices Builder Tools automatically detects whether your project targets **Vega OS** or **Fire OS** by checking for standard indicators (e.g., `@amazon-devices/` packages in `dependencies` for Vega, `build.gradle` for Fire OS). In most cases, no configuration is needed.

### When to create a config file

Create a `.adbt-config.json` file at the root of your repository when:

- Your repo has a non-standard structure that confuses automatic detection
- You have a mono-repo containing both Vega and Fire OS code
- You want the agent to never ask which platform you're developing for

### Minimal example (single platform)

```json
{
  "platform": {
    "default": "vega_os"
  }
}
```

### Mono-repo example (path mappings)

```json
{
  "platform": {
    "default": "both",
    "paths": {
      "vega-os/": "vega_os",
      "fire-os/": "fire_os",
      "shared/": "both"
    }
  }
}
```

With path mappings, the agent automatically scopes documentation and tool responses based on which file you're working in — no prompts needed.

### Valid values

| Field | Required | Valid Values | Description |
|-------|----------|--------------|-------------|
| `platform` | Yes | Object | Container for platform configuration |
| `platform.default` | Yes | `"vega_os"`, `"fire_os"`, `"both"` | Default platform for the repo |
| `platform.paths` | No | Directory prefix → platform value | Per-directory overrides for mono-repos |

> ℹ️ For full details including longest-prefix matching and troubleshooting, ask the agent: "How does the platform config file work?"

## Usage

### Command Line Options

```bash
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest init-context       # Install Amazon Devices Builder Tools for AI and initialize context for AI agents
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest check-status       # Check setup status of AI agents
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest clean-context      # Remove all Amazon Devices context for a host
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest --version          # Show version information
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest -v                 # Show version information (alias)
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest --help             # Show help message
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest -h                 # Show help message (alias)
```

### Check Agent Setup Status

After installing the MCP server and context documents, you can verify your setup using the `check-status` command:

```bash
# Check all agents
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest check-status

# Check specific agent
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest check-status --agent kiro
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest check-status -a cursor

# Show help
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest check-status --help
```

**What it checks:**
- ✅ Context document installation status and version
- ✅ MCP configuration status
- ✅ Detection of legacy configurations
- ✅ Overall setup summary

**Example output:**

```
====================================================
🔍 Checking Agent Setup Status
====================================================

─────────────────────────────────────────────────────────────────────────────
Agent                  │ Context Document         │ MCP Configuration        
─────────────────────────────────────────────────────────────────────────────
Cursor                 │ ✅ v5.1                   │ ✅ Configured             
Kiro                   │ ✅ v5.1                   │ ✅ Configured             
─────────────────────────────────────────────────────────────────────────────

📊 Summary:
   Total agents checked: 2
   ✅ Fully configured: 2
   ⚠️  Partially configured: 0
   ❌ Not configured: 0
```

### Clean Context

To remove all Amazon Devices context for a specific AI agent host, use the `clean-context` command:

```bash
# Interactive mode (prompts for agent selection and confirmation)
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest clean-context

# Non-interactive cleanup for a specific agent
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest clean-context --agent kiro --force
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest clean-context -a kiro -f

# Show help
npx -y @amazon-devices/amazon-devices-buildertools-mcp@latest clean-context --help
```

**What it removes:**
- 🗑️ Agent discovery file (e.g., `~/.kiro/agents/adbt-dev.json`)
- 🗑️ Steering/context document (ADBT content only, or the entire file if solely ADBT)
- 🗑️ Legacy steering variants and `.bak` files
- 🗑️ MCP config entry (`amazon-devices-buildertools-mcp`)

**What it does NOT remove:**
- `.adbt-config.json` (project configuration)
- The MCP server package itself
- Skills (re-installed on next init-context; safe to leave)
- Other agents' configurations

### Verify Amazon Devices Builder Tools MCP is installed in your AI Agent

In your AI Agent's chat interface, run the following prompt

```
List the tools provided by Amazon Devices Builder Tools MCP
```

You should see a response that includes the following tools:

- analyze_perfetto_traces
- get_app_hot_functions
- list_documents
- read_asset
- read_document
- search_documentation
- symbolicate_acr

## MCP Tools

The Amazon Devices Builder Tools for AI provides the following tools to assist with Amazon Devices app development:

### 1. `analyze_perfetto_traces`

Analyze Vega platform traces using Perfetto trace processor to extract KPI metrics and related performance data. This tool helps diagnose performance issues and analyze app launch times.

**Parameters:**

- `traceFilePath` (required): Path to the trace file to analyze. Usually found in Vega performance data output directories with names like `iter_*_vs_trace`
- `queryType` (optional): Type of query to execute. Default: `kpi_analysis`
- `kpiType` (optional): Specific KPI type to analyze. Options: `ttff` (Time to First Frame), `ttfd` (Time to First Display), `all`. Default: `all`
- `customQuery` (optional): Custom PerfettoSQL query to execute (overrides queryType and kpiType if provided)
- `processNames` (optional): Additional process names to filter by
- `appProcessName` (optional): Main application process name to analyze (will be auto-detected if not provided)

**Example usage:**

```
Analyze the trace file at /path/to/iter_1_vs_trace
```

### 2. `get_app_hot_functions`

Reads and analyzes CPU trace files to identify hot functions (CPU-intensive operations) contributing to performance bottlenecks. This tool helps pinpoint which functions in your application are consuming the most CPU time, enabling targeted performance optimization.

**Parameters:**

- `traceDataFilePath` (required): Path to the trace data file from the Activity Monitor. Usually found in Vega performance data output directories with names like `iter_<iteration>_trace<epoch>-converted.json` (e.g., `iter_2_trace1766067380670018106-converted.json`)
- `limit` (optional): Maximum number of hot functions to return (default: 10)
- `useSelfTime` (optional): Flag to indicate whether to use self CPU time or total CPU time for sorting (default: false)
- `includeLibraryFunctions` (optional): Flag to indicate whether to include library functions (default: false)
- `startTimeOffset` (optional): Start time offset in seconds from trace beginning (e.g., 5.2 for analysis starting 5.2 seconds after trace start)
- `endOffsetSeconds` (optional): End time offset in seconds from trace beginning (e.g., 15.8 for analysis ending 15.8 seconds after trace start)

**Example usage:**

```
Analyze hot functions in the trace file at /path/to/iter_2_trace1766067380670018106-converted.json
```

or with time window filtering:

```
Analyze hot functions in /path/to/trace.json from 5 to 15 seconds with a limit of 20 functions
```

### 3. `list_documents`

List all available documents related to Amazon Devices app development. Returns name and description of available documents that can be retrieved using the `read_document` tool.

**Parameters:**

- `documentType` (optional): Filter documents by type. Valid values: `KB` (Knowledge Base), `PROMPT`, `STEERING`, `WORKFLOW`

**Example usage:**

```
List all available Vega documents
```

or

```
List documents of type KB
```

### 4. `read_asset`

Read assets referenced in Amazon Devices documentation. Assets are saved to a temporary location and the path is returned. Images can be viewed with
`fs_read` and scripts executed with the appropriate interpreter (e.g., `python3`)

**Parameters:**

- `asset_id` (required): Path of the asset to read (e.g., `assets/scripts/example.py` or `assets/images/diagram.png`)

**Example usage:**

```
Read the script assets/scripts/setup.sh and execute it
```

or

```
Read the image assets/images/architecture.png and describe what it shows
```

### 5. `read_document`

Read documents related to Amazon Devices app development. This tool provides access to comprehensive documentation about app development and debugging topics.

**Parameters:**

- `document_uri` (required): URI of the document to read. Accepts a local document name (e.g., `vega_cli_commands_reference.md`) or a developer.amazon.com URL.

**Example usage:**

```
Read the document react_native_for_vega_architecture.md
```

### 6. `search_documentation`

Search Vega development documentation using full-text search. Returns document URIs and relevant snippets matching the query. Use `read_document` with the returned URI to get full content.

**Parameters:**

- `query` (required): Search query string to find relevant documents

**Example usage:**

```
Search for documents about "performance optimization"
```

### 7. `symbolicate_acr`

Symbolicate ACR (Amazon Crash Report) files and create a report. Supports both GDB-based native crash symbolication and JavaScript stack trace symbolication.

**Parameters:**

- `acrFilePath` (required): Path to the ACR file to symbolicate
- `decodeMode` (required): `gdb` for native crashes (requires `debugFsPath` or `deviceId`), `js` for JavaScript stack traces
- `debugFsPath` (optional): Path to Debug Root FS. Used with `gdb` mode.
- `deviceId` (optional): Target device serial number to fetch Debug FS. Used with `gdb` mode.

**Example usage:**

```
Symbolicate the crash file at /path/to/crash.acr using JS mode
```

## MCP Prompts

> Check if your AI Agents supports MCP Prompts (`/prompts`) in https://modelcontextprotocol.io/clients

Amazon Devices Builder Tools MCP provides the following pre-defined prompt templates for common workflows that can be 1-click executed in `/prompts` in your AI Agent:

**Important**: Always run `/prompts` in your AI Agent to see the full list of prompts provided by Amazon Devices Builder Tools MCP

### 1. `apply_performance_best_practices`

**Description:** Diagnose and optimize React Native application performance issues including component rendering, memory management, navigation, network optimization, and state management.

**Parameters:**

- `app_source_path` (required, string): Path to the React Native application source code directory for analysis

**Example usage:**

```
> @apply_performance_best_practices /path/to/my-vega-app/src
```

### 2. `detect_component_re-renders`

**Description:** Diagnose and optimize Vega application UI fluidity performance issues caused by component re-rendering using React Native tools.

**Parameters:**

- `vega_app_package_path` (required, string): Absolute path to the Vega app package root directory

**Example usage:**

```
> @detect_component_re-renders /path/to/my-vega-app
```

### 3. `diagnose-slowAppLaunch`

**Description:** Diagnose Vega application's slow app launch KPIs (TTFF and/or TTFD).

**Parameters:**

- `kpi_report_file_path` (required, string): Absolute path to the KPI report file
- `kpi_to_diagnose` (required, string): Name of the KPI from KPI report to diagnose

**Example usage:**

```
> @diagnose-slowAppLaunch /path/to/report.json ttff
```

### 4. `diagnose_crash`

**Description:** Diagnose crashes in Vega applications including JavaScript, Native, LMK (Low Memory Killer), and ANR (Application Not Responding) crashes. Automatically discovers ACR files, symbolicates stack traces, and routes to the appropriate analysis workflow.

**Parameters:**

- `acr_file_path` (optional, string): Path to ACR file. If not provided, the tool will auto-discover ACR files from the device temp directory.

**Example usage:**

```
> @diagnose_crash /path/to/crash.acr
```

### 5. `diagnose_key_input_latency`

**Description:** Diagnose and resolve key input latency issues in React Native Vega apps through systematic analysis of JS Thread performance, CPU bottlenecks, and input event handling optimization.

**Parameters:**

- `vega_app_package_path` (required, string): Absolute path to the Vega app package root directory
- `app_process_name` (optional, string): Name of the app process experiencing input latency. If not provided, resolved automatically from manifest.toml.
- `perfetto_trace_file_path` (optional, string): Absolute path to existing Perfetto trace file (if already captured)
- `target_component_or_button` (optional, string): Specific button or component name to investigate
- `latency_threshold_ms` (optional, number): Maximum acceptable input latency in milliseconds. Default is 100.

**Example usage:**

```
> @diagnose_key_input_latency /path/to/my-vega-app
```

### 6. `diagnose_ui_fluidity`

**Description:** Comprehensive diagnosis of UI fluidity KPI failures for React Native Vega apps through systematic analysis of component re-rendering and CPU performance bottlenecks.

**Parameters:**

- `vega_app_package_path` (required, string): Absolute path to the Vega app package root directory

**Example usage:**

```
> @diagnose_ui_fluidity /path/to/my-vega-app
```

### 7. `fix_hot_functions`

**Description:** Diagnose and optimize Vega application UI fluidity issues by analyzing and fixing CPU-intensive hot functions.

**Parameters:**

- `vega_app_package_path` (required, string): Absolute path to the Vega app package root directory

**Example usage:**

```
> @fix_hot_functions /path/to/my-vega-app
```

### 8. `react_native_for_vega_add_simple_media_playback_implementation`

**Description:** Add a simple media playback implementation to an existing React Native for Vega application.

**Parameters:**

- `vega_app_package_path` (required, string): Absolute path to the Vega app package root directory

**Example usage:**

```
> @react_native_for_vega_add_simple_media_playback_implementation /path/to/my-vega-app
```

### 9. `react_native_for_vega_ai_assisted_rn_upgrade`

**Description:** Trigger generic turn-based workflow for React Native version upgrades with AI-assisted migration.

**Parameters:**

- `vega_app_package_path` (required, string): Absolute path to the Vega app package root directory

**Example usage:**

```
> @react_native_for_vega_ai_assisted_rn_upgrade /path/to/my-vega-app
```

### 10. `upgrade_carousel_component`

**Description:** Assists in migrating to newer versions of the Carousel component in the Vega SDK.

**Parameters:**

- `current_implementation_file_path` (required, string): Absolute path to the file containing the V1 implementation of Carousel
- `current_version` (required, string): The current version of Carousel, independent of package
- `target_version` (required, string): The target version of Carousel, independent of package

**Example usage:**

```
> @upgrade_carousel_component /path/to/HomeScreen.tsx 1.0.6 2.0.0
```

### 11. `react_native_for_vega_rn83_alpha_preview`

**Description:** Guide allowlisted alpha partners through the full RN 0.83 preview lifecycle using the bundled knowledge base. Covers private registry configuration, preview SDK installation, migration, and cleanup/uninstall steps.

**Parameters:** None

**Example usage:**

```
> @react_native_for_vega_rn83_alpha_preview
```

### 12. `upgrade_fire_tv_android_sdk`

**Description:** Assess and upgrade a third-party Fire TV app's `targetSdkVersion` across Android API levels 30 through 36 with focused per-level guidance and explicit approval gates before changes.

**Parameters:**

- `target_api_level` (optional, string): Final Android API level in the range 30 through 36. If omitted, the agent proposes API 36 and asks for confirmation.
- `starting_target_sdk_version` (optional, string): Current `targetSdkVersion`. If omitted, the agent reads it from the app's Gradle configuration or manifest.

**Example usage:**

```
> @upgrade_fire_tv_android_sdk target_api_level=35 starting_target_sdk_version=30
```
