Volver al catálogo

Affinda MCP

affinda_mcp

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

Acciones
85
Triggers
0
Autenticación
—
OAuth gestionado
No
Información técnica: el detalle de parámetros, schemas y triggers de esta página está pensado para equipos de integración. Si solo necesitas saber si tu herramienta favorita está disponible, basta con ver la lista de acciones.

Acciones disponibles (85)

Cada acción es una operación que el agente puede ejecutar contra este conector. Haz clic en una acción para ver sus parámetros.

Add connection to integrationAFFINDA_MCP_ADD_CONNECTION_TO_INTEGRATIONAcción

Attach an existing service connection to an integration. Use this once the integration is created and the user has an authenticated connection for the target service: it gives the integration's Lambda code permission to call that service via the connection's ``account_id``. Idempotent — adding an already-attached connection is a no-op. Other attached connections are preserved. Find ``connection_id`` via ``list_integration_connections``; if no suitable connection exists, run an OAuth flow first via ``list_pipedream_apps`` and ``create_connect_token``. To detach, use ``remove_connection_from_integration``. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to attach the connection to. connection_id: Connection to attach.

Parámetros de entrada

  • connection_idstringObligatorio
  • integration_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Updated integration, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the integration was updated successfully

Add tag to documentsAFFINDA_MCP_ADD_TAG_TO_DOCUMENTSAcción

Apply an existing tag to one or more documents. Use this to label documents — e.g. "tag these three invoices as Urgent". Documents that already carry the tag are unaffected (the operation is idempotent). All documents must belong to the same workspace as the tag. The tag must already exist — find its ID with ``list_tags`` or create it first with ``create_tag``. Args: ctx: MCP context (injected by FastMCP). tag_id: ID of the tag to apply. document_ids: Documents to tag.

Parámetros de entrada

  • tag_idstringObligatorio
  • document_idsstring[]Obligatorio

Parámetros de salida

  • countinteger

    Number of documents affected

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the action succeeded

Archive documentsAFFINDA_MCP_ARCHIVE_DOCUMENTSAcción

Move documents to ``archived`` state. Use this to clear processed documents out of the active list without rejecting them — e.g. "archive last quarter's invoices". Archived documents stay searchable and retrievable but are filtered out of default workspace views. To flag documents as unusable, use ``reject_documents``. To sign off on documents in review, use ``confirm_documents``. Archiving is not deletion: there is no hard-delete tool in the public API. Args: ctx: MCP context (injected by FastMCP). document_ids: Documents to archive.

Parámetros de entrada

  • document_idsstring[]Obligatorio

Parámetros de salida

  • countinteger

    Number of documents affected

  • errorany

    Error message if action failed

  • successbooleanObligatorio

    Whether the action succeeded

Assign document type to workspaceAFFINDA_MCP_ASSIGN_DOCUMENT_TYPE_TO_WORKSPACEAcción

Make a document type available for use in a workspace. Use this immediately after creating a document type while the user is on a workspace, or whenever the user wants an existing type to be usable in a different workspace. After assignment, documents uploaded to the workspace can be classified as this type and extracted with its field schema. This does not move the type — types belong to an organization, and a type can be assigned to many workspaces. To remove the assignment later, manage it via the workspace's classification settings; there is no separate unassign tool. To delete the type entirely, use ``delete_document_type``. Args: ctx: MCP context (injected by FastMCP). document_type_id: ID of the document type to assign. workspace_id: ID of the workspace that should use it.

Parámetros de entrada

  • workspace_idstringObligatorio
  • document_type_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if assignment failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the document type was assigned successfully

Bulk create data source valuesAFFINDA_MCP_BULK_CREATE_DATA_SOURCE_VALUESAcción

Append 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"}]``.

Parámetros de entrada

  • valuesobject[]Obligatorio
  • data_source_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if the save failed for all rows

  • messageany

    Summary message

  • resultsobject[]Obligatorio

    Per-row outcomes (in input order)

  • successbooleanObligatorio

    Whether every row was appended

  • total_createdintegerObligatorio

    Number of rows successfully appended

  • total_requestedintegerObligatorio

    Number of rows in the request

Bulk create fieldsAFFINDA_MCP_BULK_CREATE_FIELDSAcción

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

Parámetros de entrada

  • fieldsobject[]Obligatorio
  • field_group_idany
  • document_type_idstringObligatorio

Parámetros de salida

  • messageany

    Summary message

  • resultsobject[]Obligatorio

    Result for each field in the request

  • successbooleanObligatorio

    Whether all fields were created successfully

  • total_createdintegerObligatorio

    Number of fields successfully created

  • total_requestedintegerObligatorio

    Total number of fields requested

Confirm documentsAFFINDA_MCP_CONFIRM_DOCUMENTSAcción

Mark documents as validated, moving them from ``review`` to ``validated``. Use this when the user has reviewed extracted values and wants to sign off on a batch — e.g. "confirm these five invoices". Depending on the workspace's model-memory strategy, confirmed documents may also be added to model memory and used as future training examples. To reject obviously bad documents, use ``reject_documents``. To remove documents from active work without rejecting them, use ``archive_documents``. To change a misclassified document's type, use ``reassign_document_type``. Args: ctx: MCP context (injected by FastMCP). document_ids: Documents to confirm. Must already be in ``review``.

Parámetros de entrada

  • document_idsstring[]Obligatorio

Parámetros de salida

  • countinteger

    Number of documents affected

  • errorany

    Error message if action failed

  • successbooleanObligatorio

    Whether the action succeeded

Create api tokenAFFINDA_MCP_CREATE_API_TOKENAcción

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

Parámetros de entrada

Sin parámetros.

Parámetros de salida

  • keyany

    The newly created API key. Only returned once — show it to the user and tell them to save it; it cannot be retrieved later.

  • errorany

    Error code if creation failed

  • messageany

    Human-readable error or success message

  • successbooleanObligatorio

    Whether the API key was created

  • identifierany

    Stable identifier for the token (used by the portal for revoke).

  • last_charactersany

    The trailing characters of the key, displayed alongside the masked value in the portal.

Create connect tokenAFFINDA_MCP_CREATE_CONNECT_TOKENAcción

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

Parámetros de entrada

  • connection_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the token was created successfully

  • expires_atany

    Token expiration timestamp

  • connect_link_urlany

    URL for the user to complete the OAuth flow

Create data sourceAFFINDA_MCP_CREATE_DATA_SOURCEAcción

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

Parámetros de entrada

  • namestringObligatorio
  • key_propertystring
  • organization_idstringObligatorio
  • display_propertystring
  • schema_definitionany

Parámetros de salida

  • dataanyObligatorio

    Created data source, or null if failed

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether creation succeeded

Create data source valueAFFINDA_MCP_CREATE_DATA_SOURCE_VALUEAcción

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

Parámetros de entrada

  • valuestringObligatorio
  • data_source_idstringObligatorio

Parámetros de salida

  • dataany

    The affected value record, or null if deleted

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Create document typeAFFINDA_MCP_CREATE_DOCUMENT_TYPEAcción

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

Parámetros de entrada

  • namestringObligatorio
  • document_idany
  • organization_idstringObligatorio
  • disable_confirmation_if_validation_rules_failboolean

Parámetros de salida

  • dataanyObligatorio

    Created document type, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the document type was created successfully

Create fieldAFFINDA_MCP_CREATE_FIELDAcción

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

Parámetros de entrada

  • slugstringObligatorio
  • labelstringObligatorio
  • enabledboolean
  • no_rectboolean
  • optionsany
  • multipleboolean
  • parent_idany
  • field_typestringObligatorioenum
    textfloatintegerdecimaldatedatetimedaterangeenumoptionsbooleancheckedboxtextcheckedboxboolean+8
  • descriptionany
  • manual_entryboolean
  • decimal_placesany
  • field_group_idany
  • document_type_idstringObligatorio
  • transformation_promptany
  • mapping_data_source_idany

Parámetros de salida

  • dataanyObligatorio

    Created field, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the field was created successfully

Create field groupAFFINDA_MCP_CREATE_FIELD_GROUPAcción

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

Parámetros de entrada

  • labelstringObligatorio
  • document_type_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Created field group, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the field group was created successfully

Create integrationAFFINDA_MCP_CREATE_INTEGRATIONAcción

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

Parámetros de entrada

  • namestringObligatorio
  • eventany
  • descriptionstring
  • workspace_idany
  • organization_idstringObligatorio
  • document_type_idany

Parámetros de salida

  • dataanyObligatorio

    Created integration, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the integration was created successfully

Create matching criterionAFFINDA_MCP_CREATE_MATCHING_CRITERIONAcción

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

Parámetros de entrada

  • field_idstringObligatorio
  • requiredboolean
  • match_typestringenum
    matchmatch_phraseterm
  • field_attributeany
  • required_strictboolean
  • source_field_idstringObligatorio
  • data_source_propertystringObligatorio

Parámetros de salida

  • dataanyObligatorio

    The matching criterion, or null if failed

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Create recruit workspaceAFFINDA_MCP_CREATE_RECRUIT_WORKSPACEAcción

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

Parámetros de entrada

  • organization_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Created recruitment workspace, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Success or error message

  • successbooleanObligatorio

    Whether the workspace was created successfully

Create tagAFFINDA_MCP_CREATE_TAGAcción

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

Parámetros de entrada

  • namestringObligatorio
  • workspace_idstringObligatorio

Parámetros de salida

  • dataany

    The affected tag, or null if deleted/failed

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Create validation ruleAFFINDA_MCP_CREATE_VALIDATION_RULEAcción

Create 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``.

Parámetros de entrada

  • promptstringObligatorio
  • enabledboolean
  • field_idsany
  • document_type_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Created validation rule, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the validation rule was created successfully

Create validation runAFFINDA_MCP_CREATE_VALIDATION_RUNAcción

Run a validation rule against a document and refresh its results. Use this immediately after ``create_validation_rule`` or ``update_validation_rule`` so the user sees fresh validation results in the UI without manually re-validating each document. Executes the rule's logic against the document's annotations and creates/updates validation results. For creating or modifying the rule itself use ``create_validation_rule`` / ``update_validation_rule``; this tool only triggers an evaluation pass. If ``document_id`` is omitted the tool auto-picks one document of the rule's document type — convenient for quick spot-checks but won't cover the whole backlog. Pass an explicit ``document_id`` for targeted reruns. Args: ctx: MCP context (injected by FastMCP). validation_rule_id: Rule to evaluate. document_id: Specific document to validate. If omitted, one is chosen automatically from the rule's document type. document_type_id: Override the auto-resolved document type when picking a document. Ignored when ``document_id`` is given.

Parámetros de entrada

  • document_idany
  • document_type_idany
  • validation_rule_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if run failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the validation run completed successfully

Create workspaceAFFINDA_MCP_CREATE_WORKSPACEAcción

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

Parámetros de entrada

  • namestringObligatorio
  • ocr_modestringenum
    auto-detectalways-fullalways-partialskip
  • visibilitystringenum
    organizationprivate
  • organization_idstringObligatorio
  • reject_duplicatesboolean
  • document_splitter_idany
  • model_memory_strategystringenum
    automanualalways
  • enable_document_splittingboolean
  • enable_document_classificationboolean

Parámetros de salida

  • dataanyObligatorio

    Created workspace, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the workspace was created successfully

Delete data sourceAFFINDA_MCP_DELETE_DATA_SOURCEAcción

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.

Parámetros de entrada

  • data_source_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether deletion succeeded

Delete data source valueAFFINDA_MCP_DELETE_DATA_SOURCE_VALUEAcción

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.

Parámetros de entrada

  • keystringObligatorio
  • data_source_idstringObligatorio

Parámetros de salida

  • dataany

    The affected value record, or null if deleted

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Delete document typeAFFINDA_MCP_DELETE_DOCUMENT_TYPEAcción

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

Parámetros de entrada

  • delete_documentsboolean
  • document_type_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if deletion failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the document type was deleted successfully

Delete fieldAFFINDA_MCP_DELETE_FIELDAcción

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.

Parámetros de entrada

  • field_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if deletion failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the field was deleted successfully

Delete field groupAFFINDA_MCP_DELETE_FIELD_GROUPAcción

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.

Parámetros de entrada

  • field_group_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if deletion failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the field group was deleted successfully

Delete integrationAFFINDA_MCP_DELETE_INTEGRATIONAcción

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.

Parámetros de entrada

  • integration_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if deletion failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the integration was deleted successfully

Delete integration secretAFFINDA_MCP_DELETE_INTEGRATION_SECRETAcción

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.

Parámetros de entrada

  • secret_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if deletion failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the secret was deleted successfully

Delete matching criterionAFFINDA_MCP_DELETE_MATCHING_CRITERIONAcción

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.

Parámetros de entrada

  • matching_criterion_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether deletion succeeded

Delete tagAFFINDA_MCP_DELETE_TAGAcción

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.

Parámetros de entrada

  • tag_idstringObligatorio

Parámetros de salida

  • dataany

    The affected tag, or null if deleted/failed

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Delete validation ruleAFFINDA_MCP_DELETE_VALIDATION_RULEAcción

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.

Parámetros de entrada

  • validation_rule_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if deletion failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the validation rule was deleted successfully

Deploy integration versionAFFINDA_MCP_DEPLOY_INTEGRATION_VERSIONAcción

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.

Parámetros de entrada

  • integration_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if deployment failed

  • messageany

    Success or error message

  • successbooleanObligatorio

    Whether the deployment succeeded

  • version_idany

    ID of the deployed version

Get data sourceAFFINDA_MCP_GET_DATA_SOURCEAcción

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.

Parámetros de entrada

  • data_source_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Data source details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get documentAFFINDA_MCP_GET_DOCUMENTAcción

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.

Parámetros de entrada

  • document_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Document details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get document extractionAFFINDA_MCP_GET_DOCUMENT_EXTRACTIONAcción

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.

Parámetros de entrada

  • document_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if the request failed

  • stateany

    Document state

  • fieldsobject

    Extracted fields keyed by slug. Scalar values look like ``{'parsed': ..., 'raw': ..., 'confidence': ...}``. Group fields are nested dicts with the same shape. Table fields are lists of row-dicts, one per row.

  • messageany

    Error message if the request failed

  • raw_textstring

    Plain text extracted from the document

  • file_nameany

    Original file name

  • identifierstringObligatorio

    The document's Affinda API identifier

  • document_idstringObligatorio

    The JSON:API document ID that was queried

  • reference_document_idany

    ID of the reference document — the model-memory document used as the in-context example when this document was extracted. Null if no example was used. To diagnose extraction issues, fetch the reference document's extraction and compare its confirmed values.

Get document page imagesAFFINDA_MCP_GET_DOCUMENT_PAGE_IMAGESAcción

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.

Parámetros de entrada

  • document_idstringObligatorio
  • field_slugsany
  • page_indicesany
  • show_annotationsboolean

Parámetros de salida

Sin parámetros.

Get document typeAFFINDA_MCP_GET_DOCUMENT_TYPEAcción

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.

Parámetros de entrada

  • document_type_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Document type details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get document type detailsAFFINDA_MCP_GET_DOCUMENT_TYPE_DETAILSAcción

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.

Parámetros de entrada

  • document_type_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Document type with full settings, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get fieldAFFINDA_MCP_GET_FIELDAcción

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.

Parámetros de entrada

  • field_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Field details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get field groupAFFINDA_MCP_GET_FIELD_GROUPAcción

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.

Parámetros de entrada

  • field_group_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Created field group, or null if failed

  • errorany

    Error code if creation failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the field group was created successfully

Get integrationAFFINDA_MCP_GET_INTEGRATIONAcción

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.

Parámetros de entrada

  • integration_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Integration with connections, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get integration runAFFINDA_MCP_GET_INTEGRATION_RUNAcción

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.

Parámetros de entrada

  • integration_run_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Integration run details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get usageAFFINDA_MCP_GET_USAGEAcción

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.

Parámetros de entrada

  • end_dateany
  • start_dateany
  • workspace_idany
  • organization_idstringObligatorio
  • document_type_idany

Parámetros de salida

  • endstring

    Inclusive end of the reported period (YYYY-MM-DD).

  • errorany

    Error code if the request failed

  • itemsobject[]

    Per-day breakdown. Days with zero usage are omitted.

  • scopestring

    What the usage was scoped to: 'organization', 'workspace', or 'documentType'.

  • startstring

    Inclusive start of the reported period (YYYY-MM-DD).

  • totalinteger

    Total credits consumed over the period.

  • messageany

    Error message if the request failed

  • successboolean

    Whether the request succeeded

  • scope_identifierstring

    Identifier of the scoped entity.

Get validation ruleAFFINDA_MCP_GET_VALIDATION_RULEAcción

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.

Parámetros de entrada

  • validation_rule_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Validation rule details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get workspaceAFFINDA_MCP_GET_WORKSPACEAcción

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.

Parámetros de entrada

  • workspace_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Workspace details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

Get workspace detailsAFFINDA_MCP_GET_WORKSPACE_DETAILSAcción

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.

Parámetros de entrada

  • workspace_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Workspace details, or null if not found

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

List data sourcesAFFINDA_MCP_LIST_DATA_SOURCESAcción

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.

Parámetros de entrada

  • limitinteger
  • organization_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of data sources

  • countintegerObligatorio

    Number of data sources returned

List data source valuesAFFINDA_MCP_LIST_DATA_SOURCE_VALUESAcción

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.

Parámetros de entrada

  • limitinteger
  • data_source_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of value records

  • countintegerObligatorio

    Number of values returned

List documentsAFFINDA_MCP_LIST_DOCUMENTSAcción

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.

Parámetros de entrada

  • limitinteger
  • stateany
  • search_textany
  • workspace_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of documents

  • countintegerObligatorio

    Number of documents returned

List document splittersAFFINDA_MCP_LIST_DOCUMENT_SPLITTERSAcción

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.

Parámetros de entrada

  • organization_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of available document splitters

  • countintegerObligatorio

    Number of splitters returned

List document typesAFFINDA_MCP_LIST_DOCUMENT_TYPESAcción

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.

Parámetros de entrada

  • limitinteger
  • organization_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of document types

  • countintegerObligatorio

    Number of document types returned

List fieldsAFFINDA_MCP_LIST_FIELDSAcción

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.

Parámetros de entrada

  • document_type_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if request failed

  • messageany

    Error message if request failed

  • field_groupsobject[]Obligatorio

    Fields organized by field group

  • ungrouped_fieldsstring[]

    IDs of fields not belonging to any field group (e.g. child fields of table columns)

  • total_field_countintegerObligatorio

    Total number of fields returned

List integration connectionsAFFINDA_MCP_LIST_INTEGRATION_CONNECTIONSAcción

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.

Parámetros de entrada

  • organization_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of integration connections

  • countintegerObligatorio

    Number of connections returned

List integration runsAFFINDA_MCP_LIST_INTEGRATION_RUNSAcción

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.

Parámetros de entrada

  • limitinteger
  • integration_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of integration runs

  • countintegerObligatorio

    Number of runs returned

List integrationsAFFINDA_MCP_LIST_INTEGRATIONSAcción

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.

Parámetros de entrada

  • limitinteger
  • enabledany
  • workspace_idany
  • organization_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of integrations

  • countintegerObligatorio

    Number of integrations returned

List integration secretsAFFINDA_MCP_LIST_INTEGRATION_SECRETSAcción

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.

Parámetros de entrada

  • integration_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of secrets (names only)

  • countintegerObligatorio

    Number of secrets returned

List integration versionsAFFINDA_MCP_LIST_INTEGRATION_VERSIONSAcción

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.

Parámetros de entrada

  • limitinteger
  • integration_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of integration versions

  • countintegerObligatorio

    Number of versions returned

List matching criteriaAFFINDA_MCP_LIST_MATCHING_CRITERIAAcción

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.

Parámetros de entrada

  • field_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of matching criteria

  • countintegerObligatorio

    Number of matching criteria returned

List model memory documentsAFFINDA_MCP_LIST_MODEL_MEMORY_DOCUMENTSAcción

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.

Parámetros de entrada

  • limitinteger
  • document_type_idstringObligatorio

Parámetros de salida

  • countintegerObligatorio

    Number of documents returned

  • documentsobject[]Obligatorio

    Documents in model memory

  • document_type_idstringObligatorio

    The document type that was queried

List organizationsAFFINDA_MCP_LIST_ORGANIZATIONSAcción

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.

Parámetros de entrada

  • limitinteger

Parámetros de salida

  • dataobject[]Obligatorio

    List of organizations

  • countintegerObligatorio

    Number of organizations returned

List pipedream appsAFFINDA_MCP_LIST_PIPEDREAM_APPSAcción

Search the catalogue of Pipedream apps available for new connections. Use this when ``list_integration_connections`` returns no connection for the service the user wants (e.g. they ask to push to Notion but no Notion connection exists). Find the right ``name_slug`` here, then pass it into ``create_connect_token`` to start the OAuth flow. Search is imprecise — prefer short, simple terms (``"sheets"`` rather than ``"google sheets"``). Already-connected services are returned by ``list_integration_connections``, not this tool. Args: ctx: MCP context (injected by FastMCP). search_query: Optional substring to filter app names. Omit to list everything.

Parámetros de entrada

  • search_queryany

Parámetros de salida

  • dataobject[]Obligatorio

    List of Pipedream apps

  • countintegerObligatorio

    Number of apps returned

List recent field annotationsAFFINDA_MCP_LIST_RECENT_FIELD_ANNOTATIONSAcción

Spot-check how one field is being extracted across recent documents. Use this for short, focused quality checks on a single field — e.g. after tweaking its description, transformation, data source, or validation rules and wanting a quick read on how it behaves now. Returns the newest annotations first (one row per annotation; fields with ``multiple=True`` can yield several per document). Query one field at a time; do NOT call in parallel across fields. This is NOT a bulk export — for extracted data across many docs or fields, point users at the "Download extraction" UI. For all fields on one document, use ``get_document_extraction`` instead. Args: ctx: MCP context (injected by FastMCP). field_id: Field to query. filter_by: Document subset — ``any`` (default), ``review``, ``validated``, or ``in_model_memory``. limit: Cap on returned annotations. Default 25, hard-capped at 100. Keep this small for spot-checks.

Parámetros de entrada

  • limitinteger
  • field_idstringObligatorio
  • filter_bystringenum
    anyreviewvalidatedin_model_memory

Parámetros de salida

  • countintegerObligatorio

    Number of annotations returned

  • errorany

    Error code if the request failed

  • messageany

    Error message if the request failed

  • field_idstringObligatorio

    The field that was queried

  • field_slugstring

    The field's slug (for reference)

  • annotationsobject[]Obligatorio

    Annotations sorted with the most recent document first

  • document_type_idstring

    The parent document type of the field

List tagsAFFINDA_MCP_LIST_TAGSAcción

List the tags defined in a workspace. Use this to discover the ``tag_id`` for downstream tools, to check whether a tag with a given name already exists before creating one, or to show the user what tags are available. Tags are workspace-scoped labels that can be applied to any number of documents. To apply or remove a tag on documents use ``add_tag_to_documents`` / ``remove_tag_from_documents``. To see which tags a specific document carries, use ``get_document``. Args: ctx: MCP context (injected by FastMCP). workspace_id: Workspace to scope the list to. Required. limit: Cap on returned items. Default 100 — usually enough.

Parámetros de entrada

  • limitinteger
  • workspace_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of tags

  • countintegerObligatorio

    Number of tags returned

List validation rulesAFFINDA_MCP_LIST_VALIDATION_RULESAcción

List validation rules attached to a document type. Use this BEFORE creating a new validation rule — document types often have existing rules (including disabled ones) that already match the user's intent. If a matching rule exists, enable / tweak it via ``update_validation_rule`` rather than duplicating. Also use this to discover rule IDs for ``update_validation_rule`` / ``delete_validation_rule``. For one rule by ID, use ``get_validation_rule``. For the document type's fields (often needed when authoring rule prompts) use ``list_fields``. Args: ctx: MCP context (injected by FastMCP). document_type_id: Document type to scope the list to. limit: Cap on returned items. Default 100.

Parámetros de entrada

  • limitinteger
  • document_type_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of validation rules

  • countintegerObligatorio

    Number of validation rules returned

List workspacesAFFINDA_MCP_LIST_WORKSPACESAcción

List workspaces in an organization. Use this to discover existing workspaces — for example, to find the right workspace_id to pass into other tools, or to show the user what they already have set up. Each item includes document counts so you can also use this for a quick activity overview. For full settings (OCR mode, splitting, classification, model memory) use ``get_workspace_details`` on a specific workspace; ``list_workspaces`` intentionally returns a lean view. Args: ctx: MCP context (injected by FastMCP). organization_id: Organization to list workspaces for. Use the organization's ID, not its identifier. Required. limit: Cap on returned items. Default 20 — enough for most orgs.

Parámetros de entrada

  • limitinteger
  • organization_idstringObligatorio

Parámetros de salida

  • dataobject[]Obligatorio

    List of workspaces

  • countintegerObligatorio

    Number of workspaces returned

Populate fields from documentsAFFINDA_MCP_POPULATE_FIELDS_FROM_DOCUMENTSAcción

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

Parámetros de entrada

  • document_idsstring[]Obligatorio
  • instructionsany
  • document_type_idstringObligatorio

Parámetros de salida

  • dataany

    Updated document type after field population

  • errorany

    Error code if population failed

  • messageany

    Success or error message

  • successbooleanObligatorio

    Whether fields were populated successfully

Reassign document typeAFFINDA_MCP_REASSIGN_DOCUMENT_TYPEAcción

Reassign documents to a different document type in the same workspace. Use this when classification has put documents under the wrong type — e.g. invoices misclassified as receipts — and you want to fix the type and re-extract under the correct field schema. The target ``document_type_id`` must already be assigned to the documents' workspace (see ``assign_document_type_to_workspace``). Documents stay in their current workspace; this tool does not move documents between workspaces (no public API supports that). To reject rather than reassign, use ``reject_documents``. Args: ctx: MCP context (injected by FastMCP). document_ids: Documents to reassign. document_type_id: New document type. Must be assigned to the same workspace the documents live in. reparse: Re-extract under the new type's fields. Default ``True``; set ``False`` only to change classification metadata without triggering a new extraction run.

Parámetros de entrada

  • reparseboolean
  • document_idsstring[]Obligatorio
  • document_type_idstringObligatorio

Parámetros de salida

  • countinteger

    Number of documents affected

  • errorany

    Error message if action failed

  • successbooleanObligatorio

    Whether the action succeeded

Reject documentsAFFINDA_MCP_REJECT_DOCUMENTSAcción

Move documents to ``rejected`` state. Use this when documents are unusable or out-of-scope — e.g. wrong document type with no good reassignment, scan too poor to extract, or a junk upload. Rejected documents are excluded from model memory. To accept documents instead, use ``confirm_documents``. To remove completed documents from active work without flagging them as bad, use ``archive_documents``. To re-classify a misclassified document rather than rejecting it, use ``reassign_document_type``. Args: ctx: MCP context (injected by FastMCP). document_ids: Documents to reject.

Parámetros de entrada

  • document_idsstring[]Obligatorio

Parámetros de salida

  • countinteger

    Number of documents affected

  • errorany

    Error message if action failed

  • successbooleanObligatorio

    Whether the action succeeded

Remove connection from integrationAFFINDA_MCP_REMOVE_CONNECTION_FROM_INTEGRATIONAcción

Detach a service connection from an integration. Use this when an integration should no longer have access to a particular service — for example, swapping accounts or cleaning up after a failed setup. Other attached connections are preserved. Removing a connection that wasn't attached is a no-op. The connection itself remains in the organization and can be used by other integrations; this only severs the link. To delete the underlying connection entirely, do that from the connections UI. To attach, use ``add_connection_to_integration``. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to detach the connection from. connection_id: Connection to detach.

Parámetros de entrada

  • connection_idstringObligatorio
  • integration_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Updated integration, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the integration was updated successfully

Remove tag from documentsAFFINDA_MCP_REMOVE_TAG_FROM_DOCUMENTSAcción

Take a tag off one or more documents. Use this to un-label documents — e.g. "remove the Urgent tag from these invoices". The tag itself is kept and stays available for other documents; documents that don't carry the tag are unaffected. To delete the tag everywhere in one step, use ``delete_tag`` instead. Args: ctx: MCP context (injected by FastMCP). tag_id: ID of the tag to remove. document_ids: Documents to remove the tag from.

Parámetros de entrada

  • tag_idstringObligatorio
  • document_idsstring[]Obligatorio

Parámetros de salida

  • countinteger

    Number of documents affected

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the action succeeded

Revert integration versionAFFINDA_MCP_REVERT_INTEGRATION_VERSIONAcción

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.

Parámetros de entrada

  • version_idstringObligatorio
  • integration_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if revert failed

  • messageany

    Success or error message

  • successbooleanObligatorio

    Whether the revert succeeded

Run integrationAFFINDA_MCP_RUN_INTEGRATIONAcción

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.

Parámetros de entrada

  • document_idstringObligatorio
  • integration_idstringObligatorio

Parámetros de salida

  • logsany

    Execution logs (if available immediately)

  • errorany

    Error code if run failed

  • outputany

    Run output data (if available immediately)

  • run_idany

    ID of the created integration run

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the run was started successfully

Set integration secretAFFINDA_MCP_SET_INTEGRATION_SECRETAcción

Create or update a secret on an integration. The value is stored only as an environment variable on the Lambda function — never in the database. Use this whenever the user provides a credential value (API key, token, password, etc.) that the integration code will need at runtime. NEVER embed such values directly in ``python_code`` — call this tool instead, then read the secret in code via ``os.environ["NAME"]``. The same tool handles both create and update: if a secret with this name already exists for the integration, its value is rotated. The integration must be deployed (have a Lambda) before the value reaches AWS; for pre-deploy integrations the name is recorded and the value is applied on the next deploy. Constraints: - ``name`` must match ``[A-Z][A-Z0-9_]*`` — uppercase letters, digits, underscores, starting with a letter. - ``AFFINDA_API_TOKEN`` and ``AFFINDA_API_BASE_URL`` are reserved. This tool is for the manual-credential path (e.g. a raw API key the user pasted). When auth is being handled through a Pipedream connection, use ``add_connection_to_integration`` instead — that flow does not need a secret. Args: ctx: MCP context (injected by FastMCP). integration_id: Integration to attach the secret to. name: Environment variable name, e.g. ``"STRIPE_API_KEY"``. value: The secret value. Stored only as a Lambda env var.

Parámetros de entrada

  • namestringObligatorio
  • valuestringObligatorio
  • integration_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Created/updated secret, or null if failed

  • errorany

    Error code if save failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the secret was saved successfully

Test connectionAFFINDA_MCP_TEST_CONNECTIONAcción

Verify a service connection's credentials are still valid. Use this when an integration starts failing with auth-style errors, or when you want to confirm an OAuth flow finished successfully before relying on the connection. Returns ``is_valid=True`` if the upstream service accepts the stored credentials. To start a fresh OAuth flow rather than test an existing one, use ``create_connect_token``. To run an integration's Python code against a document, use ``run_integration`` — that exercises the full pipeline, not just credentials. Args: ctx: MCP context (injected by FastMCP). connection_id: ID of the connection to test.

Parámetros de entrada

  • connection_idstringObligatorio

Parámetros de salida

  • errorany

    Error code if test failed

  • messageany

    Test result message

  • successbooleanObligatorio

    Whether the test completed successfully

  • is_validany

    Whether the connection is valid

Update data sourceAFFINDA_MCP_UPDATE_DATA_SOURCEAcción

Update top-level settings on a data source (name, key, display property). Use this for metadata changes: renaming the data source, switching which schema property is the unique key, or changing which property is shown in the UI. Only the parameters you provide are sent; omitted parameters are untouched. This tool does NOT add, change, or remove rows — for row mutations use ``create_data_source_value``, ``update_data_source_value``, ``delete_data_source_value``, or ``bulk_create_data_source_values``. Schema changes (adding columns) must be done in the Affinda UI. Args: ctx: MCP context (injected by FastMCP). data_source_id: ID of the data source to update. name: New display name. key_property: New unique-key property. Must already exist in the schema and be unique across rows; renaming the key on a populated data source can break existing row lookups. display_property: New UI display property.

Parámetros de entrada

  • nameany
  • key_propertyany
  • data_source_idstringObligatorio
  • display_propertyany

Parámetros de salida

  • dataanyObligatorio

    Updated data source, or null if failed

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether update succeeded

Update data source valueAFFINDA_MCP_UPDATE_DATA_SOURCE_VALUEAcción

Update one row in a data source by its key — partial merge. Use this to change fields on an existing row: "rename ACME's label", "set GLOBEX's currency to USD". Only fields you pass are written; unspecified fields keep their current values. Fails with ``not_found`` if no row matches ``key``. For inserting a brand-new row use ``create_data_source_value``; for removing a row use ``delete_data_source_value``. There is no bulk update tool — for many edits, 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`` for the target row. Look up the row via ``list_data_source_values`` if needed. value: Partial row as a JSON-encoded object string, e.g. ``'{"label": "New Label"}'``. If this object includes the ``key_property`` itself the row's key is renamed; the call fails with ``duplicate_key`` if the new key collides.

Parámetros de entrada

  • keystringObligatorio
  • valuestringObligatorio
  • data_source_idstringObligatorio

Parámetros de salida

  • dataany

    The affected value record, or null if deleted

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Update document typeAFFINDA_MCP_UPDATE_DOCUMENT_TYPEAcción

Update one or more settings on an existing document type. Use this to rename a type or toggle its UX/validation behaviour after creation. Only the parameters you provide are sent to the API; omitted parameters are untouched. Read the current state with ``get_document_type_details`` first if you need to reason about deltas. For the initial create use ``create_document_type``. To change which workspace a type belongs to, use ``assign_document_type_to_workspace`` — that's a relationship op, not a setting. Field-schema changes go through ``create_field`` / ``update_field`` / ``delete_field``. Args: ctx: MCP context (injected by FastMCP). document_type_id: ID of the document type to update. name: New display name. disable_confirmation_if_validation_rules_fail: Block confirmation when validation fails. show_redact_button: Show the redaction button in the UI. auto_refresh_validation_results: Re-run validation when the document changes.

Parámetros de entrada

  • nameany
  • document_type_idstringObligatorio
  • show_redact_buttonany
  • auto_refresh_validation_resultsany
  • disable_confirmation_if_validation_rules_failany

Parámetros de salida

  • dataanyObligatorio

    Updated document type, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the document type was updated successfully

Update fieldAFFINDA_MCP_UPDATE_FIELDAcción

Update one or more settings on an existing field. Use this for any change to a field after creation: rename, retype, reorder, move between field groups, edit the extraction prompt, toggle ``enabled`` / ``multiple`` / display flags, attach or detach a mapping data source, or set a transformation. Only the parameters you provide are sent to the API; omitted parameters are untouched. Structural restrictions (enforced here — call will be rejected): - Cannot change ``field_type`` to ``group`` or ``table``. - Cannot change ``field_type`` away from ``group`` or ``table``. Both directions break the child-field relationships and leave annotations referencing parents that no longer accept children. For restructures of that shape, ``delete_field`` and recreate. Hierarchical reshaping (changing nesting parents) is also unsupported — there's deliberately no ``parent_id`` parameter here. Reassigning a field's parent breaks annotations; delete and recreate instead. For data-source attachment, this tool is correct (pass ``mapping_data_source_id``); pass the literal string ``"null"`` to detach. Some attributes (``multiple``, ``no_rect``, ``description``) are locked once a document type has trained a model. Args: ctx: MCP context (injected by FastMCP). field_id: ID of the field to update. slug: New camelCase API identifier. label: New human-readable label. field_type: New data type. Cannot be ``group`` or ``table``, and cannot be used to retype a field whose current type is ``group`` or ``table`` (see restrictions above). ``integer`` and ``decimal`` are accepted but normalised to ``float`` (the product's single numeric type — the UI cannot display the others). Beware: changing type may invalidate existing extractions. description: New extraction prompt. enabled: Toggle the field on/off. multiple: Toggle multi-value extraction. no_rect: Toggle rectangle requirement. return_first_instance_only: Return only first match when ``multiple=True``. manual_entry: Toggle manual-entry mode. auto_confirm_if_validation_rules_pass: Auto-confirm extractions that pass all validation rules. display_enum_value: Show enum value rather than its label. hide_enum_detail: Hide extra enum metadata in UI. drop_null: Omit null values from extraction results. display_raw_text: Show raw extracted text in UI. options: New allowed values for ``options`` fields. transformation_prompt: Natural-language reformat instruction; sets up an LLM transformation and triggers code generation. position: 0-based display order within the field group. Use to reorder fields. field_group_id: Move the field into a different group. mapping_data_source_id: Attach a data source. Attaching forces ``field_type`` to ``enum`` (a data source only functions on an enum field). Pass the literal string ``"null"`` to detach — detach leaves the field type untouched. 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. Only set this on a field that is (or is being set to) ``float``; the backend rejects a number formatter on other field types. Note this replaces the field's number formatter config.

Parámetros de entrada

  • slugany
  • labelany
  • enabledany
  • no_rectany
  • optionsany
  • field_idstringObligatorio
  • multipleany
  • positionany
  • drop_nullany
  • field_typeany
  • descriptionany
  • manual_entryany
  • decimal_placesany
  • field_group_idany
  • display_raw_textany
  • hide_enum_detailany
  • display_enum_valueany
  • transformation_promptany
  • mapping_data_source_idany
  • return_first_instance_onlyany
  • auto_confirm_if_validation_rules_passany

Parámetros de salida

  • dataanyObligatorio

    Updated field, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the field was updated successfully

Update integrationAFFINDA_MCP_UPDATE_INTEGRATIONAcción

Update one or more settings — including code — on an integration. Use this for any change after creation: rename, swap trigger event, rescope to a different workspace or document type, toggle enabled, or replace the Python code. Only the parameters you provide are sent; omitted parameters are untouched. ``python_code`` replaces the entire file; there is no partial-edit or diff tool. A typical code-update flow reads the current code with ``get_integration``, submits the complete replacement here, then deploys it with ``deploy_integration_version``. The saved code is not live until deployed, and ``run_integration`` executes the deployed version. For the initial create, use ``create_integration``. To attach or detach connections, use ``add_connection_to_integration`` / ``remove_connection_from_integration`` — connections are a relationship, not a setting. Args: ctx: MCP context (injected by FastMCP). integration_id: ID of the integration to update. name: New display name. description: New description. python_code: New full-file Python source. Replaces the whole file. enabled: ``True`` to enable, ``False`` to disable. 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.

Parámetros de entrada

  • nameany
  • eventany
  • enabledany
  • descriptionany
  • python_codeany
  • workspace_idany
  • integration_idstringObligatorio
  • document_type_idany

Parámetros de salida

  • dataanyObligatorio

    Updated integration, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the integration was updated successfully

Update matching criterionAFFINDA_MCP_UPDATE_MATCHING_CRITERIONAcción

Update settings on an existing matching criterion. Use this to retune lookup behaviour: switch ``match_type`` from fuzzy to exact for codes, point at a different ``data_source_property``, flip ``required`` on or off, or repoint a cross-field criterion at a different source field. Only the parameters you provide are sent; omitted parameters are untouched. For adding a new criterion use ``create_matching_criterion``; for removing one use ``delete_matching_criterion``. This tool does not change which data source is attached to the field — that's a field update, not a matching-criterion update. Args: ctx: MCP context (injected by FastMCP). matching_criterion_id: ID of the criterion to update. data_source_property: New data source property to match against. match_type: ``match`` (fuzzy), ``match_phrase`` (partial), or ``term`` (exact). required: If ``True``, unmatched extractions are rejected. required_strict: Stricter variant of ``required``. field_attribute: Source-field attribute (JSON / ENUM source fields). source_field_id: Repoint matching at a different source field.

Parámetros de entrada

  • requiredany
  • match_typeany
  • field_attributeany
  • required_strictany
  • source_field_idany
  • data_source_propertyany
  • matching_criterion_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    The matching criterion, or null if failed

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Update organizationAFFINDA_MCP_UPDATE_ORGANIZATIONAcción

Rename an organization. Use this only when the user explicitly asks to rename their organization (e.g. company rebrand, fixing a typo from signup). The name shown across the Affinda UI updates accordingly. The caller must have admin or owner rights on the organization; otherwise the API rejects the update. This tool only changes the display name. There are no per-organization processing settings — workspace-level configuration belongs on the workspace, so for OCR / splitting / classification changes use ``update_workspace`` instead. Args: ctx: MCP context (injected by FastMCP). organization_id: ID of the organization to rename. name: New display name.

Parámetros de entrada

  • namestringObligatorio
  • organization_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Updated organization, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the organization was updated successfully

Update tagAFFINDA_MCP_UPDATE_TAGAcción

Rename a tag. Use this when the user wants to change a tag's name — e.g. "rename the Urgent tag to High Priority". The rename applies everywhere at once: every document carrying the tag shows the new name immediately. A tag cannot be moved to a different workspace; create a new tag there instead. To change which documents carry the tag, use ``add_tag_to_documents`` / ``remove_tag_from_documents``. Args: ctx: MCP context (injected by FastMCP). tag_id: ID of the tag to rename. name: New tag name. Max 256 chars.

Parámetros de entrada

  • namestringObligatorio
  • tag_idstringObligatorio

Parámetros de salida

  • dataany

    The affected tag, or null if deleted/failed

  • errorany

    Error code if request failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the operation succeeded

Update validation ruleAFFINDA_MCP_UPDATE_VALIDATION_RULEAcción

Update one or more settings on an existing validation rule. Use this when the user asks to MODIFY a rule (change its prompt, enable/disable it, change the field set). When the user wants to extend an existing rule's logic, read the current ``prompt`` via ``get_validation_rule`` first and merge the new requirement into a single combined prompt — do NOT create a parallel rule. Only the parameters you provide are sent; omitted parameters are untouched. For brand-new checks not already covered by an existing rule, use ``create_validation_rule``. To remove a rule, use ``delete_validation_rule``. To re-run validation against a document after changes, use ``create_validation_run``. Always reference fields in ``prompt`` via the ``@<field_id>`` syntax, not plain text — call ``list_fields`` for IDs. **For data inside a table or group, reference the CHILD (cell) field IDs, NOT the parent field ID.** Parent fields (``field_type`` in ``{table, table_deprecated, group}`` with a non-empty ``children`` list) are the row / container; only children hold actual cell values. A rule against the parent ID validates the container, not the data. For a ``lineItems`` table (id=4820) with cell children ``quantity`` (4822), ``unitPrice`` (4823), ``amount`` (4824): - ✅ ``prompt="@4822 must be > 0"`` and ``field_ids=["4822"]`` - ❌ ``prompt="@4820 must not be empty"`` and ``field_ids=["4820"]`` Same applies to ``group`` parents. Translate row-level user phrasing ("each line item must…", "every row's…") into references on the cell children, never the parent. Args: ctx: MCP context (injected by FastMCP). validation_rule_id: ID of the rule to update. prompt: New natural-language rule, with ``@<field_id>`` references. field_ids: New list of fields the rule validates. Pass as a native list, not a JSON string. enabled: Toggle the rule on/off. generate_code: Force regeneration of the validation code from the prompt. Default ``False``.

Parámetros de entrada

  • promptany
  • enabledany
  • field_idsany
  • generate_codeboolean
  • validation_rule_idstringObligatorio

Parámetros de salida

  • dataanyObligatorio

    Updated validation rule, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the validation rule was updated successfully

Update workspaceAFFINDA_MCP_UPDATE_WORKSPACEAcción

Update one or more settings on an existing workspace. Use this for any settings change after creation: renaming, toggling OCR mode, enabling/disabling splitting or classification, switching model-memory strategy, or flipping validation flags. Only the parameters you provide are sent to the API; omitted parameters are untouched. Always read the current state with ``get_workspace_details`` first if you need to reason about deltas. Enabling splitting in an update requires the same setup as creation: pass ``enable_document_splitting=True`` together with a ``document_splitter_id``. Disabling splitting only needs ``enable_document_splitting=False``. For the initial create, use ``create_workspace`` (or ``create_recruit_workspace`` for the resume bundle). To change which document types are assigned to a workspace, use ``assign_document_type_to_workspace`` — that's a relationship operation, not a workspace setting. Args: ctx: MCP context (injected by FastMCP). workspace_id: Internal numeric ID returned by list_workspaces, not the alphabetic identifier. name: New display name. Max 40 chars. visibility: ``organization`` or ``private``. ocr_mode: ``auto-detect``, ``always-full``, ``always-partial``, ``skip``. See ``create_workspace`` for semantics. enable_document_splitting: Toggle splitting. document_splitter_id: Required when enabling splitting; ignored otherwise. enable_document_classification: Toggle classification. reject_duplicates: Toggle duplicate rejection. model_memory_strategy: ``auto``, ``manual``, ``always``. enable_validation: Toggle validation rules. auto_validation: Toggle auto-validation after extraction. Only meaningful when ``enable_validation`` is ``True``.

Parámetros de entrada

  • nameany
  • ocr_modeany
  • visibilityany
  • workspace_idstringObligatorio
  • auto_validationany
  • enable_validationany
  • reject_duplicatesany
  • document_splitter_idany
  • model_memory_strategyany
  • enable_document_splittingany
  • enable_document_classificationany

Parámetros de salida

  • dataanyObligatorio

    Updated workspace, or null if failed

  • errorany

    Error code if update failed

  • messageany

    Error or success message

  • successbooleanObligatorio

    Whether the workspace was updated successfully

Wait for document processingAFFINDA_MCP_WAIT_FOR_DOCUMENT_PROCESSINGAcción

Block until every document in a workspace has finished processing. Use this after uploading documents — it polls internally until OCR, splitting, and classification are complete, then returns the final list (including any children created by splitting). Saves the caller from looping ``list_documents`` themselves. Prefer this over manual polling with ``list_documents``; manual loops waste turns and can race against in-flight splitting. For one-off state checks once processing has settled, use ``list_documents`` or ``get_document``. Args: ctx: MCP context (injected by FastMCP). workspace_id: Workspace to monitor. timeout_seconds: Cap on total wait. Default 120, hard-capped at 300. On timeout, returns ``timed_out=True`` with the current state — callers can re-invoke to keep waiting.

Parámetros de entrada

  • workspace_idstringObligatorio
  • timeout_secondsinteger

Parámetros de salida

  • messagestringObligatorio

    Human-readable summary of the result

  • successbooleanObligatorio

    Whether all documents finished processing

  • documentsobject[]Obligatorio

    Final state of all documents in the workspace

  • timed_outboolean

    Whether the wait timed out