Usa Affinda MCP con Sokko.
Conecta Affinda MCP y dile a Sokko qué hacer. Ejecuta las acciones que pides y reacciona a lo que ocurre, sin workflows ni código.
Funciona con más de 1.000 herramientas · Sin código
Acciones
Todo lo que Sokko puede hacer en Affinda MCP
Cada acción de Affinda MCP que Sokko puede ejecutar. Pídela en una frase y listo.
Add connection to integration
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.
Add tag to documents
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.
Archive documents
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.
Assign document type to workspace
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.
Bulk create data source values
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"}]``.
Bulk create fields
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.
Confirm documents
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``.
Create api token
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.
Create connect token
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.
Create data source
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.
Create data source value
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.
Create document type
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.
Create field
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.
Create field group
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.
Create integration
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.
Create matching criterion
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.
Create recruit workspace
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.
Create tag
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.
Create validation rule
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``.
Create validation run
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.
Create workspace
Create a new workspace with chosen processing settings.
Use this for any net-new workspace: a customer onboarding, an
additional document category, or a sandbox. A workspace groups
documents that share processing rules — OCR mode, splitting,
classification, model-memory strategy. Pick a short descriptive
``name`` (e.g. "Invoices", "Loan Applications"); names are capped
at 40 characters by the server.
For the standard recruitment use case (resumes, job descriptions),
prefer ``create_recruit_workspace``: it builds a fully-configured
workspace with the right document types in one call. Use plain
``create_workspace`` for everything else.
Splitting requires a splitter: when ``enable_document_splitting``
is ``True``, list ``list_document_splitters`` first and pass a
``document_splitter_id``. The default "General Document Splitter"
is a safe choice when the user hasn't trained a custom one.
Args:
ctx: MCP context (injected by FastMCP).
name: Workspace display name. Max 40 chars.
organization_id: Owning organization ID.
visibility: ``organization`` (all members can see) or ``private``
(only explicitly added members). Default ``organization``.
ocr_mode: ``auto-detect`` (default — only OCR when needed),
``always-full`` (best for scans), ``always-partial`` (trust
embedded text but still OCR for layout), or ``skip`` (only
embedded text — native digital PDFs only).
enable_document_splitting: Set ``True`` for "packs", "bundles",
or any multi-document file. Safe to leave on even if some
uploads are single documents.
document_splitter_id: Required when splitting is enabled. List
available IDs via ``list_document_splitters``.
enable_document_classification: Default ``True``. Recommended on
even with a single document type; only disabled by explicit
user request.
reject_duplicates: Default ``False``. Rejects re-uploads matching
an existing document in the workspace.
model_memory_strategy: ``auto`` (default — system curates training
examples), ``manual`` (only explicitly marked docs train),
``always`` (every validated doc trains — small, consistent
sets only).
Delete data source
Delete a data source and every row it contains.
Use this only when the user explicitly wants the entire lookup table
gone — "delete the Suppliers data source", "remove this list". Any
fields that referenced the data source lose the association silently;
extraction on those fields falls back to free-text.
To remove a single row instead, use ``delete_data_source_value``. To
detach the data source from a field while keeping the data, update the
field's ``mapping_data_source_id`` to null rather than deleting here.
Args:
ctx: MCP context (injected by FastMCP).
data_source_id: ID of the data source to delete.
Delete data source value
Delete one row from a data source by its key.
Use this for conversational single-row removal: "remove supplier ACME",
"drop the JPY currency entry". Fails with ``not_found`` if no row
matches ``key``.
To remove the entire data source (all rows + the table itself) use
``delete_data_source``. There is no bulk-delete tool — for many rows,
call this per row.
Args:
ctx: MCP context (injected by FastMCP).
data_source_id: ID of the data source.
key: Value of the data source's ``key_property`` identifying the
row to remove. Use ``list_data_source_values`` to find the key
if unsure.
Delete document type
Delete a document type permanently.
Use this when the user wants to remove a document type entirely from
their organization. Destructive: all fields, field groups, and
validation rules attached to the type are removed with it. By default
documents previously classified as this type are kept (orphaned, no
type) — pass ``delete_documents=True`` to delete them too.
To remove a type from one workspace but keep it in the org, this is
the wrong tool — there is no separate unassign call; instead, manage
visibility via workspace settings. To delete only fields or rules,
use ``delete_field`` / ``delete_validation_rule``.
Args:
ctx: MCP context (injected by FastMCP).
document_type_id: ID of the document type to delete.
delete_documents: Also delete every document of this type.
Default ``False`` (documents are orphaned, not removed).
Delete field
Delete a single field from a document type.
Use this when the user wants to remove one field they no longer want
extracted, or to drop a field before recreating it under a different
parent (the only safe way to "move" a field — direct ``parent_id``
reassignment via ``update_field`` breaks annotations).
For deleting a heading/section, use ``delete_field_group``. For
deleting a validation rule, use ``delete_validation_rule``. For
removing the entire document type, use ``delete_document_type``.
Built-in (non-custom) fields on document types with a trained model
cannot be deleted — only custom fields can.
Args:
ctx: MCP context (injected by FastMCP).
field_id: ID of the field to delete.
Delete field group
Delete a field group (heading/section) from a document type.
Use this when the user wants to remove a section heading. Move any
fields you want to keep into another group first via ``update_field``
with ``field_group_id`` — fields left behind will become ungrouped.
To delete fields themselves, use ``delete_field``. To delete the
whole document type, use ``delete_document_type``.
Args:
ctx: MCP context (injected by FastMCP).
field_group_id: ID of the field group to delete.
Delete integration
Permanently delete an integration.
Use this when the user wants to remove an integration entirely. Code,
versions, run history, and connection links are dropped together.
This is destructive and not recoverable — confirm intent before
calling.
To temporarily stop an integration without losing it, set
``enabled=False`` via ``update_integration`` instead. To roll back a
bad code change, use ``revert_integration_version`` rather than delete.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: ID of the integration to delete.
Delete integration secret
Permanently delete a secret. Removes both the database record and the
Lambda environment variable.
Use this when a credential is no longer needed (e.g. the user rotated to
a different service, or the integration's auth model changed to
Pipedream). The secret value cannot be recovered after deletion — confirm
intent before calling.
Find ``secret_id`` via ``list_integration_secrets`` (the ``id`` field on
each entry). To rotate a secret to a new value rather than remove it,
call ``set_integration_secret`` with the same name.
Args:
ctx: MCP context (injected by FastMCP).
secret_id: ID of the secret to delete.
Delete matching criterion
Delete a matching criterion from a field.
Use this to remove an unwanted lookup path — e.g. dropping a redundant
fuzzy match when an exact-match criterion is enough. Removing the last
criterion on a field will leave its attached data source effectively
inert until a new criterion is added.
To just change a criterion's settings use ``update_matching_criterion``;
to detach the data source from the field entirely, do that via the
field update tool rather than deleting criteria here.
Args:
ctx: MCP context (injected by FastMCP).
matching_criterion_id: ID of the criterion to delete.
Delete tag
Delete a tag from its workspace.
Use this only when the user explicitly wants the tag gone — e.g.
"delete the Urgent tag". The tag is removed from every document that
carried it; the documents themselves are untouched.
To take the tag off specific documents while keeping it available for
others, use ``remove_tag_from_documents`` instead.
Args:
ctx: MCP context (injected by FastMCP).
tag_id: ID of the tag to delete.
Delete validation rule
Delete a validation rule from a document type.
Use this when the user wants to remove a rule entirely. If the user
only wants to disable a rule temporarily, prefer
``update_validation_rule`` with ``enabled=False`` — disabled rules
can be re-enabled later. To delete a field instead, use
``delete_field``; to delete the whole document type, use
``delete_document_type``.
Args:
ctx: MCP context (injected by FastMCP).
validation_rule_id: ID of the validation rule to delete.
Deploy integration version
Snapshot the integration's current code as a new version and deploy it.
Call this immediately after every successful ``update_integration``
that changed ``python_code`` — it MUST be the next tool call. Code
saved on the integration is not live until deployed, and
``run_integration`` always executes the deployed version, so skipping
this step means tests run stale code and real document events still
fire the previous version.
To roll back a bad deploy, use ``revert_integration_version`` with a
prior version's ID from ``list_integration_versions``. To enable or
disable an already-deployed integration, use ``update_integration``
with the ``enabled`` flag.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: ID of the integration to deploy.
Get data source
Get one data source by ID — name, schema, and key/display properties.
Use this when you already know the ``data_source_id`` and need its
metadata: typically to read ``key_property`` before adding/updating rows,
to inspect the schema before deciding which property to match against,
or to confirm the data source exists. Returns ``data=null`` with
``error="not_found"`` if the ID does not match.
For the rows stored inside the data source use ``list_data_source_values``.
To enumerate data sources in an organization use ``list_data_sources``.
Args:
ctx: MCP context (injected by FastMCP).
data_source_id: ID of the data source to fetch.
Get document
Get one document by ID — state, workspace, document type, and basic metadata.
Use this when you already have a ``document_id`` and need a lightweight
summary, e.g. to confirm a document exists, check its processing state,
or look up which workspace and document type it belongs to. Returns
``data=null`` with ``error="not_found"`` if no document matches.
For extracted field values (text, parsed values, confidence) use
``get_document_extraction`` instead. To enumerate documents, use
``list_documents``.
Args:
ctx: MCP context (injected by FastMCP).
document_id: ID of the document to fetch.
Get document extraction
Get the extracted data for one document — raw text plus all field values.
Use this to review how a specific document was extracted: every field
value with its confidence score, preserving nested structure (groups,
tables). Typical scenarios are answering "what did we extract from
this doc?", spot-checking a document the user is looking at, or
confirming a value before suggesting a fix.
To diagnose *why* a document was extracted a certain way, check
``reference_document_id`` in the response: when set, extraction was
guided by that model-memory document, used as an in-context example.
Call this tool again with that ID to see the example's confirmed
(ground-truth) values — a surprising extraction often traces back to
how the equivalent field was verified on the reference document.
Review one document at a time. Do NOT loop this over many documents
for bulk export — direct the user to the "Download extraction" UI in
the workspace's documents view instead. To spot-check one field
across many documents, use ``list_recent_field_annotations``. For
just state and metadata (no extraction), use ``get_document``. Only
works once the document has finished processing and been classified.
Args:
ctx: MCP context (injected by FastMCP).
document_id: ID of the document to inspect.
Get document page images
View a document's pages as rendered images — see the actual document, not just OCR text.
Use this when the visual appearance of the document matters and text
alone is ambiguous: layout questions, checkboxes and selection marks,
signatures, stamps, handwriting, logos, or diagnosing why extraction
misread something. The images show each page as it appears in the
document review UI.
With ``show_annotations`` the extracted annotations are drawn on top of
each page as colored rectangles tagged with their field slug — use this
to check *where* a value was read from: wrong instance picked, value
attributed to the wrong field, or table rows/columns mapped incorrectly.
On dense documents, pass ``field_slugs`` to only draw the fields you are
debugging (a table's slug also draws its cells).
Images are expensive (in tokens) — request only the pages you need,
at most 5 per call. For extracted values and raw text, use
``get_document_extraction`` instead; only reach for images when text
output isn't enough.
Args:
ctx: MCP context (injected by FastMCP).
document_id: ID of the document to view.
page_indices: Zero-based page indices to fetch (e.g. ``[0]`` for
the first page). Omit to get the first 5 pages.
show_annotations: Draw the extracted annotations on the page images
as rectangles labelled with their field slug.
field_slugs: Only draw annotations for these field slugs (implies
``show_annotations``). Omit to draw all annotated fields.
Get document type
Get one document type by ID — name, organization, and counts only.
Use this when you already know the ``document_type_id`` and need a
lightweight summary, e.g. to confirm the type exists or display
headline counts. Returns ``data=null`` with ``error="not_found"`` if
no document type matches.
For settings (validation behaviour, redact button, auto-refresh) call
``get_document_type_details`` instead. For its fields, call
``list_fields``. To enumerate types in an org, use
``list_document_types``.
Args:
ctx: MCP context (injected by FastMCP).
document_type_id: ID of the document type to fetch.
Get document type details
Get a document type's full configuration — settings + counts.
Use this whenever you need to read or reason about document-type
settings: validation-blocking confirmation, the redact button, and
auto-refresh of validation results. Typical scenarios are answering
"what's the current config?" and reading the current value before
computing a patch for ``update_document_type``.
For just the headline counts (no settings) prefer ``get_document_type``.
Fields and validation rules live on separate endpoints — call
``list_fields`` or ``list_validation_rules``.
Args:
ctx: MCP context (injected by FastMCP).
document_type_id: ID of the document type to fetch.
Get field
Get one field by ID — full settings, formatter, and relationships.
Use this when you already know the ``field_id`` and need details
that ``list_fields`` doesn't surface compactly (formatter config,
transformation config, attached data source). Returns ``data=null``
with ``error="not_found"`` if no field matches.
To enumerate every field on a document type, use ``list_fields``
instead — it groups results and shows hierarchy. To modify a field
after reading, use ``update_field``.
Args:
ctx: MCP context (injected by FastMCP).
field_id: ID of the field to fetch.
Get field group
Get one field group by ID — label, position, parent document type.
Use this when you already know the ``field_group_id`` and want a
direct lookup. Most callers should prefer ``list_fields``, which
returns every group on a document type along with its fields in one
call — usually what's actually needed.
Args:
ctx: MCP context (injected by FastMCP).
field_group_id: ID of the field group to fetch.
Get integration
Get one integration by ID — full configuration, code, and connections.
Use this whenever you need to read the current Python code or the
attached connections. Critical before calling ``update_integration``
with ``python_code``: that field replaces the entire file with no
partial-edit option, so you must read the existing code first and
compose a complete replacement. Also use it to confirm trigger event,
workspace / document-type scoping, and deployed state.
To enumerate integrations in an organization, use ``list_integrations``.
Returns ``data=null`` with ``error="not_found"`` if the ID is unknown.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: ID of the integration to fetch.
Get integration run
Get one integration run by ID — full, untruncated logs and output.
Use this when diagnosing a failing integration. ``list_integration_runs``
truncates logs to 10,000 characters, which often hides the actual
error; this tool returns the complete log stream and is the right
starting point for any "why did my integration fail?" investigation.
To find recent run IDs for an integration, call ``list_integration_runs``
first, then drill into the failed run with this tool. Returns
``data=null`` with ``error="not_found"`` if the run ID is unknown.
Args:
ctx: MCP context (injected by FastMCP).
integration_run_id: ID of the integration run to fetch.
Get usage
Get daily credits consumption for an organization over a date range.
Use this to answer "how many credits have we used?", to break usage
down by day, or to attribute spend to one workspace or document type.
Returns a ``total`` plus a per-day ``items`` list; days with zero
usage are omitted. Optionally scope with ``workspace_id`` or
``document_type_id`` — but not both, since the API aggregates each
axis independently and combining them is silently invalid.
The caller must be an admin or owner of the organization; non-admins
receive ``error="forbidden"``. There is no per-user breakdown and no
sub-daily granularity — both are deliberate limits of the underlying
report.
Args:
ctx: MCP context (injected by FastMCP).
organization_id: Organization to report usage for.
workspace_id: Optional. Scope to one workspace; mutually exclusive
with ``document_type_id``.
document_type_id: Optional. Scope to one document type; mutually
exclusive with ``workspace_id``.
start_date: Inclusive ``YYYY-MM-DD``. Defaults to one month
before ``end_date``.
end_date: Inclusive ``YYYY-MM-DD``. Defaults to today.
Get validation rule
Get one validation rule by ID — prompt, enabled, fields, missing-data option.
Use this when you already know the ``validation_rule_id`` and need
to inspect or quote the existing prompt before patching it via
``update_validation_rule``. Returns ``data=null`` with
``error="not_found"`` if no rule matches.
To enumerate every rule on a document type, use
``list_validation_rules`` instead.
Args:
ctx: MCP context (injected by FastMCP).
validation_rule_id: ID of the validation rule to fetch.
Get workspace
Get one workspace by ID — name, organization, and document counts only.
Use this when you already know the workspace_id and need a lightweight
summary, e.g. to confirm the workspace exists or to display headline
counts. Returns ``data=null`` with ``error="not_found"`` if no workspace
matches the ID.
For OCR / splitting / classification / model-memory settings, call
``get_workspace_details`` instead — that surface includes the full
configuration. To enumerate workspaces in an organization, use
``list_workspaces``.
Args:
ctx: MCP context (injected by FastMCP).
workspace_id: Internal numeric ID returned by list_workspaces, not the alphabetic identifier.
Get workspace details
Get a workspace's full configuration — settings + counts.
Use this whenever you need to read or reason about workspace settings:
OCR mode, document splitting, classification, model-memory strategy,
duplicate rejection, and validation flags. Typical scenarios are
answering "what's the current config?", deciding whether to suggest
a settings change, and reading the current value before computing a
patch for ``update_workspace``.
For just the headline counts (no settings) prefer ``get_workspace``;
it does fewer joins on the API side.
Args:
ctx: MCP context (injected by FastMCP).
workspace_id: Internal numeric ID returned by list_workspaces, not the alphabetic identifier.
List data sources
List data sources (lookup tables) defined on an organization.
Use this to discover the ``data_source_id`` for downstream tools, or to
show the user what lookup tables already exist in their org. Data sources
are organization-scoped enum-style records (suppliers, currencies, charge
types, ...) that can be attached to fields for constrained extraction.
Returns a lean summary with ``id``, ``name``, schema, and document-type
usage count. For the rows inside a data source use ``list_data_source_values``;
to fetch one data source by ID use ``get_data_source``.
Args:
ctx: MCP context (injected by FastMCP).
organization_id: Organization to scope the list to. Required.
limit: Cap on returned items. Default 20 — usually enough.
List data source values
List the rows (records) stored in a data source.
Use this to inspect the actual contents of a lookup table — typical
scenarios are "what suppliers are in this list?", finding the row to
update or delete by its key, or sanity-checking a recently-populated
data source. Each row is returned as a raw dict matching the data
source's schema.
For data source metadata (name, schema, key property) use
``get_data_source``. To enumerate data sources themselves use
``list_data_sources``.
Args:
ctx: MCP context (injected by FastMCP).
data_source_id: ID of the data source whose rows to read.
limit: Cap on returned rows. Default 100.
List documents
List documents in a workspace with their state and basic metadata.
Use this to find documents by workspace, narrow by state, or run a
full-text search across file names and extracted text — for example,
"show me documents in review" or "find docs mentioning Acme".
For one document by ID, use ``get_document``. For extracted field
values, use ``get_document_extraction``. To wait for in-flight
processing to finish before listing, use
``wait_for_document_processing`` instead of polling this tool.
Args:
ctx: MCP context (injected by FastMCP).
workspace_id: Workspace to scope the query to.
state: One of ``review``, ``validated``, ``archived``, ``rejected``.
Omit to include all states (including ``processing``).
search_text: Full-text query against file name and extracted text.
limit: Cap on returned items. Default 20.
List document splitters
List document splitters available to an organization.
Use this whenever you need a ``document_splitter_id`` to pass into
``create_workspace`` or ``update_workspace`` with splitting enabled.
The list includes global splitters (notably "General Document
Splitter", a safe default) and any organization-specific splitters
the customer has trained.
There is no separate "get splitter" tool — for splitter details, find
the entry in this list.
Args:
ctx: MCP context (injected by FastMCP).
organization_id: Organization to scope the list to. Required by
the API for access control even when listing global splitters.
List document types
List document types in an organization.
Use this to discover existing document types — for example, to find
a ``document_type_id`` to pass into other tools, to check whether a
similar type already exists before creating a new one, or to show
the user what's configured. Each item includes document counts and
a fields count for a quick activity overview.
For the full settings of a single type (validation toggles, redact
button, refresh behaviour) use ``get_document_type_details``. For its
fields and field groups use ``list_fields``.
Args:
ctx: MCP context (injected by FastMCP).
organization_id: Organization to scope the list to. Required.
limit: Cap on returned items. Default 50 — fits most orgs.
List fields
List a document type's full field schema, grouped by field group.
Use this whenever you need the field layout: discovering field IDs to
pass into other tools, checking for pre-populated template fields
after ``create_document_type``, reading positions before reordering,
or finding numeric IDs to embed in validation rule prompts (the
``@<field_id>`` syntax). Returns each field group with its fields,
plus the child IDs of any ``group``/``table`` parents.
For a single field by ID, use ``get_field``. For just the document
type's settings (no fields), use ``get_document_type_details``.
Validation rules live separately — call ``list_validation_rules``.
Args:
ctx: MCP context (injected by FastMCP).
document_type_id: Document type whose schema to fetch.
List integration connections
List third-party service connections in an organization.
Use this before writing integration code to discover which services
are already authenticated (Slack, Google Sheets, Salesforce, etc.).
Each connection carries an ``account_id`` you reference inside Lambda
code and an ``id`` you pass to ``add_connection_to_integration`` when
attaching the connection to an integration.
If no connection exists for the service the user needs, search
available providers with ``list_pipedream_apps`` and start an OAuth
flow with ``create_connect_token``.
Args:
ctx: MCP context (injected by FastMCP).
organization_id: Organization to list connections for.
List integration runs
List recent runs for an integration, newest first.
Use this to scan run history — for example, after ``run_integration``
to confirm the test landed, or when a user reports problems and you
need to spot which runs failed. Each item includes success status,
triggering document, and a log snippet.
Logs in this list are truncated to 10,000 characters. For diagnosing a
specific failure, identify the run ID here and call ``get_integration_run``
to fetch full untruncated logs.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: Integration to list runs for.
limit: Cap on returned items. Default 5.
List integrations
List integrations in an organization.
Use this to discover existing integrations — for example, to find an
``integration_id`` to pass into other tools, or to show the user what
is already configured. Each item includes name, trigger event, and
enabled / deployed status.
Returns a lean view: Python source code is omitted. To read the code
or attached connections, call ``get_integration`` on a specific item.
Args:
ctx: MCP context (injected by FastMCP).
organization_id: Organization to list integrations for. Required.
workspace_id: Optional — restrict to integrations scoped to one
workspace.
enabled: Optional — ``True`` for enabled-only, ``False`` for
disabled-only, omit for both.
limit: Cap on returned items. Default 20.
List integration secrets
List the names of secrets configured for an integration.
Use this when an integration needs an API key, token, or other credential
to talk to an external service that is NOT being accessed via a Pipedream
connection (Pipedream connections handle their own auth via ``account_id``).
Call this before writing integration code to discover what credentials are
already available — secret names map directly to environment variables
accessible inside the Lambda as ``os.environ["SECRET_NAME"]``.
Returns names only. The secret values themselves live as Lambda
environment variables and are not readable through any tool.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: Integration to list secrets for.
List integration versions
List deployed-version snapshots for an integration, newest first.
Use this when the user wants to roll back a problematic deploy: each
item carries a ``version`` number, the snapshotted code, and an
``is_published`` flag marking the currently-live version. Find the
target version's ``id`` here, then pass it into
``revert_integration_version``.
Versions are written by ``deploy_integration_version``; the in-progress
code held on the integration itself (visible via ``get_integration``)
is not a version until it is deployed.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: Integration to list versions for.
limit: Cap on returned items. Default 10.
List matching criteria
List matching criteria configured on a field.
Use this to inspect HOW a field's extracted value is mapped to its
attached data source — for example before tuning match behaviour, or
to find the ``matching_criterion_id`` to update or delete. Only useful
on fields that already have a data source attached; an unattached
field returns an empty list.
For the data source itself (rows, schema) use ``get_data_source`` and
``list_data_source_values``; matching criteria configure the lookup
behaviour, not the data.
Args:
ctx: MCP context (injected by FastMCP).
field_id: ID of the field whose matching criteria to list.
List model memory documents
List the confirmed reference documents currently in a document type's model memory.
Use this when the user asks about model memory directly, or wants an
overview of the reference examples a document type draws on. Model
memory is the set of confirmed documents the document type uses to
guide extractions on similar docs.
To find which example guided one *specific* document's extraction,
don't list model memory — use ``get_document_extraction`` on that
document and follow its ``reference_document_id`` instead.
Skip this for routine extraction reviews — it's not needed to answer
"what did we extract?". For the full configuration of the document
type itself (fields, validation rules), use ``get_document_type_details``.
To see one document's extraction, use ``get_document_extraction``.
Args:
ctx: MCP context (injected by FastMCP).
document_type_id: Document type to query.
limit: Cap on returned items. Default 50.
List organizations
List organizations the current user belongs to.
Use this as the starting point for almost any flow: an
``organization_id`` is required by ``list_workspaces``,
``create_workspace``, ``list_document_splitters``, ``get_usage`` and
most onboarding tools. Each entry includes ``id``, ``name``, and
``identifier``; pick the org by name or confirm with the user when
multiple are returned.
For a single organization's details there is no dedicated getter — the
fields returned here are the full public surface. Use
``update_organization`` to rename one.
Args:
ctx: MCP context (injected by FastMCP).
limit: Cap on returned items. Default 20 — most users belong to
only a handful of orgs.
List pipedream apps
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.
List recent field annotations
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.
List tags
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.
List validation rules
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.
List workspaces
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.
Populate fields from documents
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.
Reassign document type
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.
Reject documents
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.
Remove connection from integration
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.
Remove tag from documents
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.
Revert integration version
Roll an integration back to a previous version and redeploy it.
Use this when a recent deploy introduced a regression and the user
wants to restore a known-good version. The selected version's code
becomes both the working code on the integration and the live
deployed version in one step — there is no separate redeploy needed.
Find ``version_id`` via ``list_integration_versions`` (the
``is_published`` flag marks the currently-live one — pick a different
snapshot to revert to). To deploy newly-edited code rather than an
older snapshot, use ``deploy_integration_version``.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: Integration to revert.
version_id: ID of the version snapshot to restore.
Run integration
Execute an integration against one document as a test run.
Use this to verify a freshly-deployed integration before enabling it
for live traffic, or to re-test after a fix. The run executes the
currently-deployed version, so it must be preceded by a successful
``deploy_integration_version`` for the latest code to take effect.
The run is flagged as a test and does not count as a production
invocation.
``document_id`` must be the **numeric** document ID (e.g. ``"1000003"``),
not the alphabetic identifier / slug. Inspect the resulting run with
``get_integration_run`` for full logs; ``list_integration_runs`` shows
history with truncated logs.
Args:
ctx: MCP context (injected by FastMCP).
integration_id: Integration to run.
document_id: Numeric document ID to feed into the run.
Set integration secret
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.
Test connection
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.
Update data source
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.
Update data source value
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.
Update document type
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.
Update field
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.
Update integration
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.
Update matching criterion
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.
Update organization
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.
Update tag
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.
Update validation rule
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``.
Update workspace
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``.
Wait for document processing
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.
Conéctate
Añade Affinda MCP a tu Slack en dos minutos.
Sin flujos que configurar. Activa las herramientas que ya usas y tu agente se pone a trabajar.
Añadir a Slack
1
Añade Sokko a Slack
Un clic desde el marketplace de Slack. Todo tu equipo tiene Sokko de una vez.
2
Conecta tus herramientas
Sokko funciona con más de 1000 apps y cualquier servidor MCP.
Martin
9:53 AM
@Sokko
¿Qué puedes hacer con Affinda MCP?
3
Pon a Sokko a trabajar
@menciona a Sokko en cualquier canal y arranca. Minutos, no un fin de semana.
Preguntas, respondidas.
Sokko es un asistente de IA que vive en tu Slack. Conecta tus apps, pide lo que necesitas en lenguaje natural y Sokko se encarga del trabajo por ti.
Regístrate en Sokko, pídele a Sokko que se conecte a Affinda MCP y aprueba la conexión cuando se te solicite. A partir de ahí puedes pedirle a Sokko que haga cosas en Affinda MCP cuando quieras.
No. No hay nada que crear ni configurar. Le pides a Sokko en Slack igual que se lo pedirías a un colega, y Sokko se encarga del resto.
Sí. Pídelo una vez y dile a Sokko cuándo repetirlo, como cada lunes a las 9 h, y se convierte en una rutina que se ejecuta sin ti.
Leer y actuar sobre los datos de Affinda MCP, y lanzar workflows cuando algo cambia. Dile a Sokko el resultado que quieres y se encarga del resto.
Sí. Sokko se conecta a más de 1.000 apps y a cualquier servidor MCP, así que puedes pedir tareas que abarquen Affinda MCP y el resto de tu stack en una sola petición.