Problem
When creating or updating test cases via the MCP tools (addCase, updateCase, updateCases), the server sends all optional step-related fields to the TestRail API whenever they are present:
custom_steps / custom_expected (template 1)
custom_steps_separated (template 2)
TestRail only accepts the fields that belong to the active case template. Sending the wrong combination can result in HTTP 400 responses or fields being silently ignored (e.g. using template 2 but still sending custom_steps / custom_expected).
Expected behavior
- When
templateId is 2, the request body should include custom_steps_separated (and not send template-1-only step fields for those parameters).
- When
templateId is 1, the body should include custom_steps / custom_expected as appropriate (and not send custom_steps_separated for those parameters).
custom_preconds (from customPrerequisites) applies to both templates and should continue to be sent when provided.
- When
templateId is omitted, preserve backward compatibility: send whichever step fields the caller provided (current behavior).
Proposed fix
Centralize mapping in a small helper (e.g. buildCaseStepFields) used by addCase, updateCase, and updateCases, branching on templateId as above.
Environment
- TestRail projects using template 2 (separated steps) are the most affected.
- Repro: call
addCase with templateId: 2, customStepsSeparated, and also pass customSteps/customExpected — observe API error or ignored steps depending on instance.
Issue opened to document background for a focused PR; no unrelated changes (e.g. debug scripts, tool registration refactors).
Problem
When creating or updating test cases via the MCP tools (
addCase,updateCase,updateCases), the server sends all optional step-related fields to the TestRail API whenever they are present:custom_steps/custom_expected(template 1)custom_steps_separated(template 2)TestRail only accepts the fields that belong to the active case template. Sending the wrong combination can result in HTTP 400 responses or fields being silently ignored (e.g. using template 2 but still sending
custom_steps/custom_expected).Expected behavior
templateIdis 2, the request body should includecustom_steps_separated(and not send template-1-only step fields for those parameters).templateIdis 1, the body should includecustom_steps/custom_expectedas appropriate (and not sendcustom_steps_separatedfor those parameters).custom_preconds(fromcustomPrerequisites) applies to both templates and should continue to be sent when provided.templateIdis omitted, preserve backward compatibility: send whichever step fields the caller provided (current behavior).Proposed fix
Centralize mapping in a small helper (e.g.
buildCaseStepFields) used byaddCase,updateCase, andupdateCases, branching ontemplateIdas above.Environment
addCasewithtemplateId: 2,customStepsSeparated, and also passcustomSteps/customExpected— observe API error or ignored steps depending on instance.Issue opened to document background for a focused PR; no unrelated changes (e.g. debug scripts, tool registration refactors).