Skip to content

feat(mcp): accept field-fill params on send_documents tool#635

Open
Ortes wants to merge 1 commit into
docusealco:masterfrom
Fullphysio:feat/mcp-send-documents-fields
Open

feat(mcp): accept field-fill params on send_documents tool#635
Ortes wants to merge 1 commit into
docusealco:masterfrom
Fullphysio:feat/mcp-send-documents-fields

Conversation

@Ortes

@Ortes Ortes commented Apr 22, 2026

Copy link
Copy Markdown

Summary

Bring the MCP send_documents tool to parity with the REST POST /submissions endpoint for pre-filling submitter fields. Previously, MCP callers could only set email, name, phone, role per submitter — any values / fields payload was silently dropped.

What changed

lib/mcp/tools/send_documents.rb now accepts per submitter:

  • values — pre-fill field values, keyed by field UUID or field name.
  • fields — per-field overrides (default_value, value, title, description, readonly, required, validation_pattern, invalid_message).
  • readonly_fields — field names to lock for this submitter.
  • metadata, external_id, completed, role, message (subject/body).

The input is normalized via Submissions::NormalizeParamUtils.normalize_submissions_params! before handoff to Submissions.create_from_submitters, matching the exact pipeline used by Api::SubmissionsController#create. The rescue block mirrors the same controller so Submitters::NormalizeValues::BaseError and DownloadUtils::UnableToDownload surface as clean MCP error responses.

Backward compatible: existing callers that only pass email / name / phone / role keep working unchanged.

Test plan

  • Call send_documents with a values hash keyed by field name → verify values resolve to UUIDs and the submitter is created with the correct defaults.
  • Call send_documents with fields: [{ name: "...", default_value: "..." }] → verify the default is merged into values.
  • Pass an unknown field name → verify a clean error is returned (UnknownFieldName).
  • Pass only email/name (legacy shape) → verify behavior unchanged.

🤖 Generated with Claude Code

Mirror the REST API by accepting values, fields, readonly_fields,
metadata, external_id, completed, role and message per submitter.
Input is normalized via Submissions::NormalizeParamUtils so field
names resolve to UUIDs and default_value entries merge into values.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant