Skip to main content
Glama

bruno_discover_collections

Find Bruno API collections by scanning directories for bruno.json files. Specify a search path and optional depth limit to locate all collections automatically.

Instructions

Discover Bruno collections by recursively searching for bruno.json files in a directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchPathYesDirectory path to search for Bruno collections
maxDepthNoMaximum directory depth to search (default: 5, max: 10)

Implementation Reference

  • The DiscoverCollectionsHandler class implements IToolHandler for 'bruno_discover_collections'. It validates input, discovers collections using BrunoCLI.discoverCollections, formats output, and handles errors.
    export class DiscoverCollectionsHandler implements IToolHandler { private readonly brunoCLI: IBrunoCLI; constructor(brunoCLI: IBrunoCLI) { this.brunoCLI = brunoCLI; } getName(): string { return 'bruno_discover_collections'; } async handle(args: unknown): Promise<ToolResponse> { const params = DiscoverCollectionsSchema.parse(args); // Validate search path const validation = await validateToolParameters({ collectionPath: params.searchPath }); if (!validation.valid) { throw new McpError( ErrorCode.InvalidParams, `Invalid search path: ${validation.errors.join(', ')}` ); } try { const collections = await this.brunoCLI.discoverCollections( params.searchPath, params.maxDepth || 5 ); const output: string[] = []; if (collections.length === 0) { output.push(`No Bruno collections found in: ${params.searchPath}`); output.push(''); output.push('A Bruno collection is a directory containing a bruno.json file.'); } else { output.push(`Found ${collections.length} Bruno collection(s):\n`); collections.forEach((collectionPath, index) => { output.push(`${index + 1}. ${collectionPath}`); }); } 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 discover collections: ${maskedError}` ); } } }
  • MCP tool definition including name, description, and inputSchema for bruno_discover_collections in the TOOLS array used for listTools.
    { name: 'bruno_discover_collections', description: 'Discover Bruno collections in a directory tree', inputSchema: { type: 'object', properties: { searchPath: { type: 'string', description: 'Directory path to search for Bruno collections' }, maxDepth: { type: 'number', description: 'Maximum directory depth to search (default: 5)' } }, required: ['searchPath'] } },
  • src/index.ts:293-293 (registration)
    Registration of the DiscoverCollectionsHandler instance in the ToolRegistry during server initialization.
    this.toolRegistry.register(new DiscoverCollectionsHandler(this.brunoCLI));
  • Zod schema for input validation used within the handler's handle method.
    const DiscoverCollectionsSchema = z.object({ searchPath: z.string().describe('Directory path to search for Bruno collections'), maxDepth: z.number().optional().describe('Maximum directory depth to search (default: 5)') });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jcr82/bruno-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server