> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bily.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Run common MCP workflows

> Use focused MCP requests to discover stores, compare revenue, inspect data, and verify actions.

Start with `search`. Then pass one focused async arrow function to `execute`.

## Find your identity and stores

Search input:

```json theme={null}
{
  "query": "show the authenticated identity, organizations, and stores",
  "limit": 6
}
```

Execution code:

```javascript theme={null}
async () => {
  return bily.context();
}
```

The result contains `user` and `organizations[]`. Accessible stores appear under each organization.

A standard store-scoped fallback key needs no organization input.

With Bily Connect, add `organizationId` to `execute` only when the user explicitly selects one accessible organization:

```json theme={null}
{
  "organizationId": "org_01J8W7T9G3E6ZQ4M2K5N8P1R0S",
  "code": "async () => bily.context()"
}
```

## Explain a revenue change

Search for the right comparison operation:

```json theme={null}
{
  "query": "compare revenue to the preceding period and explain traffic, conversion, and order value",
  "storeUrl": "store.example.com",
  "limit": 5
}
```

Run the returned revenue-trend helper with real calendar dates:

```javascript theme={null}
async () => {
  return bily.analytics.getRevenueTrend({
    storeUrl: "store.example.com",
    filters: {
      startDate: "2026-07-01",
      endDate: "2026-07-07",
    },
    comparisonFilters: {
      startDate: "2026-06-24",
      endDate: "2026-06-30",
    },
  });
}
```

Review the returned readiness, warning, and sample-size fields before making a business recommendation.

## See which analytics data is available

```javascript theme={null}
async () => {
  const datasets = await bily.analytics.listDatasets({
    storeUrl: "store.example.com",
  });

  console.log("Catalog loaded");
  return datasets;
}
```

The returned data appears in `result`. The message appears in `logs`.

## Complete and verify a supported action

For a request such as refreshing connected advertising accounts, follow this sequence:

1. Call `search` with the exact intent and store.
2. Review `riskTier`, `approvalPolicy`, preconditions, and verification guidance.
3. Show the proposed function to the user.
4. Get explicit approval in the client.
5. Run one focused action, then verify it with a read.

```javascript theme={null}
async () => {
  const refresh = await bily.actions.syncAdAccounts({
    storeUrl: "store.example.com",
  });

  const accounts = await bily.getManagedAdAccounts({
    storeUrl: "store.example.com",
  });

  return { refresh, accounts };
}
```

Do not add other writes to the function without showing them. If the request expands, present the complete function for approval again.
