Repository navigation
qtm4j_search_test_cases: filter.folders is ignored; schema inconsistent with other QTM4J tools (folderId) #631
Description
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/mcp0.33.0 (vianpx -y @smartbear/mcp) - Client: Cursor MCP (
smartbearserver) - QTM4J project: KOMTEST (
projectId10100, Jira:komprise.atlassian.net) - Folder under test: Data Copy (
folderId53554)
Steps to reproduce
- Call
qtm4j_set_project_contextwithprojectKey: "KOMTEST". - Call
qtm4j_search_test_caseswith:
{
"filter": {
"projectId": "10100",
"folders": [53554]
},
"fields": ["key", "summary", "status", "folders"],
"maxResults": 50,
"startAt": 0,
"sort": "key:asc"
}- Compare with a baseline call that omits
folders(onlyprojectId/ 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).totalshould 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
- Schema inconsistency:
SearchTestCaseFilterusesfolders: number[], whileqtm4j_search_test_cyclesand linking tools documentfolderId: number.InputField.FOLDERinfield-resolution.types.tsis"folderId", not"folders". - MCP handler (
get-test-cases.ts) POSTs the filter body as-is to.../testcases/searchwith no folder field mapping/resolution. projectIdis already auto-injected from project context (String(context.projectId)); adding it explicitly does not change behavior.
Suggested fix
- Verify the QTM4J
/testcases/searchAPI contract for folder filtering. - Align MCP schema with the API (likely
folderIdand/or mapfolders→ 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).
Activity
fix(qtm4j): fix folderId handling in create and search test case tools (