Skip to content

qtm4j_search_test_cases: filter.folders is ignored; schema inconsistent with other QTM4J tools (folderId) #631

Closed

Description

@chandrahaas-komprise

Summary

qtm4j_search_test_cases documents filter.folders (array of numeric folder IDs) for folder-scoped search, but the filter appears to have no effect on results. The response total and first page are identical to an unfiltered project-wide search.

Other QTM4J MCP tools (e.g. qtm4j_search_test_cycles, link/unlink tools) use folderId (singular number), not folders. This inconsistency may indicate the wrong filter field name is exposed for test case search.

Environment

  • Package: @smartbear/mcp 0.33.0 (via npx -y @smartbear/mcp)
  • Client: Cursor MCP (smartbear server)
  • QTM4J project: KOMTEST (projectId 10100, Jira: komprise.atlassian.net)
  • Folder under test: Data Copy (folderId 53554)

Steps to reproduce

  1. Call qtm4j_set_project_context with projectKey: "KOMTEST".
  2. Call qtm4j_search_test_cases with:
{
  "filter": {
    "projectId": "10100",
    "folders": [53554]
  },
  "fields": ["key", "summary", "status", "folders"],
  "maxResults": 50,
  "startAt": 0,
  "sort": "key:asc"
}
  1. Compare with a baseline call that omits folders (only projectId / default context).

Actual behavior

Filter total First results
{ "projectId": "10100" } 21359 KOMTEST-TC-8, TC-10, … (folders: null)
{ "projectId": "10100", "folders": [53554] } 21359 Same page — no folder narrowing
{ "projectId": "10100", "folders": [53554], "status": ["Automatable"] } 2173 Status filter works; results span many folders (not only 53554)

Known test case in folder 53554 (KOMTEST-TC-2842, summary: "Files copy failure - lock the file etc") is not returned on page 1 when folders: [53554] is set, even though its folders field in unfiltered paginated results is [{ "id": 53554, "name": "Data Copy" }].

Passing filter.folderId: 53554 is silently dropped by the Zod schema in src/qtm4j/schema/get-test-case.schema.ts (field not defined), so it cannot be used as a workaround via MCP.

Expected behavior

  • filter.folders: [53554] should return only test cases whose folder is Data Copy (id 53554).
  • total should reflect the folder-scoped count (much smaller than 21359 for this folder).
  • Behavior should match the QTM4J UI, which lists folder contents via Manage/TestCase?folderId=53554&projectId=10100&projectKey=KOMTEST.

Notes / suspected cause

  1. Schema inconsistency: SearchTestCaseFilter uses folders: number[], while qtm4j_search_test_cycles and linking tools document folderId: number. InputField.FOLDER in field-resolution.types.ts is "folderId", not "folders".
  2. MCP handler (get-test-cases.ts) POSTs the filter body as-is to .../testcases/search with no folder field mapping/resolution.
  3. projectId is already auto-injected from project context (String(context.projectId)); adding it explicitly does not change behavior.

Suggested fix

  • Verify the QTM4J /testcases/search API contract for folder filtering.
  • Align MCP schema with the API (likely folderId and/or map folders → API field).
  • Add integration test: search with folder filter returns only cases in that folder.
  • Document supported folder filter field name consistently across QTM4J tools.

Workaround

Paginate all project test cases and filter client-side on data[].folders[].id, which is slow for large projects (~21k cases / 428 pages at maxResults=50).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions