bruno_get_request_details
Inspect API request details including method, URL, headers, body, and tests without executing the request to analyze and validate collection structure.
Instructions
Get detailed information about a specific request without executing it (method, URL, headers, body, tests)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionPath | Yes | Path to the Bruno collection | |
| requestName | Yes | Name of the request to inspect |
Implementation Reference
- GetRequestDetailsHandler class implementing the tool logic for bruno_get_request_details, including getName() and handle() method that fetches and formats request details using BrunoCLIexport class GetRequestDetailsHandler implements IToolHandler { private readonly brunoCLI: IBrunoCLI; constructor(brunoCLI: IBrunoCLI) { this.brunoCLI = brunoCLI; } getName(): string { return 'bruno_get_request_details'; } async handle(args: unknown): Promise<ToolResponse> { const params = GetRequestDetailsSchema.parse(args); // Validate parameters const validation = await validateToolParameters({ collectionPath: params.collectionPath, requestName: params.requestName }); if (!validation.valid) { throw new McpError( ErrorCode.InvalidParams, `Invalid parameters: ${validation.errors.join(', ')}` ); } try { const details = await this.brunoCLI.getRequestDetails( params.collectionPath, params.requestName ) as { name: string; method: string; url: string; auth: string; headers: Record<string, string>; body?: { type: string; content: string }; tests?: string[]; metadata: { type: string; seq?: number }; }; const output: string[] = []; output.push(`=== Request Details: ${details.name} ===`); output.push(''); // Method and URL output.push(`Method: ${details.method}`); output.push(`URL: ${details.url}`); output.push(`Auth: ${details.auth}`); output.push(''); // Headers if (Object.keys(details.headers).length > 0) { output.push('Headers:'); Object.entries(details.headers).forEach(([key, value]) => { output.push(` ${key}: ${value}`); }); output.push(''); } // Body if (details.body) { output.push(`Body Type: ${details.body.type}`); output.push('Body Content:'); // Format body content with indentation const bodyLines = details.body.content.split('\n'); bodyLines.forEach(line => { output.push(` ${line}`); }); output.push(''); } else { output.push('Body: none'); output.push(''); } // Tests if (details.tests && details.tests.length > 0) { output.push(`Tests: ${details.tests.length}`); details.tests.forEach((test, index) => { output.push(` ${index + 1}. ${test}`); }); output.push(''); } else { output.push('Tests: none'); output.push(''); } // Metadata output.push('Metadata:'); output.push(` Type: ${details.metadata.type}`); if (details.metadata.seq !== undefined) { output.push(` Sequence: ${details.metadata.seq}`); } return { content: [ { type: 'text', text: output.join('\n') } as TextContent ] }; } catch (error) { const maskedError = error instanceof Error ? maskSecretsInError(error) : error; throw new McpError( ErrorCode.InternalError, `Failed to get request details: ${maskedError}` ); } } }
- Zod schema for validating input parameters: collectionPath and requestNameconst GetRequestDetailsSchema = z.object({ collectionPath: z.string().describe('Path to the Bruno collection'), requestName: z.string().describe('Name of the request to inspect') });
- src/index.ts:205-222 (registration)Tool registration in TOOLS array with name, description, and inputSchema for MCP protocol{ name: 'bruno_get_request_details', description: 'Get detailed information about a specific request without executing it', inputSchema: { type: 'object', properties: { collectionPath: { type: 'string', description: 'Path to the Bruno collection' }, requestName: { type: 'string', description: 'Name of the request to inspect' } }, required: ['collectionPath', 'requestName'] } },
- src/index.ts:288-298 (registration)Runtime registration of GetRequestDetailsHandler instance to ToolRegistry in registerToolHandlers() method// 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)); }