search_companies
Find companies using filters like category, location, founding date, and status. Retrieve detailed results from Crunchbase data for efficient research and analysis.
Instructions
Search for companies based on various criteria
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter by category (e.g., "Artificial Intelligence", "Fintech") | |
| founded_after | No | Filter by founding date (YYYY-MM-DD) | |
| founded_before | No | Filter by founding date (YYYY-MM-DD) | |
| limit | No | Maximum number of results to return (default: 10) | |
| location | No | Filter by location (e.g., "San Francisco", "New York") | |
| query | No | Search query (e.g., company name, description) | |
| status | No | Filter by company status (e.g., "active", "closed") |
Implementation Reference
- src/index.ts:312-334 (handler)The MCP tool handler for 'search_companies' that processes input parameters into SearchCompaniesInput, calls the Crunchbase API wrapper, and returns the results as JSON text.case 'search_companies': { if (!args || typeof args !== 'object') { throw new McpError(ErrorCode.InvalidParams, 'Invalid parameters'); } const params: SearchCompaniesInput = { query: typeof args.query === 'string' ? args.query : undefined, location: typeof args.location === 'string' ? args.location : undefined, category: typeof args.category === 'string' ? args.category : undefined, founded_after: typeof args.founded_after === 'string' ? args.founded_after : undefined, founded_before: typeof args.founded_before === 'string' ? args.founded_before : undefined, status: typeof args.status === 'string' ? args.status : undefined, limit: typeof args.limit === 'number' ? args.limit : undefined }; const companies = await this.crunchbaseApi.searchCompanies(params); return { content: [ { type: 'text', text: JSON.stringify(companies, null, 2), }, ], }; }
- src/index.ts:192-228 (registration)Registration of the 'search_companies' tool in the listTools response, defining its name, description, and input schema matching SearchCompaniesInput.{ name: 'search_companies', description: 'Search for companies based on various criteria', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (e.g., company name, description)', }, location: { type: 'string', description: 'Filter by location (e.g., "San Francisco", "New York")', }, category: { type: 'string', description: 'Filter by category (e.g., "Artificial Intelligence", "Fintech")', }, founded_after: { type: 'string', description: 'Filter by founding date (YYYY-MM-DD)', }, founded_before: { type: 'string', description: 'Filter by founding date (YYYY-MM-DD)', }, status: { type: 'string', description: 'Filter by company status (e.g., "active", "closed")', }, limit: { type: 'number', description: 'Maximum number of results to return (default: 10)', }, }, }, },
- src/types.ts:115-123 (schema)TypeScript interface SearchCompaniesInput defining the input parameters for the search_companies tool and API method.export interface SearchCompaniesInput { query?: string; location?: string; category?: string; founded_after?: string; founded_before?: string; status?: string; limit?: number; }
- src/crunchbase-api.ts:34-72 (helper)Helper method in CrunchbaseAPI class that builds the search query from parameters and performs the HTTP request to Crunchbase API's /searches/organizations endpoint.async searchCompanies(params: SearchCompaniesInput): Promise<Company[]> { try { // Build the query string based on the provided parameters let query = params.query || ''; if (params.location) { query += ` AND location:${params.location}`; } if (params.category) { query += ` AND category:${params.category}`; } if (params.founded_after) { query += ` AND founded_on:>=${params.founded_after}`; } if (params.founded_before) { query += ` AND founded_on:<=${params.founded_before}`; } if (params.status) { query += ` AND status:${params.status}`; } const response = await this.client.get<CrunchbaseApiResponse<Company[]>>('/searches/organizations', { params: { query, limit: params.limit || 10, order: 'rank DESC' } }); return response.data.data; } catch (error) { console.error('Error searching companies:', error); throw this.handleError(error); } }