Skip to main content
Glama
SmartBear

SmartBear MCP server

Official
by SmartBear

QTM4J: Link Bugs to Test Case Execution

qtm4j_link_bugs_to_test_case_execution

Link Jira bug keys to a test case execution by supplying test cycle and test case keys, then passing bug issue keys or a JQL filter. Resolves bug keys to numeric defect IDs automatically and confirms the number of linked defects.

Instructions

Link Jira bug keys to a test case execution. Looks up testCaseExecutionId from testCycleKey and testCaseKey; resolves bug keys to numeric defect IDs automatically.

Toolset: Test Executions

Parameters:

  • testCycleKey (string) required: Test cycle key in the format '{PROJECT_KEY}-TR-{number}', e.g. 'SCRUM-TR-101'. Used directly as the API path parameter.

  • testCaseKey (string) required: Test case key in the format '{PROJECT_KEY}-TC-{number}', e.g. 'SCRUM-TC-145'.

  • defectIDs (any): Jira issue keys of the bugs to link (e.g. ['PROJ-456', 'PROJ-789']). Pass Jira keys — not numeric IDs. Required if filter.jql is not provided; duplicates removed automatically.

  • filter (object): JQL filter to select which bugs should be linked. Use instead of or in addition to defectIDs.

  • returnLinkedDefectCount (boolean): When true, the response includes linkedDefectCount (the number of bugs linked). Defaults to true. (default: true)

Output Description: Confirmation object with testCycleKey, testCaseKey, linked: true, and linkedDefectCount (by default). warningMessages is included when the server reports per-bug issues.

Use Cases: 1. Link one or more Jira bugs to a test case execution in a single request, supporting both single and bulk linking operations.

Examples:

  1. Link two bugs to a test case execution

{
  "testCycleKey": "PROJ-TR-101",
  "testCaseKey": "PROJ-TC-42",
  "defectIDs": [
    "PROJ-456",
    "PROJ-789"
  ]
}

Expected Output: { testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', linked: true, linkedDefectCount: 2 }

  1. Link a bug and suppress defect count in response

{
  "testCycleKey": "PROJ-TR-101",
  "testCaseKey": "PROJ-TC-42",
  "defectIDs": [
    "PROJ-456"
  ],
  "returnLinkedDefectCount": false
}

Expected Output: { testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', linked: true }

  1. Link bugs using a JQL filter

{
  "testCycleKey": "PROJ-TR-101",
  "testCaseKey": "PROJ-TC-42",
  "filter": {
    "jql": "project = PROJ AND issuetype = Bug AND status = 'To Do'"
  }
}

Expected Output: { testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', linked: true, linkedDefectCount: 5 }

Hints: 1. Call set_project_context before this tool. 2. An execution must already be started for the test case before bugs can be linked. 3. If the user provides a JQL expression, pass it as the filter.jql field. Correct or normalize JQL before calling this tool if needed — the handler passes it through unchanged.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoJQL filter to select which bugs should be linked. Use instead of or in addition to defectIDs.
defectIDsNoJira issue keys of the bugs to link (e.g. ['PROJ-456', 'PROJ-789']). Pass Jira keys — not numeric IDs. Required if filter.jql is not provided; duplicates removed automatically.
testCaseKeyYesTest case key in the format '{PROJECT_KEY}-TC-{number}', e.g. 'SCRUM-TC-145'.
testCycleKeyYesTest cycle key in the format '{PROJECT_KEY}-TR-{number}', e.g. 'SCRUM-TR-101'. Used directly as the API path parameter.
returnLinkedDefectCountNoWhen true, the response includes linkedDefectCount (the number of bugs linked). Defaults to true.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
linkedYesTrue — confirms the link request was accepted.
testCaseKeyYesTest case key of the execution the bugs were linked to (e.g. 'SCRUM-TC-145').
testCycleKeyYesTest cycle Key of the execution the bugs were linked to (e.g. 'SCRUM-TR-101').
warningMessagesNoPer-bug warnings reported by the server (e.g. a bug key not accessible in Jira). Present only when issues occurred; the remaining bugs are still linked.
linkedDefectCountNoNumber of bugs successfully linked. Present when returnLinkedDefectCount is true (default).
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide no safety profile (readOnlyHint=false, destructiveHint=false), so the description carries the disclosure burden. It explains non-obvious behaviors: automatically looking up the execution ID, resolving Jira keys to numeric defect IDs, removing duplicates automatically, and passing JQL through unchanged. It also discloses the output shape and warningMessages behavior. This goes well beyond a simple mutation statement, though it doesn't cover permissions or reversibility.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Toolset, Parameters, Output Description, Use Cases, Examples, Hints) and contains no wasted sentences. It is longer than a simple one-liner but the length is justified by the complexity of the tool (5 parameters, nested filter object, multiple examples). The opening sentence is front-loaded, and each section contributes actionable guidance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 params, nested objects, output schema present), the description is thorough. It covers the end-to-end workflow: prerequisites, how key resolution works, mutually exclusive/alternative parameters, output confirmation format, and per-bug warnings. The examples are directly applicable to real invocation patterns. The presence of an output schema means return values are already specified, and the description complements it well.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3, but the description adds value beyond the schema. It clarifies that defectIDs should be Jira keys not numeric IDs, that defectIDs is required if filter.jql is not provided, and that filter can be used 'instead of or in addition to' defectIDs. Examples illustrate parameter combinations and expected outputs, enhancing the semantic understanding of each parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource statement: 'Link Jira bug keys to a test case execution.' This clearly distinguishes it from the sibling tool qtm4j_link_bugs_to_test_step_execution by explicitly targeting test case executions. It also adds operational detail (looks up testCaseExecutionId from keys, resolves bug keys to numeric IDs) that removes any ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool: it's part of the 'Test Executions' toolset, and the Hints section states prerequisites ('Call set_project_context before this tool', 'An execution must already be started'). It also explains the relationship between defectIDs and filter (use in addition or alternatively). However, it does not explicitly mention when to prefer this over sibling tools, though the resource-specific naming makes that largely implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SmartBear/smartbear-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server