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 bugs to a test case execution by resolving bug keys automatically. Supports single or bulk linking using explicit defect IDs or a JQL filter.

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).
Install Server

TDQS

A4.4/5.0
Behavior4/5

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

Beyond the annotations, the description discloses meaningful behavior: it automatically resolves Jira keys to numeric defect IDs, removes duplicates, passes JQL through unchanged, and returns warningMessages when the server reports per-bug issues. It never contradicts the annotations, and the mutating nature of 'Link' aligns with readOnlyHint=false.

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 long but well-structured with Parameters, Output Description, Use Cases, Examples, and Hints. It is front-loaded with the core sentence and then organized for quick scanning, though the Use Cases section is somewhat redundant with the opening sentence.

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?

For a tool with five parameters, a nested filter object, and non-trivial output behavior, the description is complete: it covers prerequisites, parameter formats, mutual-exclusivity guidance, JQL handling, default response behavior, and expected outputs with examples. An agent has everything needed to invoke it correctly.

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 coverage is 100%, so this starts at baseline 3, but the description adds real value: it warns to pass Jira keys rather than numeric IDs, states that defectIDs is required when filter.jql is absent, notes automatic duplicate removal, and explains that testCycleKey is used directly as the API path 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 and resource: 'Link Jira bug keys to a test case execution,' and adds the crucial detail that it looks up testCaseExecutionId from testCycleKey and testCaseKey. This clearly distinguishes it from siblings like qtm4j_link_bugs_to_test_step_execution.

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 and prerequisites: call set_project_context first, the execution must already be started, and JQL should be normalized because it is passed through unchanged. It does not explicitly spell out exclusions or name the sibling alternative for step-execution links, so it stops short of a 5.

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

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