Skip to content

Commit 2f448e8

Browse files
authored
fix: improve get_network_request description (#500)
Closes #497
1 parent aae8c0f commit 2f448e8

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

docs/tool-reference.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,11 @@
246246

247247
### `get_network_request`
248248

249-
**Description:** Gets a network request by reqid. You can get all requests by calling [`list_network_requests`](#list_network_requests).
250-
Get the request currently selected in the DevTools UI by ommitting reqid
249+
**Description:** Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.
251250

252251
**Parameters:**
253252

254-
- **reqid** (number) _(optional)_: The reqid of the network request. If omitted, looks up the current request selected in DevTools UI.
253+
- **reqid** (number) _(optional)_: The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.
255254

256255
---
257256

src/formatters/networkFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function getShortDescriptionForRequest(
1616
selectedInDevToolsUI = false,
1717
): string {
1818
// TODO truncate the URL
19-
return `reqid=${id} ${request.method()} ${request.url()} ${getStatusFromRequest(request)}${selectedInDevToolsUI ? ` [selected in DevTools UI]` : ''}`;
19+
return `reqid=${id} ${request.method()} ${request.url()} ${getStatusFromRequest(request)}${selectedInDevToolsUI ? ` [selected in the DevTools Network panel]` : ''}`;
2020
}
2121

2222
export function getStatusFromRequest(request: HTTPRequest): string {

src/tools/network.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ export const listNetworkRequests = defineTool({
8484

8585
export const getNetworkRequest = defineTool({
8686
name: 'get_network_request',
87-
description: `Gets a network request by reqid. You can get all requests by calling ${listNetworkRequests.name}.
88-
Get the request currently selected in the DevTools UI by ommitting reqid`,
87+
description: `Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.`,
8988
annotations: {
9089
category: ToolCategory.NETWORK,
9190
readOnlyHint: true,
@@ -95,7 +94,7 @@ Get the request currently selected in the DevTools UI by ommitting reqid`,
9594
.number()
9695
.optional()
9796
.describe(
98-
'The reqid of the network request. If omitted, looks up the current request selected in DevTools UI.',
97+
'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.',
9998
),
10099
},
101100
handler: async (request, response, context) => {
@@ -107,7 +106,7 @@ Get the request currently selected in the DevTools UI by ommitting reqid`,
107106
response.attachNetworkRequest(data?.requestId);
108107
} else {
109108
response.appendResponseLine(
110-
`Nothing is currently selected in DevTools UI.`,
109+
`Nothing is currently selected in the DevTools Network panel.`,
111110
);
112111
}
113112
}

tests/formatters/networkFormatter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('networkFormatter', () => {
7878

7979
assert.equal(
8080
result,
81-
'reqid=1 GET http://example.com [pending] [selected in DevTools UI]',
81+
'reqid=1 GET http://example.com [pending] [selected in the DevTools Network panel]',
8282
);
8383
});
8484
});

0 commit comments

Comments
 (0)