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.

  • Create workspace

    Create a new workspace with chosen processing settings. Use this for any net-new workspace: a customer onboarding, an additional document category, or a sandbox. A workspace groups documents that share processing rules — OCR mode, splitting, classification, model-memory strategy. Pick a short descriptive ``name`` (e.g. "Invoices", "Loan Applications"); names are capped at 40 characters by the server. For the standard recruitment use case (resumes, job descriptions), prefer ``create_recruit_workspace``: it builds a fully-configured workspace with the right document types in one call. Use plain ``create_workspace`` for everything else. Splitting requires a splitter: when ``enable_document_splitting`` is ``True``, list ``list_document_splitters`` first and pass a ``document_splitter_id``. The default "General Document Splitter" is a safe choice when the user hasn't trained a custom one. Args: ctx: MCP context (injected by FastMCP). name: Workspace display name. Max 40 chars. organization_id: Owning organization ID. visibility: ``organization`` (all members can see) or ``private`` (only explicitly added members). Default ``organization``. ocr_mode: ``auto-detect`` (default — only OCR when needed), ``always-full`` (best for scans), ``always-partial`` (trust embedded text but still OCR for layout), or ``skip`` (only embedded text — native digital PDFs only). enable_document_splitting: Set ``True`` for "packs", "bundles", or any multi-document file. Safe to leave on even if some uploads are single documents. document_splitter_id: Required when splitting is enabled. List available IDs via ``list_document_splitters``. enable_document_classification: Default ``True``. Recommended on even with a single document type; only disabled by explicit user request. reject_duplicates: Default ``False``. Rejects re-uploads matching an existing document in the workspace. model_memory_strategy: ``auto`` (default — system curates training examples), ``manual`` (only explicitly marked docs train), ``always`` (every validated doc trains — small, consistent sets only).

  • 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.

  • Get data source

    Get one data source by ID — name, schema, and key/display properties. Use this when you already know the ``data_source_id`` and need its metadata: typically to read ``key_property`` before adding/updating rows, to inspect the schema before deciding which property to match against, or to confirm the data source exists. Returns ``data=null`` with ``error="not_found"`` if the ID does not match. For the rows stored inside the data source use ``list_data_source_values``. To enumerate data sources in an organization use ``list_data_sources``. Args: ctx: MCP context (injected by FastMCP). data_source_id: ID of the data source to fetch.

  • Get document

    Get one document by ID — state, workspace, document type, and basic metadata. Use this when you already have a ``document_id`` and need a lightweight summary, e.g. to confirm a document exists, check its processing state, or look up which workspace and document type it belongs to. Returns ``data=null`` with ``error="not_found"`` if no document matches. For extracted field values (text, parsed values, confidence) use ``get_document_extraction`` instead. To enumerate documents, use ``list_documents``. Args: ctx: MCP context (injected by FastMCP). document_id: ID of the document to fetch.

  • Get document extraction

    Get the extracted data for one document — raw text plus all field values. Use this to review how a specific document was extracted: every field value with its confidence score, preserving nested structure (groups, tables). Typical scenarios are answering "what did we extract from this doc?", spot-checking a document the user is looking at, or confirming a value before suggesting a fix. To diagnose *why* a document was extracted a certain way, check ``reference_document_id`` in the response: when set, extraction was guided by that model-memory document, used as an in-context example. Call this tool again with that ID to see the example's confirmed (ground-truth) values — a surprising extraction often traces back to how the equivalent field was verified on the reference document. Review one document at a time. Do NOT loop this over many documents for bulk export — direct the user to the "Download extraction" UI in the workspace's documents view instead. To spot-check one field across many documents, use ``list_recent_field_annotations``. For just state and metadata (no extraction), use ``get_document``. Only works once the document has finished processing and been classified. Args: ctx: MCP context (injected by FastMCP). document_id: ID of the document to inspect.

  • Get document page images

    View a document's pages as rendered images — see the actual document, not just OCR text. Use this when the visual appearance of the document matters and text alone is ambiguous: layout questions, checkboxes and selection marks, signatures, stamps, handwriting, logos, or diagnosing why extraction misread something. The images show each page as it appears in the document review UI. With ``show_annotations`` the extracted annotations are drawn on top of each page as colored rectangles tagged with their field slug — use this to check *where* a value was read from: wrong instance picked, value attributed to the wrong field, or table rows/columns mapped incorrectly. On dense documents, pass ``field_slugs`` to only draw the fields you are debugging (a table's slug also draws its cells). Images are expensive (in tokens) — request only the pages you need, at most 5 per call. For extracted values and raw text, use ``get_document_extraction`` instead; only reach for images when text output isn't enough. Args: ctx: MCP context (injected by FastMCP). document_id: ID of the document to view. page_indices: Zero-based page indices to fetch (e.g. ``[0]`` for the first page). Omit to get the first 5 pages. show_annotations: Draw the extracted annotations on the page images as rectangles labelled with their field slug. field_slugs: Only draw annotations for these field slugs (implies ``show_annotations``). Omit to draw all annotated fields.

  • Get document type

    Get one document type by ID — name, organization, and counts only. Use this when you already know the ``document_type_id`` and need a lightweight summary, e.g. to confirm the type exists or display headline counts. Returns ``data=null`` with ``error="not_found"`` if no document type matches. For settings (validation behaviour, redact button, auto-refresh) call ``get_document_type_details`` instead. For its fields, call ``list_fields``. To enumerate types in an org, use ``list_document_types``. Args: ctx: MCP context (injected by FastMCP). document_type_id: ID of the document type to fetch.

  • Get document type details

    Get a document type's full configuration — settings + counts. Use this whenever you need to read or reason about document-type settings: validation-blocking confirmation, the redact button, and auto-refresh of validation results. Typical scenarios are answering "what's the current config?" and reading the current value before computing a patch for ``update_document_type``. For just the headline counts (no settings) prefer ``get_document_type``. Fields and validation rules live on separate endpoints — call ``list_fields`` or ``list_validation_rules``. Args: ctx: MCP context (injected by FastMCP). document_type_id: ID of the document type to fetch.

  • Get field

    Get one field by ID — full settings, formatter, and relationships. Use this when you already know the ``field_id`` and need details that ``list_fields`` doesn't surface compactly (formatter config, transformation config, attached data source). Returns ``data=null`` with ``error="not_found"`` if no field matches. To enumerate every field on a document type, use ``list_fields`` instead — it groups results and shows hierarchy. To modify a field after reading, use ``update_field``. Args: ctx: MCP context (injected by FastMCP). field_id: ID of the field to fetch.

  • Get field group

    Get one field group by ID — label, position, parent document type. Use this when you already know the ``field_group_id`` and want a direct lookup. Most callers should prefer ``list_fields``, which returns every group on a document type along with its fields in one call — usually what's actually needed. Args: ctx: MCP context (injected by FastMCP). field_group_id: ID of the field group to fetch.

PreviousPage 2 / 5Next