Tools
This is a reference catalogue. Tools cannot be configured or run from this page.
Bulk create data source values
AFFINDA_MCP_BULK_CREATE_DATA_SOURCE_VALUESAppend many new rows to a data source in one call. Use this whenever the user provides more than one row to add — pasted lists, parsed CSV/JSON content, multi-row asks. Validation runs per-row before any save (missing key, duplicate within batch, duplicate against existing rows); if ANY row fails, NO rows are saved and you get per-row errors back. Fix the rejected rows and retry the whole batch. Do not loop ``create_data_source_value`` for multi-row asks — every single-row call is a full replace-all under the hood. There is no bulk update or bulk delete; this tool only appends. Maximum 500 rows per call. Args: ctx: MCP context (injected by FastMCP). data_source_id: ID of the data source to append to. values: Native list of row objects (NOT a JSON string — unlike the single-row tools). Each row must include the data source's ``key_property`` with a non-empty value, e.g. ``[{"value": "ACME", "label": "Acme Corp"}, {"value": "GLOBEX", "label": "Globex Inc"}]``.
Bulk create fields
AFFINDA_MCP_BULK_CREATE_FIELDSCreate many fields on a document type in one call. Use this whenever the user describes more than one field they want to add (e.g. "create invoiceNumber, invoiceDate, totalAmount"), or when populating an existing document type from a user description. Cleaner than looping ``create_field`` because the user sees one confirmation. When the document type is brand new and sample documents are uploaded, prefer ``populate_fields_from_documents`` — it infers the schema from actual content. For a single named field, ``create_field`` is fine. For child fields under a ``group`` or ``table`` parent, use ``create_field`` per child (each needs its own ``parent_id``). Tables: this tool can create the table itself (include it in the flat list with ``field_type="table"`` and ``multiple=True``), but it CANNOT create the columns. The backend auto-creates a ``rows`` group child (``field_type="group"``, ``slug="rows"``, ``multiple=True``) under every new table; columns must then be added via ``create_field`` (singular) with ``parent_id`` set to the ``rows`` field id, not the table id. Do not manually create a ``rows`` field. All fields land in the same group (auto-resolved if omitted). Each field's schema mirrors ``create_field`` (slug must be camelCase, alphanumeric, lowercase first letter). Failures are reported per field — partial success is possible. Args: ctx: MCP context (injected by FastMCP). document_type_id: Parent document type ID. fields: Field definitions. Pass as a native list of dicts/models, not a JSON-encoded string. Max 50 per call. field_group_id: Place all fields in a specific group. Auto-resolves to the last existing group (or a new "Details" group) if omitted.
Create api token
AFFINDA_MCP_CREATE_API_TOKENCreate a new long-lived Affinda API key for the current user. Returns the key exactly once — there is no way to retrieve it again, so surface it to the user immediately and tell them to save it. Each user can hold at most three keys. If they are already at the limit, this tool returns ``error="max_tokens_reached"`` and the agent should direct the user to revoke an existing key from ``the Settings page (the user-account one at /settings, not org settings) under the "API Keys" card`` in the portal rather than retrying. The agent cannot list, rename, or revoke keys — those stay in the app. The tool takes no arguments: the user is identified from the auth token, and the new key has no name or expiry. Users wanting either should manage the key in the portal afterwards.
Create connect token
AFFINDA_MCP_CREATE_CONNECT_TOKENMint an OAuth connect token + URL so the user can authorise a service. Use this when ``list_integration_connections`` shows no usable connection for the service the user wants. The returned ``connect_link_url`` is presented to the user (Affinda's UI renders it as a "Connect" button); once they finish the flow the connection becomes active and can be attached to an integration via ``add_connection_to_integration``. To check whether an existing connection still works rather than creating a new auth flow, use ``test_connection``. Args: ctx: MCP context (injected by FastMCP). connection_id: ID of the connection record to issue a token for.
Create data source
AFFINDA_MCP_CREATE_DATA_SOURCECreate an empty data source (lookup table) in an organization. Use this to set up a new enum-style lookup the user will populate afterwards — typical scenarios are "create a Suppliers list", "I need a Currencies data source", or any net-new reference table. The resulting data source is empty; add rows via ``create_data_source_value`` (one row) or ``bulk_create_data_source_values`` (many rows). To attach the data source to a field for extraction, update the field's ``mapping_data_source_id``. The default schema has ``value`` (key), ``label`` (display), and ``description``; pass ``schema_definition`` only when the user genuinely needs extra columns. Args: ctx: MCP context (injected by FastMCP). name: Display name (e.g. ``Suppliers``, ``Currencies``). organization_id: Owning organization ID. key_property: Property that uniquely identifies each row. Default ``value``. Lowercase keys (``email`` not ``Email``); must exist in the schema. display_property: Property shown in the UI. Default ``label``. schema_definition: Optional JSON Schema Draft 7 string. Omit to use the default ``value``/``label``/``description`` shape.
Create data source value
AFFINDA_MCP_CREATE_DATA_SOURCE_VALUEAdd one new row to a data source. Use this for conversational, one-at-a-time additions: "add supplier ACME", "append currency JPY". Fails with ``duplicate_key`` if the row's key collides with an existing row — switch to ``update_data_source_value`` to modify the existing row instead. For more than one row in the same request, use ``bulk_create_data_source_values`` — every single-row call is a full replace-all under the hood, so looping this tool is wasteful and increases the chance of clobbering concurrent edits. Args: ctx: MCP context (injected by FastMCP). data_source_id: ID of the data source to append to. value: The new row as a JSON-encoded object string, e.g. ``'{"value": "ACME", "label": "Acme Corp"}'``. Must include a non-empty value for the data source's ``key_property`` — call ``get_data_source`` first if unsure which property that is.
Create document type
AFFINDA_MCP_CREATE_DOCUMENT_TYPECreate a new document type (extraction template) in an organization. Use this for any net-new document category the user wants to extract: Invoice, Purchase Order, Bank Statement, Contract, etc. A document type holds the field schema and validation rules used to extract structured data from uploaded documents. Common type names (Invoice, Receipt, Resume, Payslip, ...) silently auto-populate the full schema from a platform template at creation — there is no signal in the response. So after creation, always call ``list_fields``. If fields already exist, do not create the standard fields again and do not call ``populate_fields_from_documents``. If none exist, infer a schema from sample documents with ``populate_fields_from_documents``, or add fields with ``create_field`` / ``bulk_create_fields``. If you just uploaded a sample that has no document type yet, pass its ``document_id``. That assigns the document to the new type. If the type already has fields after create, the document is extracted — do not also call ``reassign_document_type`` for that document. For resumes / CVs, Affinda has a dedicated resume pipeline; use ``create_recruit_workspace`` instead. To make a created type available in a workspace, follow up with ``assign_document_type_to_workspace``. Args: ctx: MCP context (injected by FastMCP). name: Display name (e.g. "Invoice", "Purchase Order"). organization_id: Owning organization ID. disable_confirmation_if_validation_rules_fail: Block manual confirmation when validation fails. Default ``False``. document_id: Optional JSON:API id of a sample document with no type assigned yet. Assigns that document to the new type, and extracts it when the type already has fields.
Create field
AFFINDA_MCP_CREATE_FIELDCreate a single field on a document type. Use this when the user explicitly names ONE field they want extracted (e.g. "add a Vendor Email field"), or when adding a child field under an existing ``group``/``table`` parent. For multiple fields at once use ``bulk_create_fields`` — it's one confirmation, not many. For a brand-new document type with sample documents available, prefer ``populate_fields_from_documents`` (infers the schema from content). For a heading/section to organize fields, use ``create_field_group``, not this tool with ``field_type="group"``. A ``group`` field is for repeating structured data (e.g. line items with multiple=true). ``table`` is preferred over ``group`` when the data is a row/column grid. Parent fields MUST be ``group`` or ``table`` — children with any other parent type will break. Slug must be camelCase, alphanumeric only, lowercase first letter (``invoiceNumber`` — not ``invoice_number`` or ``Invoice Number``). If neither ``field_group_id`` nor ``parent_id`` is provided, the field is placed in the last existing field group, or a new "Details" group is created. Args: ctx: MCP context (injected by FastMCP). slug: camelCase API identifier (e.g. ``invoiceNumber``). label: Human-readable label (e.g. "Invoice Number"). field_type: Data type. Pick ``float`` for any numeric value (currency, quantity, percentage, count) — it is the product's single numeric type. ``integer`` and ``decimal`` are accepted but normalised to ``float`` (the UI cannot display them). Use ``group``/``table`` only for parents of nested children. document_type_id: Parent document type ID. field_group_id: Place under a specific group. Auto-resolved if omitted. parent_id: Set for child fields under a ``group``/``table`` parent. description: Extraction prompt — describe what to look for, where, and alternative labels. Omit for obvious fields. enabled: Default ``True``. Rarely set to ``False`` on create. multiple: ``True`` when the field has multiple distinct values per document (e.g. several work-experience entries). Tables and their row children almost always set this. no_rect: Skip annotation rectangle (calculated/manual fields). manual_entry: Field is filled by the user, not extracted. options: Allowed values for ``options`` field type. transformation_prompt: Natural-language reformat instruction (e.g. "Convert to uppercase"). Sets up an LLM transformation and auto-generates the code. Use only when the user explicitly asks to reformat. mapping_data_source_id: Attach a mapping data source for ``enum`` field extraction. Attaching a data source forces ``field_type`` to ``enum`` (see below) — a data source only functions on an enum field. decimal_places: For numeric (``float``) fields only — how many decimal places to round/display the value to. Use ``0`` for counts/quantities, ``2`` for currency, or omit to keep all significant digits. Ignored for non-numeric field types.
Create field group
AFFINDA_MCP_CREATE_FIELD_GROUPCreate a field group (heading/section) on a document type. Use this when the user wants to organise fields into named sections in the UI (e.g. "Header", "Line Items", "Payment Details"). Field groups are purely visual — they have no effect on extraction. Move fields into a new group via ``update_field`` with ``field_group_id``. Do NOT confuse this with a ``group``-typed field, which is a repeating-data parent field for nested children. For that, use ``create_field`` with ``field_type="group"``. For a row/column grid, use ``create_field`` with ``field_type="table"`` instead. Args: ctx: MCP context (injected by FastMCP). document_type_id: Parent document type ID. label: Section heading shown in the UI.
Create integration
AFFINDA_MCP_CREATE_INTEGRATIONCreate a new integration in an organization. Use this for any net-new integration: a customer wants documents to fan out to Google Sheets, Slack, Salesforce, etc. The integration is created with no Python code and no attached connections. The trigger event and the workspace / document type scope are optional here. Typical sequence after this call: ``update_integration`` to set the code; ``add_connection_to_integration`` to attach a service; ``deploy_integration_version`` to make it live; ``run_integration`` to test against a real document. Create only one integration at a time and wait for the response before starting another. Args: ctx: MCP context (injected by FastMCP). organization_id: Owning organization ID. name: Integration display name. description: Short summary of what the integration does. Optional. event: Trigger event — ``document.parse.completed`` or ``document.validate.completed``. workspace_id: Scope to a specific workspace. document_type_id: Scope to a specific document type.
Create matching criterion
AFFINDA_MCP_CREATE_MATCHING_CRITERIONAdd a matching criterion to a field with an attached data source. Use this to refine or extend how extracted values get mapped to data source records — typical scenarios are adding a second matching path (e.g. exact-match a code AND fuzzy-match a label), cross-field matching (use a "Supplier Code" field's value to look up the Suppliers data source), or tightening matching to ``term`` for codes that must be exact. A default criterion is created automatically when a data source is first attached, so this tool is for adding extra criteria. To change an existing criterion's settings use ``update_matching_criterion``; to remove one use ``delete_matching_criterion``. The field must already have a data source attached. Args: ctx: MCP context (injected by FastMCP). field_id: Field that owns the criterion. Must have a data source attached. source_field_id: Field whose extracted value drives the lookup. Set equal to ``field_id`` for self-matching (the common case), or a different field for cross-field matching. data_source_property: Property in the data source schema to compare against (e.g. ``label``, ``value``, ``code``). match_type: ``match`` (fuzzy, default — tolerates typos), ``match_phrase`` (partial phrase), or ``term`` (exact only — best for codes). required: If ``True``, an extracted value with no match here is rejected rather than returned unmatched. required_strict: Stricter variant of ``required``; enable only on explicit user request. field_attribute: Source-field attribute to read from. Only needed when ``source_field_id`` points to a JSON or ENUM-type field.
Create recruit workspace
AFFINDA_MCP_CREATE_RECRUIT_WORKSPACECreate a fully-configured Recruitment workspace in one call. Use this whenever the user is doing recruitment, hiring, candidate search, resume parsing, CV summarisation, or job-description analysis. It creates a "Recruitment" workspace pre-loaded with four document types from Affinda templates — Resume, Job Description, Redacted Resume, Resume Summary — with the right OCR / splitting / classification / model-memory settings for that domain. After this call the user can immediately upload documents. This is idempotent at the workspace level: if a "Recruitment" workspace already exists in the organization it is updated in place rather than duplicated, so it's safe to call again. For any non-recruitment workspace use ``create_workspace`` and pick settings explicitly. Use this only when the user's intent is clearly resume / hiring related; using it elsewhere creates an oddly-named workspace with templates that don't match the use case. Args: ctx: MCP context (injected by FastMCP). organization_id: Owning organization ID.
Create tag
AFFINDA_MCP_CREATE_TAGCreate a new tag in a workspace. Use this when the user wants a new label to organise documents — e.g. "create an Urgent tag", "add a tag for Q3 invoices". The tag starts with no documents attached; apply it with ``add_tag_to_documents``. Tag names must be unique within a workspace. Check ``list_tags`` first if you're unsure whether the tag already exists. Args: ctx: MCP context (injected by FastMCP). name: Tag name (e.g. ``Urgent``, ``Q3 Invoices``). Max 256 chars. workspace_id: Workspace the tag belongs to.
Create validation rule
AFFINDA_MCP_CREATE_VALIDATION_RULECreate a validation rule for a document type. Use this to add a new business-logic check (cross-field, format, range, required, etc.) once you have confirmed via ``list_validation_rules`` that no existing rule already covers the requirement. The system auto-generates the validation code from the prompt after creation. Split distinct logical checks (e.g. "required" + "must be a certain length") into separate rules. When updating an existing rule, use ``update_validation_rule`` and merge the new requirement into the existing prompt. Validation-rule prompts should reference fields by numeric ID using the ``@<field_id>`` syntax (call ``list_fields`` first to get IDs). **For data inside a table or group, always reference the CHILD (cell) field IDs, NOT the parent field ID.** A field is a parent when its ``field_type`` is ``table``, ``table_deprecated``, or ``group`` and its ``children`` list is non-empty; the parent is just the row container and holds no values of its own. A rule written against the parent ID validates the container, not the data, and almost always misbehaves. For a ``lineItems`` table (id=4820) with children ``quantity`` (4822), ``unitPrice`` (4823), ``amount`` (4824): - ✅ ``prompt="@4822 must be > 0"`` and ``field_ids=["4822"]`` - ✅ ``prompt="@4823 * @4822 must equal @4824"`` - ❌ ``prompt="@4820 must not be empty"`` (validates the container) - ❌ ``field_ids=["4820"]`` (the table, not its cells) The same applies to ``group`` parents — reference the children. If the user describes a check at row level ("each line item must have…"), translate it to references on the child cells, not the parent. Say in the prompt what to do when a field is missing, e.g. ``"@4821 is required"`` or ``"@4821 must be present unless @4825 contains 'ACME'"``. The generated code applies exactly that. If the prompt does not say, a check whose fields are missing is skipped. Args: ctx: MCP context (injected by FastMCP). document_type_id: Parent document type ID. prompt: Natural-language rule using ``@<field_id>`` references, e.g. ``"@4821 must be present and @4825 must be > 0"``. field_ids: Fields the rule validates. Pass as a native list, not a JSON string. Optional — fields can also be referenced inline in the prompt. enabled: Default ``True``.
Create workspace
AFFINDA_MCP_CREATE_WORKSPACECreate 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).
Populate fields from documents
AFFINDA_MCP_POPULATE_FIELDS_FROM_DOCUMENTSInfer and create the field schema for a document type from sample documents. Use this when the document type has **no fields yet** and you have one or more processed documents of that type. Call ``list_fields`` first; if any fields already exist, do **not** call this tool — it duplicates them. Use ``create_field`` / ``bulk_create_fields`` to add named extras instead. Pass 1–10 document IDs. The ML pipeline reads the source files, suggests names / types / structure (including tables and nested groups), writes those fields onto the type, then extracts the samples. Do **not** use this to invent a schema from a verbal description with no samples — that is ``bulk_create_fields`` / ``create_field``. Documents must have finished load/OCR (and splitting/classification if those are enabled) before you pass their IDs. Wait with ``wait_for_document_processing``. Extra IDs beyond 10 are ignored; pass the most representative samples. After this succeeds, call ``list_fields`` and show the user what was created so they can refine. Args: ctx: MCP context (injected by FastMCP). document_type_id: Document type that currently has no fields. document_ids: Processed document IDs to analyse. At least one required; capped at 10. instructions: Short natural-language steer (≤15 words), e.g. "focus on financial fields". Optional.