Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/tool-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---

Expand Down
2 changes: 1 addition & 1 deletion src/formatters/networkFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 3 additions & 4 deletions src/tools/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) => {
Expand All @@ -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.`,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/formatters/networkFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
);
});
});
Expand Down