bruno_list_requests
Retrieve all API requests from a Bruno collection to view and manage endpoints for testing and validation.
Instructions
List all requests in a Bruno collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionPath | Yes | Path to the Bruno collection |
Implementation Reference
- The ListRequestsHandler class implements the IToolHandler interface for the 'bruno_list_requests' tool. It validates input, performs security checks, lists requests using BrunoCLI, and formats the output.export class ListRequestsHandler implements IToolHandler { private readonly brunoCLI: IBrunoCLI; private readonly formatter: RequestListFormatter; constructor(brunoCLI: IBrunoCLI) { this.brunoCLI = brunoCLI; this.formatter = new RequestListFormatter(); } getName(): string { return 'bruno_list_requests'; } async handle(args: unknown): Promise<ToolResponse> { const params = ListRequestsSchema.parse(args); // Security validation const validation = await validateToolParameters({ collectionPath: params.collectionPath }); if (!validation.valid) { logSecurityEvent({ type: 'access_denied', details: `List requests blocked: ${validation.errors.join(', ')}`, severity: 'error' }); throw new McpError( ErrorCode.InvalidRequest, `Security validation failed: ${validation.errors.join(', ')}` ); } const requests = await this.brunoCLI.listRequests(params.collectionPath); return { content: [ { type: 'text', text: this.formatter.format(requests) } as TextContent ] }; } }
- Zod schema for validating input parameters of the bruno_list_requests handler.const ListRequestsSchema = z.object({ collectionPath: z.string().describe('Path to the Bruno collection') });
- src/index.ts:124-137 (schema)MCP protocol tool schema definition for 'bruno_list_requests' including input schema.{ name: 'bruno_list_requests', description: 'List all requests in a Bruno collection', inputSchema: { type: 'object', properties: { collectionPath: { type: 'string', description: 'Path to the Bruno collection' } }, required: ['collectionPath'] } },
- src/index.ts:284-298 (registration)Registration of all tool handlers in the ToolRegistry, including ListRequestsHandler for 'bruno_list_requests'.private registerToolHandlers(): void { const container = getContainer(); const perfManager = container.get<PerformanceManager>(ServiceKeys.PERFORMANCE_MANAGER); // Register all tool handlers this.toolRegistry.register(new RunRequestHandler(this.brunoCLI)); this.toolRegistry.register(new RunCollectionHandler(this.brunoCLI)); this.toolRegistry.register(new ListRequestsHandler(this.brunoCLI)); this.toolRegistry.register(new HealthCheckHandler(this.brunoCLI, this.configLoader, perfManager)); this.toolRegistry.register(new DiscoverCollectionsHandler(this.brunoCLI)); this.toolRegistry.register(new ListEnvironmentsHandler(this.brunoCLI)); this.toolRegistry.register(new ValidateEnvironmentHandler(this.brunoCLI)); this.toolRegistry.register(new GetRequestDetailsHandler(this.brunoCLI)); this.toolRegistry.register(new ValidateCollectionHandler(this.brunoCLI)); }