Skip to content

enhancement(mcp): accept Result Field values on test_run_results_create#398

Merged
therealbrad merged 2 commits into
mainfrom
enhancement/mcp-result-custom-fields
Jun 4, 2026
Merged

enhancement(mcp): accept Result Field values on test_run_results_create#398
therealbrad merged 2 commits into
mainfrom
enhancement/mcp-result-custom-fields

Conversation

@therealbrad
Copy link
Copy Markdown
Contributor

Description

testplanit_test_run_results_create previously took only status / notes / elapsed, so a result submission against a template that marks any Result Field required would be rejected server-side with REQUIRED_FIELDS_MISSING — the MCP path was unusable for required-field templates.

This PR adds an optional fieldValues: [{ name, value }] input. name matches the field's display name (case-insensitive) or its system name, scoped to the case's template. Names are resolved server-side to numeric fieldIds before the submit-result call, so the agent never sees the IDs. Unknown names are rejected with the available field list in the error message.

The server-side guard (hasMissingRequiredResultField in lib/services/resultGuards.ts) is unchanged — this is purely a tool-surface capability fix, not an enforcement change.

Related Issue

N/A — internal Tier 4 honest-scope follow-up.

Type of Change

  • Enhancement (extending an existing feature)

Testing

  • 7 new co-located unit tests in packages/mcp-server/src/tools/runs/results/create.test.ts covering: minimal happy path, displayName resolution (case-insensitive), systemName resolution, unknown-name error, REQUIRED_FIELDS_MISSING surfaced unchanged, no-template rejection, and not-found.
  • index.test.ts extended to assert the create tool is registered alongside list + get.
  • End-to-end manual smoke against built dist/cli.js + a live TestPlanIt instance:
    • Missing fieldValues against a template requiring "Build" → server returns REQUIRED_FIELDS_MISSING, MCP surfaces it.
    • fieldValues: [{name:"Build", value:"1.2.3"}] → result row created, ResultFieldValues row written with value: "1.2.3".
    • fieldValues: [{name:"Severity", ...}] (unknown name) → MCP short-circuits with "Unknown result field name(s): Severity. Available fields on this template: Version, Build." — no HTTP call to the server.
  • Full mcp-server vitest suite (633 tests) green.
  • tsc --noEmit clean.

Checklist

  • Code follows the project style
  • No new warnings
  • Tests added
  • Self-reviewed

`testplanit_test_run_results_create` previously took only status / notes /
elapsed, so a result submission against a template that marks any Result
Field required would be rejected server-side with REQUIRED_FIELDS_MISSING —
the MCP path was unusable for required-field templates.

Adds an optional `fieldValues: [{ name, value }]` input. `name` matches the
field's displayName (case-insensitive) or its systemName scoped to the
case's template. Names are resolved server-side to numeric fieldIds before
the submit-result call, so the agent never sees the IDs. Unknown names are
rejected with the available field list in the error message.

The server-side guard (`hasMissingRequiredResultField` in
`lib/services/resultGuards.ts`) is unchanged — this is purely a tool-surface
capability fix, not an enforcement change.

Tests: 7 new co-located cases in create.test.ts (happy path with no
fieldValues, displayName resolution, systemName resolution, unknown-name
error, REQUIRED_FIELDS_MISSING surfaced, no-template rejection, not-found),
plus the existing index.test.ts now asserts the create tool is registered
alongside list + get.
Patch bump for @testplanit/mcp-server so the result-field-values addition
publishes as 0.1.4 on merge of the Version Packages PR.
@therealbrad therealbrad merged commit b19d07b into main Jun 4, 2026
5 checks passed
@therealbrad therealbrad deleted the enhancement/mcp-result-custom-fields branch June 4, 2026 02:55
@therealbrad
Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 0.34.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant