Skip to content

Commit ff81d6e

Browse files
committed
refactor: Simplify build ID retrieval and enhance tool descriptions for clarity
1 parent 3c0fec9 commit ff81d6e

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/tools/rca-agent.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,22 @@ export async function listTestIdsTool(
4343
args: {
4444
projectName: string;
4545
buildName: string;
46-
buildId?: string;
4746
status?: TestStatus;
4847
},
4948
config: BrowserStackConfig,
5049
): Promise<CallToolResult> {
5150
try {
5251
const { projectName, buildName, status } = args;
53-
let { buildId } = args;
5452
const authString = getBrowserStackAuth(config);
5553
const [username, accessKey] = authString.split(":");
5654

5755
// Get build ID if not provided
58-
buildId =
59-
buildId ||
60-
(await getBuildId(projectName, buildName, username, accessKey));
56+
const buildId = await getBuildId(
57+
username,
58+
accessKey,
59+
projectName,
60+
buildName,
61+
);
6162

6263
// Get test IDs
6364
const testIds = await getTestIds(buildId, authString, status);
@@ -94,12 +95,13 @@ export default function addRCATools(
9495

9596
tools.fetchRCA = server.tool(
9697
"fetchRCA",
97-
"Retrieves AI-RCA (Root Cause Analysis) data for a BrowserStack Automate session and provides insights into test failures.",
98+
"Retrieves AI-RCA (Root Cause Analysis) data for a BrowserStack Automate and App-Automate session and provides insights into test failures.",
9899
{
99100
testId: z
100101
.array(z.string())
102+
.max(3)
101103
.describe(
102-
"Array of test IDs to fetch RCA data for If not provided call listTestIds tool first to get the IDs",
104+
"Array of test IDs to fetch RCA data. Input should be a maximum of 3 IDs at a time. If you get more than 3 Ids ask user to choose less than 3",
103105
),
104106
},
105107
async (args) => {
@@ -122,16 +124,10 @@ export default function addRCATools(
122124

123125
tools.listTestIds = server.tool(
124126
"listTestIds",
125-
"List test IDs from a BrowserStack Automate build, optionally filtered by status (e.g., 'failed', 'passed').",
127+
"List test IDs from a BrowserStack Automate build, optionally filtered by status",
126128
{
127129
projectName: z.string().describe("The project name of the test run"),
128130
buildName: z.string().describe("The build name of the test run"),
129-
buildId: z
130-
.string()
131-
.optional()
132-
.describe(
133-
"The build ID of the test run (will be auto-detected if not provided)",
134-
),
135131
status: z
136132
.nativeEnum(TestStatus)
137133
.optional()

0 commit comments

Comments
 (0)