Skip to main content
Glama
SmartBear

SmartBear MCP server

Official
by SmartBear

QTM4J: Link Bugs to Test Step Execution

qtm4j_link_bugs_to_test_step_execution

Links Jira bug keys to a specific test step execution by identifying the execution through cycle, test case, and step sequence, then resolves and attaches the selected defects automatically.

Instructions

Link Jira bug keys to a test step execution. Looks up testStepExecutionId from testCycleKey, testCaseKey, and step sequence number; 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'.

  • testStepSeqNo (number) required: sequence number of the test step within the test case (e.g. 2 = the second step).

  • 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 specific test step execution in a single request, supporting both single and bulk linking operations.

Examples:

  1. Link a bug to step 2 of a test case execution

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

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

  1. Link multiple bugs to step 3 and suppress defect count

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

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

  1. Link bugs to a step using a JQL filter

{
  "testCycleKey": "PROJ-TR-101",
  "testCaseKey": "PROJ-TC-42",
  "testStepSeqNo": 1,
  "filter": {
    "jql": "project = PROJ AND status = Open"
  }
}

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

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 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.
testStepSeqNoYessequence number of the test step within the test case (e.g. 2 = the second step).
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).
Behavior5/5

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

Annotations only provide basic hints (not read-only, not idempotent, not destructive). The description adds rich behavioral details: automatic resolution of bug keys to numeric defect IDs, duplicate removal, default behavior of returnLinkedDefectCount, and the presence of warningMessages for per-bug issues. It also notes the JQL is passed through unchanged, which is critical for correct use. No contradictions with annotations.

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

Conciseness5/5

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

While lengthy, the description is well-structured with clear sections (Toolset, Parameters, Output, Use Cases, Examples, Hints). Every sentence adds useful information, and the purpose is front-loaded. The examples are not redundant but illustrate key parameter combinations and expected outputs.

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?

The description covers the full context: prerequisites, parameter formats, output summary, three examples, and operational hints. With an output schema present, the lack of exhaustive return field documentation is acceptable, and the Output Description succinctly covers the main response structure.

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 descriptions already cover all 6 parameters (100% coverage), giving a solid baseline of 3. The description adds extra value by clarifying that defectIDs must be Jira keys (not numeric IDs), that duplicates are removed automatically, and the mutual exclusivity/behavior of filter vs defectIDs. Examples also illustrate parameter usage in a realistic context.

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 step execution.' It further clarifies scope by explaining the internal ID lookup and automatic bug key resolution, which distinguishes it from sibling tools like qtm4j_link_bugs_to_test_case_execution and qtm4j_get_linked_bugs_of_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?

Hints explicitly state prerequisites: call set_project_context before, and an execution must already be started. The parameter description notes that defectIDs is required if filter.jql is not provided, giving clear selection criteria. However, it does not explicitly exclude using this tool for linking bugs to a whole test case execution (a sibling tool), though the step-specific focus is evident.

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