enhancement(mcp): accept Result Field values on test_run_results_create#398
Merged
Conversation
`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.
Contributor
Author
|
🎉 This PR is included in version 0.34.9 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
testplanit_test_run_results_createpreviously took only status / notes / elapsed, so a result submission against a template that marks any Result Field required would be rejected server-side withREQUIRED_FIELDS_MISSING— the MCP path was unusable for required-field templates.This PR adds an optional
fieldValues: [{ name, value }]input.namematches the field's display name (case-insensitive) or its system name, scoped to the case's template. Names are resolved server-side to numericfieldIds 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 (
hasMissingRequiredResultFieldinlib/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
Testing
packages/mcp-server/src/tools/runs/results/create.test.tscovering: minimal happy path, displayName resolution (case-insensitive), systemName resolution, unknown-name error,REQUIRED_FIELDS_MISSINGsurfaced unchanged, no-template rejection, and not-found.index.test.tsextended to assert the create tool is registered alongside list + get.dist/cli.js+ a live TestPlanIt instance:fieldValuesagainst a template requiring "Build" → server returnsREQUIRED_FIELDS_MISSING, MCP surfaces it.fieldValues: [{name:"Build", value:"1.2.3"}]→ result row created,ResultFieldValuesrow written withvalue: "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.tsc --noEmitclean.Checklist