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

# Tools & Resources Reference

> Complete reference for all 31 NeuroFusion Quest MCP tools and 6 MCP resources, including parameters, OAuth scopes, and RBAC permissions.

Every tool and resource on the NeuroFusion Quest MCP Server enforces **both** its required OAuth 2.1 scope and your NeuroFusion organization RBAC permissions.

> [!TIP]
>
> Start new sessions by calling `list_organizations` to discover the `organizationGuid` values and permissions available to your account before creating quests.

## Workspace & Quest Tools

| Tool | OAuth Scope | NeuroFusion RBAC | Hints | Description |
| - | - | - | - | - |
| `list_organizations` | `quests:read` | Active org membership | Read-only, Idempotent | List active organizations, roles, permissions, and (if permitted) credit balances |
| `list_quests` | `quests:read` | Owner or active org member | Read-only, Idempotent | List accessible quests with optional org, publish status, and search filters |
| `get_quest` | `quests:read` | Owner, active org member, or public | Read-only, Idempotent | Fetch quest metadata, parsed config (with platform consent normalized), participant count, and access flags |
| `create_quest` | `quests:write` | `quest.create` | — | Create a draft quest in an organization and record initial config history |
| `update_quest` | `quests:write` | `quest.update` or `quest.update_own` | Idempotent | Update quest metadata and/or config (replace or shallow-merge) and record config history |
| `generate_experiment_code` | `quests:write` | Authenticated user | Read-only | Generate or iteratively refine a self-contained jsPsych 8 HTML experiment via AI |
| `publish_quest` | `quests:write` | `quest.publish` | Idempotent | Publish an organization quest (charges `quest_publish` credits on first publish only) |
| `unpublish_quest` | `quests:write` | `quest.publish` | Idempotent | Unpublish a quest back to private draft status while preserving its join code |
| `clone_quest` | `quests:write` | `quest.update` (source) + `quest.create` (target) | — | Duplicate a quest's config, extra config, and media into a new draft without copying participant data |
| `delete_quest` | `quests:write` | `quest.delete` (or legacy owner) | **Destructive** | Soft-delete a quest; refuses if collected data exists unless `confirmDataLoss: true`; audit-logged |
| `get_quest_config_history` | `quests:read` | Quest manager (`canManageQuest`) | Read-only, Idempotent | List versioned config snapshots or fetch the full config of a specific version |
| `rollback_quest_config` | `quests:write` | Quest manager (`canManageQuest`) | — | Roll back a quest's config to a prior version and record a `rolled_back` snapshot |
| `list_quest_cohorts` | `quests:read` | Study access | Read-only, Idempotent | List participant cohorts defined for a quest |
| `create_quest_cohort` | `quests:write` | Study access | — | Create a new cohort for a quest |
| `list_quest_subjects` | `quests:read` | Study access | Read-only, Idempotent | List enrolled subjects, optionally filtered by status or cohort |
| `list_quest_media` | `quests:read` | Quest manager (`canManageQuest`) | Read-only, Idempotent | List stimulus media files uploaded for a quest |
| `upload_quest_media` | `quests:write` | Quest manager (`canManageQuest`) | — | Upload a base64-encoded stimulus file (`image/*`, `audio/*`, or `video/*`, up to 25 MB) |

### Key Quest Tool Parameters

* **`list_quests`**: `organizationGuid?` (string), `isPublic?` (boolean), `search?` (string — case-insensitive match on title, description, or joinCode), `limit?` (1–200, default `100`).
* **`get_quest`**: `questGuid` (string, required).
* **`create_quest`**: `organizationGuid` (string, required), `title` (string, 1–255 chars, required), `description?` (string), `organizerName?` (string), `projectGuid?` (string), `config?` (object — `experiments`, `prompts`, `onboardingQuestions`, `requireEachSession`, `autoTriggerNext`, etc.).
* **`update_quest`**: `questGuid` (string, required), `title?` (string), `description?` (string), `organizerName?` (string), `config?` (object), `mergeConfig?` (boolean — when `true`, shallow-merges keys into the existing config instead of replacing it).
* **`generate_experiment_code`**: `description` (string, 1–2000 chars, required), `existingCode?` (string — existing HTML experiment to iteratively refine).
* **`publish_quest` / `unpublish_quest`**: `questGuid` (string, required).
* **`clone_quest`**: `questGuid` (string, required), `targetOrganizationGuid?` (string — defaults to source org), `title?` (string — defaults to `<title> (Copy)`).
* **`delete_quest`**: `questGuid` (string, required), `confirmDataLoss?` (boolean — must be `true` to soft-delete a quest that already has participants or datasets).
* **`get_quest_config_history`**: `questGuid` (string, required), `version?` (int >= 1 — fetches full config for that version), `limit?` (1–100).
* **`rollback_quest_config`**: `questGuid` (string, required), `version` (int >= 1, required).
* **`list_quest_cohorts`**: `questGuid` (string, required).
* **`create_quest_cohort`**: `questGuid` (string, required), `name` (string, 1–255 chars, required), `description?` (string).
* **`list_quest_subjects`**: `questGuid` (string, required), `status?` (`"enrolled" | "active" | "completed" | "withdrawn" | "excluded"`), `cohortGuid?` (string).
* **`list_quest_media`**: `questGuid` (string, required).
* **`upload_quest_media`**: `questGuid` (string, required), `fileName` (string, 1–128 chars, required), `mimeType` (`image/*`, `audio/*`, or `video/*`, required), `contentBase64` (string, required).

***

## Dataset Management & Export Tools

| Tool | OAuth Scope | NeuroFusion RBAC | Hints | Description |
| - | - | - | - | - |
| `get_quest_dataset_summary` | `datasets:read` | `data.view` | Read-only, Idempotent | Counts by dataset type, experiment names, distinct URL attribution parameters, and participant/session counts |
| `list_quest_datasets` | `datasets:read` | `data.view` (or own datasets) | Read-only, Idempotent | Paginated dataset listing with type, user, session, experiment, and URL param filters; writes `view` audit log |
| `get_dataset_content` | `datasets:read` | `data.view` (or file owner) | Read-only, Idempotent | Reads a dataset's inline JSON or Azure Blob payload with bounded truncation; writes `view` audit log |
| `list_quest_sessions` | `datasets:read` | `data.view` (or own sessions) | Read-only, Idempotent | Lists participant collection sessions ordered by most recent |
| `delete_quest_datasets` | `datasets:write` | `data.view` + `data.delete` | **Destructive** | Permanently deletes 1–500 datasets with a mandatory audit `reason`; writes per-dataset `delete` audit logs |
| `create_dataset_export` | `datasets:read` | `data.view` + `data.download` | — | Enqueues an async `individual_zip` or `combined_csv` export job; writes `download` audit log |
| `list_dataset_exports` | `datasets:read` | `data.view` + `data.download` | Read-only, Idempotent | Lists recent async export jobs created by you for a quest |
| `get_dataset_export` | `datasets:read` | `data.view` + `data.download` | Read-only, Idempotent | Returns job status, progress, ETA, and (when `includeDownloadUrl: true` on a completed job) a 30-minute Azure Blob SAS URL |
| `cancel_dataset_export` | `datasets:read` | `data.view` + `data.download` | Idempotent | Cancels a queued or running dataset export job |

### Key Dataset Tool Parameters

* **`get_quest_dataset_summary`**: `questGuid` (string, required).
* **`list_quest_datasets`**: `questGuid` (string, required), `type?` (e.g. `experiment_trials`, `brain_recordings`, `onboarding_responses`), `userGuid?`, `sessionGuid?`, `experimentName?` (substring), `urlParamKey?`, `urlParamValue?`, `limit?` (1–200, default `50`), `offset?` (>= 0).
* **`get_dataset_content`**: `questGuid` (string, required), `datasetId` (int >= 1, required), `maxChars?` (1000–500000, default `100000`).
* **`list_quest_sessions`**: `questGuid` (string, required), `userGuid?` (string), `limit?` (1–200).
* **`delete_quest_datasets`**: `questGuid` (string, required), `datasetIds` (int\[], 1–500 items, required), `reason` (string, 1–1000 chars, required).
* **`create_dataset_export`**: `questGuid` (string, required), `format` (`"individual_zip" | "combined_csv"`, required), `filter?` (object with `mode`: `"all" | "by_type" | "by_experiment" | "by_url_params"`, plus the matching required non-empty selector: `selectedTypes?: string[]` for `"by_type"`, `selectedExperiments?: string[]` for `"by_experiment"`, or `selectedUrlParams?: Record<string, string>` for `"by_url_params"`; unsupported modes or fields return `INVALID_INPUT`).
* **`list_dataset_exports`**: `questGuid` (string, required), `limit?` (1–50, default `20`).
* **`get_dataset_export`**: `questGuid` (string, required), `jobGuid` (string, required), `includeDownloadUrl?` (boolean).
* **`cancel_dataset_export`**: `questGuid` (string, required), `jobGuid` (string, required).

***

## Quest Artifact Tools

| Tool | OAuth Scope | NeuroFusion RBAC | Hints | Description |
| - | - | - | - | - |
| `list_quest_artifacts` | `artifacts:read` | `artifact.view` | Read-only, Idempotent | Lists quest artifacts (omitting `htmlContent`) with visibility, view stats, share URL, and access flags |
| `get_quest_artifact` | `artifacts:read` | `artifact.view` | Read-only, Idempotent | Returns an artifact's metadata and full `htmlContent` (does not increment `viewCount`) |
| `create_quest_artifact` | `artifacts:write` | `artifact.create` (+ `artifact.publish` if `public`) | — | Creates an interactive HTML artifact (up to 25 MB) attached to a quest |
| `update_quest_artifact` | `artifacts:write` | `artifact.create` (content) / `artifact.publish` (visibility) | Idempotent | Updates title, description, `htmlContent`, and/or `visibility` |
| `delete_quest_artifact` | `artifacts:write` | `artifact.delete` | **Destructive** | Permanently deletes an artifact from a quest |

### Key Artifact Tool Parameters

* **`list_quest_artifacts`**: `questGuid` (string, required).
* **`get_quest_artifact`**: `questGuid` (string, required), `artifactGuid` (string, required).
* **`create_quest_artifact`**: `questGuid` (string, required), `title` (string, 1–255 chars, required), `description?` (string, max 2000 chars), `htmlContent` (string, required — self-contained HTML up to 25 MB), `visibility?` (`"organization" | "public"`, default `"organization"`).
* **`update_quest_artifact`**: `questGuid` (string, required), `artifactGuid` (string, required), `title?` (string), `description?` (string or `null` to clear), `htmlContent?` (string), `visibility?` (`"organization" | "public"`).
* **`delete_quest_artifact`**: `questGuid` (string, required), `artifactGuid` (string, required).

***

## MCP Resources & Resource Templates

Clients that support MCP resources can read structured workspace data directly by URI:

| URI / Template | OAuth Scope | MIME Type | Description |
| - | - | - | - |
| `neurofusion://organizations` | `quests:read` | `application/json` | Active NeuroFusion organizations and permissions for the authenticated user |
| `neurofusion://quests` | `quests:read` | `application/json` | All quests accessible to the authenticated user |
| `neurofusion://quests/{questGuid}` | `quests:read` | `application/json` | Full quest metadata and parsed configuration |
| `neurofusion://quests/{questGuid}/datasets/summary` | `datasets:read` | `application/json` | Dataset counts, types, experiments, and URL attribution parameters |
| `neurofusion://quests/{questGuid}/artifacts` | `artifacts:read` | `application/json` | List of interactive HTML artifacts attached to a quest |
| `neurofusion://quests/{questGuid}/artifacts/{artifactGuid}` | `artifacts:read` | `text/html` | Raw HTML source of a quest artifact |

***

## Tool Error Format

Domain and permission errors return `isError: true` with a structured JSON payload inside `content[0].text`:

```json theme={null}
{
  "error": "INSUFFICIENT_CREDITS",
  "message": "Insufficient organization credits to publish quest",
  "statusCode": 402,
  "details": {
    "requiredCredits": 50
  }
}
```

Common error codes include `INVALID_INPUT` (`400`), `INVALID_CONFIG` (`400`), `INVALID_MEDIA_TYPE` (`400`), `INSUFFICIENT_CREDITS` (`402`), `FORBIDDEN` (`403`), `INSUFFICIENT_SCOPE` (`403`), `NOT_FOUND` (`404`), `INVALID_STATE` (`409`), and `PAYLOAD_TOO_LARGE` (`413`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.