Skip to content

Chrome DevTools for coding agents

fix: improve get_network_request description (#500)

Alex Rudenko2f448e84ea8d
diff --git a/docs/tool-reference.md b/docs/tool-reference.md
index 2fa445b2..b5106dcf 100644
--- a/docs/tool-reference.md
+++ b/docs/tool-reference.md
@@ -246,12 +246,11 @@
### `get_network_request`
-**Description:** Gets a network request by reqid. You can get all requests by calling [`list_network_requests`](#list_network_requests).
-Get the request currently selected in the DevTools UI by ommitting reqid
+**Description:** Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.
**Parameters:**
-- **reqid** (number) _(optional)_: The reqid of the network request. If omitted, looks up the current request selected in DevTools UI.
+- **reqid** (number) _(optional)_: The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.
---
diff --git a/src/formatters/networkFormatter.ts b/src/formatters/networkFormatter.ts
index d3945130..74ba1184 100644
--- a/src/formatters/networkFormatter.ts
+++ b/src/formatters/networkFormatter.ts
@@ -16,7 +16,7 @@ export function getShortDescriptionForRequest(
selectedInDevToolsUI = false,
): string {
// TODO truncate the URL
- return `reqid=${id} ${request.method()} ${request.url()} ${getStatusFromRequest(request)}${selectedInDevToolsUI ? ` [selected in DevTools UI]` : ''}`;
+ return `reqid=${id} ${request.method()} ${request.url()} ${getStatusFromRequest(request)}${selectedInDevToolsUI ? ` [selected in the DevTools Network panel]` : ''}`;
}
export function getStatusFromRequest(request: HTTPRequest): string {
diff --git a/src/tools/network.ts b/src/tools/network.ts
index 1df94550..e2923c42 100644
--- a/src/tools/network.ts
+++ b/src/tools/network.ts
@@ -84,8 +84,7 @@ export const listNetworkRequests = defineTool({
export const getNetworkRequest = defineTool({
name: 'get_network_request',
- description: `Gets a network request by reqid. You can get all requests by calling ${listNetworkRequests.name}.
-Get the request currently selected in the DevTools UI by ommitting reqid`,
+ description: `Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.`,
annotations: {
category: ToolCategory.NETWORK,
readOnlyHint: true,
@@ -95,7 +94,7 @@ Get the request currently selected in the DevTools UI by ommitting reqid`,
.number()
.optional()
.describe(
- 'The reqid of the network request. If omitted, looks up the current request selected in DevTools UI.',
+ 'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.',
),
},
handler: async (request, response, context) => {
@@ -107,7 +106,7 @@ Get the request currently selected in the DevTools UI by ommitting reqid`,
response.attachNetworkRequest(data?.requestId);
} else {
response.appendResponseLine(
- `Nothing is currently selected in DevTools UI.`,
+ `Nothing is currently selected in the DevTools Network panel.`,
);
}
}
diff --git a/tests/formatters/networkFormatter.test.ts b/tests/formatters/networkFormatter.test.ts
index 2bd1bbd6..b6edd56a 100644
--- a/tests/formatters/networkFormatter.test.ts
+++ b/tests/formatters/networkFormatter.test.ts
@@ -78,7 +78,7 @@ describe('networkFormatter', () => {
assert.equal(
result,
- 'reqid=1 GET http://example.com [pending] [selected in DevTools UI]',
+ 'reqid=1 GET http://example.com [pending] [selected in the DevTools Network panel]',
);
});
});