Affinda MCP

Extract and validate data from documents and manage Affinda workspaces, document types, fields and integrations through Affinda's hosted MCP server.

Tools

This is a reference catalogue. Tools cannot be configured or run from this page.

  • Get integration

    Get one integration by ID — full configuration, code, and connections. Use this whenever you need to read the current Python code or the attached connections. Critical before calling ``update_integration`` with ``python_code``: that field replaces the entire file with no partial-edit option, so you must read the existing code first and compose a complete replacement. Also use it to confirm trigger event, workspace / document-type scoping, and deployed state. To enumerate integrations in an organization, use ``list_integrations``. Returns ``data=null`` with ``error="not_found"`` if the ID is unknown. Args: ctx: MCP context (injected by FastMCP). integration_id: ID of the integration to fetch.

  • Get integration run

    Get one integration run by ID — full, untruncated logs and output. Use this when diagnosing a failing integration. ``list_integration_runs`` truncates logs to 10,000 characters, which often hides the actual error; this tool returns the complete log stream and is the right starting point for any "why did my integration fail?" investigation. To find recent run IDs for an integration, call ``list_integration_runs`` first, then drill into the failed run with this tool. Returns ``data=null`` with ``error="not_found"`` if the run ID is unknown. Args: ctx: MCP context (injected by FastMCP). integration_run_id: ID of the integration run to fetch.

  • Get usage

    Get daily credits consumption for an organization over a date range. Use this to answer "how many credits have we used?", to break usage down by day, or to attribute spend to one workspace or document type. Returns a ``total`` plus a per-day ``items`` list; days with zero usage are omitted. Optionally scope with ``workspace_id`` or ``document_type_id`` — but not both, since the API aggregates each axis independently and combining them is silently invalid. The caller must be an admin or owner of the organization; non-admins receive ``error="forbidden"``. There is no per-user breakdown and no sub-daily granularity — both are deliberate limits of the underlying report. Args: ctx: MCP context (injected by FastMCP). organization_id: Organization to report usage for. workspace_id: Optional. Scope to one workspace; mutually exclusive with ``document_type_id``. document_type_id: Optional. Scope to one document type; mutually exclusive with ``workspace_id``. start_date: Inclusive ``YYYY-MM-DD``. Defaults to one month before ``end_date``. end_date: Inclusive ``YYYY-MM-DD``. Defaults to today.

  • Get validation rule

    Get one validation rule by ID — prompt, enabled, fields, missing-data option. Use this when you already know the ``validation_rule_id`` and need to inspect or quote the existing prompt before patching it via ``update_validation_rule``. Returns ``data=null`` with ``error="not_found"`` if no rule matches. To enumerate every rule on a document type, use ``list_validation_rules`` instead. Args: ctx: MCP context (injected by FastMCP). validation_rule_id: ID of the validation rule to fetch.

  • Get workspace

    Get one workspace by ID — name, organization, and document counts only. Use this when you already know the workspace_id and need a lightweight summary, e.g. to confirm the workspace exists or to display headline counts. Returns ``data=null`` with ``error="not_found"`` if no workspace matches the ID. For OCR / splitting / classification / model-memory settings, call ``get_workspace_details`` instead — that surface includes the full configuration. To enumerate workspaces in an organization, use ``list_workspaces``. Args: ctx: MCP context (injected by FastMCP). workspace_id: Internal numeric ID returned by list_workspaces, not the alphabetic identifier.

  • Get workspace details

    Get a workspace's full configuration — settings + counts. Use this whenever you need to read or reason about workspace settings: OCR mode, document splitting, classification, model-memory strategy, duplicate rejection, and validation flags. Typical scenarios are answering "what's the current config?", deciding whether to suggest a settings change, and reading the current value before computing a patch for ``update_workspace``. For just the headline counts (no settings) prefer ``get_workspace``; it does fewer joins on the API side. Args: ctx: MCP context (injected by FastMCP). workspace_id: Internal numeric ID returned by list_workspaces, not the alphabetic identifier.

  • List data sources

    List data sources (lookup tables) defined on an organization. Use this to discover the ``data_source_id`` for downstream tools, or to show the user what lookup tables already exist in their org. Data sources are organization-scoped enum-style records (suppliers, currencies, charge types, ...) that can be attached to fields for constrained extraction. Returns a lean summary with ``id``, ``name``, schema, and document-type usage count. For the rows inside a data source use ``list_data_source_values``; to fetch one data source by ID use ``get_data_source``. Args: ctx: MCP context (injected by FastMCP). organization_id: Organization to scope the list to. Required. limit: Cap on returned items. Default 20 — usually enough.

  • List data source values

    List the rows (records) stored in a data source. Use this to inspect the actual contents of a lookup table — typical scenarios are "what suppliers are in this list?", finding the row to update or delete by its key, or sanity-checking a recently-populated data source. Each row is returned as a raw dict matching the data source's schema. For data source metadata (name, schema, key property) use ``get_data_source``. To enumerate data sources themselves use ``list_data_sources``. Args: ctx: MCP context (injected by FastMCP). data_source_id: ID of the data source whose rows to read. limit: Cap on returned rows. Default 100.

  • List documents

    List documents in a workspace with their state and basic metadata. Use this to find documents by workspace, narrow by state, or run a full-text search across file names and extracted text — for example, "show me documents in review" or "find docs mentioning Acme". For one document by ID, use ``get_document``. For extracted field values, use ``get_document_extraction``. To wait for in-flight processing to finish before listing, use ``wait_for_document_processing`` instead of polling this tool. Args: ctx: MCP context (injected by FastMCP). workspace_id: Workspace to scope the query to. state: One of ``review``, ``validated``, ``archived``, ``rejected``. Omit to include all states (including ``processing``). search_text: Full-text query against file name and extracted text. limit: Cap on returned items. Default 20.

  • List document splitters

    List document splitters available to an organization. Use this whenever you need a ``document_splitter_id`` to pass into ``create_workspace`` or ``update_workspace`` with splitting enabled. The list includes global splitters (notably "General Document Splitter", a safe default) and any organization-specific splitters the customer has trained. There is no separate "get splitter" tool — for splitter details, find the entry in this list. Args: ctx: MCP context (injected by FastMCP). organization_id: Organization to scope the list to. Required by the API for access control even when listing global splitters.

  • List document types

    List document types in an organization. Use this to discover existing document types — for example, to find a ``document_type_id`` to pass into other tools, to check whether a similar type already exists before creating a new one, or to show the user what's configured. Each item includes document counts and a fields count for a quick activity overview. For the full settings of a single type (validation toggles, redact button, refresh behaviour) use ``get_document_type_details``. For its fields and field groups use ``list_fields``. Args: ctx: MCP context (injected by FastMCP). organization_id: Organization to scope the list to. Required. limit: Cap on returned items. Default 50 — fits most orgs.

  • List fields

    List a document type's full field schema, grouped by field group. Use this whenever you need the field layout: discovering field IDs to pass into other tools, checking for pre-populated template fields after ``create_document_type``, reading positions before reordering, or finding numeric IDs to embed in validation rule prompts (the ``@<field_id>`` syntax). Returns each field group with its fields, plus the child IDs of any ``group``/``table`` parents. For a single field by ID, use ``get_field``. For just the document type's settings (no fields), use ``get_document_type_details``. Validation rules live separately — call ``list_validation_rules``. Args: ctx: MCP context (injected by FastMCP). document_type_id: Document type whose schema to fetch.

  • List integration connections

    List third-party service connections in an organization. Use this before writing integration code to discover which services are already authenticated (Slack, Google Sheets, Salesforce, etc.). Each connection carries an ``account_id`` you reference inside Lambda code and an ``id`` you pass to ``add_connection_to_integration`` when attaching the connection to an integration. If no connection exists for the service the user needs, search available providers with ``list_pipedream_apps`` and start an OAuth flow with ``create_connect_token``. Args: ctx: MCP context (injected by FastMCP). organization_id: Organization to list connections for.

  • List integration runs

    List recent runs for an integration, newest first. Use this to scan run history — for example, after ``run_integration`` to confirm the test landed, or when a user reports problems and you need to spot which runs failed. Each item includes success status, triggering document, and a log snippet. Logs in this list are truncated to 10,000 characters. For diagnosing a specific failure, identify the run ID here and call ``get_integration_run`` to fetch full untruncated logs. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to list runs for. limit: Cap on returned items. Default 5.

  • List integrations

    List integrations in an organization. Use this to discover existing integrations — for example, to find an ``integration_id`` to pass into other tools, or to show the user what is already configured. Each item includes name, trigger event, and enabled / deployed status. Returns a lean view: Python source code is omitted. To read the code or attached connections, call ``get_integration`` on a specific item. Args: ctx: MCP context (injected by FastMCP). organization_id: Organization to list integrations for. Required. workspace_id: Optional — restrict to integrations scoped to one workspace. enabled: Optional — ``True`` for enabled-only, ``False`` for disabled-only, omit for both. limit: Cap on returned items. Default 20.

  • List integration secrets

    List the names of secrets configured for an integration. Use this when an integration needs an API key, token, or other credential to talk to an external service that is NOT being accessed via a Pipedream connection (Pipedream connections handle their own auth via ``account_id``). Call this before writing integration code to discover what credentials are already available — secret names map directly to environment variables accessible inside the Lambda as ``os.environ["SECRET_NAME"]``. Returns names only. The secret values themselves live as Lambda environment variables and are not readable through any tool. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to list secrets for.

  • List integration versions

    List deployed-version snapshots for an integration, newest first. Use this when the user wants to roll back a problematic deploy: each item carries a ``version`` number, the snapshotted code, and an ``is_published`` flag marking the currently-live version. Find the target version's ``id`` here, then pass it into ``revert_integration_version``. Versions are written by ``deploy_integration_version``; the in-progress code held on the integration itself (visible via ``get_integration``) is not a version until it is deployed. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to list versions for. limit: Cap on returned items. Default 10.

  • List matching criteria

    List matching criteria configured on a field. Use this to inspect HOW a field's extracted value is mapped to its attached data source — for example before tuning match behaviour, or to find the ``matching_criterion_id`` to update or delete. Only useful on fields that already have a data source attached; an unattached field returns an empty list. For the data source itself (rows, schema) use ``get_data_source`` and ``list_data_source_values``; matching criteria configure the lookup behaviour, not the data. Args: ctx: MCP context (injected by FastMCP). field_id: ID of the field whose matching criteria to list.

  • List model memory documents

    List the confirmed reference documents currently in a document type's model memory. Use this when the user asks about model memory directly, or wants an overview of the reference examples a document type draws on. Model memory is the set of confirmed documents the document type uses to guide extractions on similar docs. To find which example guided one *specific* document's extraction, don't list model memory — use ``get_document_extraction`` on that document and follow its ``reference_document_id`` instead. Skip this for routine extraction reviews — it's not needed to answer "what did we extract?". For the full configuration of the document type itself (fields, validation rules), use ``get_document_type_details``. To see one document's extraction, use ``get_document_extraction``. Args: ctx: MCP context (injected by FastMCP). document_type_id: Document type to query. limit: Cap on returned items. Default 50.

  • List organizations

    List organizations the current user belongs to. Use this as the starting point for almost any flow: an ``organization_id`` is required by ``list_workspaces``, ``create_workspace``, ``list_document_splitters``, ``get_usage`` and most onboarding tools. Each entry includes ``id``, ``name``, and ``identifier``; pick the org by name or confirm with the user when multiple are returned. For a single organization's details there is no dedicated getter — the fields returned here are the full public surface. Use ``update_organization`` to rename one. Args: ctx: MCP context (injected by FastMCP). limit: Cap on returned items. Default 20 — most users belong to only a handful of orgs.

PreviousPage 3 / 5Next