# How to Connect Your AI Agent to Elevated Instagram Feed (agent documentation)

> Machine-readable documentation for AI agents. Human version: https://elevatedextensions.com/documentation/instagram-feed/connect-ai-agent/

## What this connection is

Elevated Instagram Feed registers 27 WordPress Abilities under the `elevated-instagram-feed/*` namespace. Agent Connector for WP serves them over MCP (Streamable HTTP) at:

```
{site_url}/wp-json/mcp/mcp-adapter-default-server
```

Authentication: WordPress application password (Basic auth), typically via the `@automattic/mcp-wordpress-remote` stdio proxy with env vars `WP_API_URL`, `WP_API_USERNAME`, `WP_API_PASSWORD`.

## Discovery

- `tools/list` on the MCP endpoint returns the exposed tools.
- `mcp-adapter-discover-abilities` lists every registered ability; `mcp-adapter-get-ability-info` returns an ability's full input/output JSON Schema; `mcp-adapter-execute-ability` executes one.

## The ability surface (summary)

- Feeds: `list-feeds`, `get-feed`, `create-feed`, `update-feed`, `delete-feed` (requires `confirm: true`)
- Accounts: `list-accounts-local` (read-only), `list-accounts`, `get-account`, `list-account-media`, `set-active-account`, `disconnect-account` (requires `confirm: true`), `prepare-account-connection`, `get-account-connection-status`, `cancel-account-connection`
- Cache: `get-cache-info`, `get-cache-refresh-progress`, `refresh-feed-cache`, `refresh-all-feed-caches`, `clear-feed-cache`, `clear-cache` (all four refresh/clear operations require `confirm: true`)
- Maintenance: `cleanup-orphaned-media` (requires `confirm: true`, supports `dry_run`), `get-feed-update-schedule`, `set-feed-update-schedule`, `get-global-settings`, `update-global-settings`, `reregister-feed-translations`, `get-plugin-update-status`

The exact schema of every ability and captured request/response examples: https://elevatedextensions.com/documentation/instagram-feed/managing-with-ai-agent/?format=agent

## Contract rules that will bite you if ignored

1. Seven abilities require `confirm: true`: `delete-feed`, `disconnect-account`, `refresh-feed-cache`, `refresh-all-feed-caches`, `clear-feed-cache`, `clear-cache`, `cleanup-orphaned-media`. The flag is schema-required, so an unconfirmed call fails validation before any handler runs: `Ability "elevated-instagram-feed/delete-feed" has invalid input. Reason: confirm is a required property of input.` Refreshes require confirmation because they spend the site's Instagram API quota, not because they destroy anything.
2. `feed_id` is a string, not an integer. Sending `{ "feed_id": 39 }` fails with `input[feed_id] is not of type string`; send `{ "feed_id": "39" }`.
3. `list-accounts` and `get-account` are writes, not reads: each makes an Instagram Graph call and rewrites the stored accounts option with refreshed profile-picture URLs. `list-accounts-local` is the genuinely read-only alternative; prefer it whenever you only need to know who is connected. `list-account-media` validates the account token first, which can trigger a token refresh.
4. Authorizing an Instagram account is human-only. `prepare-account-connection` produces the login URL and stops; `cancel-account-connection` withdraws it. No ability completes the OAuth flow.
5. `clear-cache` is site-wide: it deletes every cache entry AND every downloaded image, video, and profile picture on disk, then marks all posts for re-download (which consumes Instagram bandwidth and quota). Prefer the scoped `clear-feed-cache`.
6. Licensing, connector installation, and the access toggle are human-only. They are not abilities. When the site owner switches `Allow AI agent access` off (option `elevated_instagram_feed_agent_access`), the abilities are not registered and calls fail with a `404`, code `rest_ability_not_found`, message `Ability not found.` Ask the human to switch it on; agents cannot.

## Minimal worked example

```json
// create-feed (input): only what you want to set; defaults fill the rest
{ "settings": { "title": "Spring Lookbook", "account_id": "@yourshop" } }
```

The response returns the complete feed object with every default filled in (template, postStyles, layoutSettings, styleSettings, filterSettings) plus the new feed's id. Read it back with `get-feed`, and get the embed shortcode from `list-feeds`.

```json
// delete-feed (input)
{ "feed_id": "39", "confirm": true }
```

```json
// delete-feed (response data)
{ "feed_id": "39", "deleted": true, "feed_post_rows_removed": 0, "cache_rows_removed": 0 }
```

Deleted feeds leave downloaded media on disk: files are shared between feeds, and `cleanup-orphaned-media` will not reclaim them either, because it only deletes files no post row claims.
