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.

  • Delete data source

    Delete a data source and every row it contains. Use this only when the user explicitly wants the entire lookup table gone — "delete the Suppliers data source", "remove this list". Any fields that referenced the data source lose the association silently; extraction on those fields falls back to free-text. To remove a single row instead, use ``delete_data_source_value``. To detach the data source from a field while keeping the data, update the field's ``mapping_data_source_id`` to null rather than deleting here. Args: ctx: MCP context (injected by FastMCP). data_source_id: ID of the data source to delete.

  • Delete data source value

    Delete one row from a data source by its key. Use this for conversational single-row removal: "remove supplier ACME", "drop the JPY currency entry". Fails with ``not_found`` if no row matches ``key``. To remove the entire data source (all rows + the table itself) use ``delete_data_source``. There is no bulk-delete tool — for many rows, call this per row. Args: ctx: MCP context (injected by FastMCP). data_source_id: ID of the data source. key: Value of the data source's ``key_property`` identifying the row to remove. Use ``list_data_source_values`` to find the key if unsure.

  • Delete document type

    Delete a document type permanently. Use this when the user wants to remove a document type entirely from their organization. Destructive: all fields, field groups, and validation rules attached to the type are removed with it. By default documents previously classified as this type are kept (orphaned, no type) — pass ``delete_documents=True`` to delete them too. To remove a type from one workspace but keep it in the org, this is the wrong tool — there is no separate unassign call; instead, manage visibility via workspace settings. To delete only fields or rules, use ``delete_field`` / ``delete_validation_rule``. Args: ctx: MCP context (injected by FastMCP). document_type_id: ID of the document type to delete. delete_documents: Also delete every document of this type. Default ``False`` (documents are orphaned, not removed).

  • Delete field

    Delete a single field from a document type. Use this when the user wants to remove one field they no longer want extracted, or to drop a field before recreating it under a different parent (the only safe way to "move" a field — direct ``parent_id`` reassignment via ``update_field`` breaks annotations). For deleting a heading/section, use ``delete_field_group``. For deleting a validation rule, use ``delete_validation_rule``. For removing the entire document type, use ``delete_document_type``. Built-in (non-custom) fields on document types with a trained model cannot be deleted — only custom fields can. Args: ctx: MCP context (injected by FastMCP). field_id: ID of the field to delete.

  • Delete field group

    Delete a field group (heading/section) from a document type. Use this when the user wants to remove a section heading. Move any fields you want to keep into another group first via ``update_field`` with ``field_group_id`` — fields left behind will become ungrouped. To delete fields themselves, use ``delete_field``. To delete the whole document type, use ``delete_document_type``. Args: ctx: MCP context (injected by FastMCP). field_group_id: ID of the field group to delete.

  • Delete integration

    Permanently delete an integration. Use this when the user wants to remove an integration entirely. Code, versions, run history, and connection links are dropped together. This is destructive and not recoverable — confirm intent before calling. To temporarily stop an integration without losing it, set ``enabled=False`` via ``update_integration`` instead. To roll back a bad code change, use ``revert_integration_version`` rather than delete. Args: ctx: MCP context (injected by FastMCP). integration_id: ID of the integration to delete.

  • Delete integration secret

    Permanently delete a secret. Removes both the database record and the Lambda environment variable. Use this when a credential is no longer needed (e.g. the user rotated to a different service, or the integration's auth model changed to Pipedream). The secret value cannot be recovered after deletion — confirm intent before calling. Find ``secret_id`` via ``list_integration_secrets`` (the ``id`` field on each entry). To rotate a secret to a new value rather than remove it, call ``set_integration_secret`` with the same name. Args: ctx: MCP context (injected by FastMCP). secret_id: ID of the secret to delete.

  • Delete matching criterion

    Delete a matching criterion from a field. Use this to remove an unwanted lookup path — e.g. dropping a redundant fuzzy match when an exact-match criterion is enough. Removing the last criterion on a field will leave its attached data source effectively inert until a new criterion is added. To just change a criterion's settings use ``update_matching_criterion``; to detach the data source from the field entirely, do that via the field update tool rather than deleting criteria here. Args: ctx: MCP context (injected by FastMCP). matching_criterion_id: ID of the criterion to delete.

  • Delete tag

    Delete a tag from its workspace. Use this only when the user explicitly wants the tag gone — e.g. "delete the Urgent tag". The tag is removed from every document that carried it; the documents themselves are untouched. To take the tag off specific documents while keeping it available for others, use ``remove_tag_from_documents`` instead. Args: ctx: MCP context (injected by FastMCP). tag_id: ID of the tag to delete.

  • Delete validation rule

    Delete a validation rule from a document type. Use this when the user wants to remove a rule entirely. If the user only wants to disable a rule temporarily, prefer ``update_validation_rule`` with ``enabled=False`` — disabled rules can be re-enabled later. To delete a field instead, use ``delete_field``; to delete the whole document type, use ``delete_document_type``. Args: ctx: MCP context (injected by FastMCP). validation_rule_id: ID of the validation rule to delete.

  • Deploy integration version

    Snapshot the integration's current code as a new version and deploy it. Call this immediately after every successful ``update_integration`` that changed ``python_code`` — it MUST be the next tool call. Code saved on the integration is not live until deployed, and ``run_integration`` always executes the deployed version, so skipping this step means tests run stale code and real document events still fire the previous version. To roll back a bad deploy, use ``revert_integration_version`` with a prior version's ID from ``list_integration_versions``. To enable or disable an already-deployed integration, use ``update_integration`` with the ``enabled`` flag. Args: ctx: MCP context (injected by FastMCP). integration_id: ID of the integration to deploy.

  • Revert integration version

    Roll an integration back to a previous version and redeploy it. Use this when a recent deploy introduced a regression and the user wants to restore a known-good version. The selected version's code becomes both the working code on the integration and the live deployed version in one step — there is no separate redeploy needed. Find ``version_id`` via ``list_integration_versions`` (the ``is_published`` flag marks the currently-live one — pick a different snapshot to revert to). To deploy newly-edited code rather than an older snapshot, use ``deploy_integration_version``. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to revert. version_id: ID of the version snapshot to restore.

  • Run integration

    Execute an integration against one document as a test run. Use this to verify a freshly-deployed integration before enabling it for live traffic, or to re-test after a fix. The run executes the currently-deployed version, so it must be preceded by a successful ``deploy_integration_version`` for the latest code to take effect. The run is flagged as a test and does not count as a production invocation. ``document_id`` must be the **numeric** document ID (e.g. ``"1000003"``), not the alphabetic identifier / slug. Inspect the resulting run with ``get_integration_run`` for full logs; ``list_integration_runs`` shows history with truncated logs. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to run. document_id: Numeric document ID to feed into the run.