search_companies
Find companies by applying SQL-like queries to filter results based on specific criteria, with customizable result sizes up to 100 matches.
Instructions
Search for companies matching specific criteria
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "search_companies"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL-like query to search for companies | |
| size | No | Number of results to return (max 100) |
Implementation Reference
- src/index.ts:543-566 (handler)Core handler function that implements the search_companies tool logic by calling the People Data Labs /company/search API endpoint with the provided SQL query.
private async handleSearch(dataType: string, args: any) { if (!isValidSearchArgs(args)) { throw new McpError( ErrorCode.InvalidParams, `Invalid search parameters. Must provide a query string.` ); } const params: Record<string, any> = { sql: args.query, size: args.size || 10, }; const response = await pdlApi.get(`/${dataType}/search`, { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } - src/index.ts:254-272 (schema)Input schema definition and tool registration for search_companies in the ListTools response.
{ name: 'search_companies', description: 'Search for companies matching specific criteria', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'SQL-like query to search for companies', }, size: { type: 'number', description: 'Number of results to return (max 100)', minimum: 1, maximum: 100, }, }, required: ['query'], }, - src/index.ts:406-407 (registration)Switch case registration that routes search_companies tool calls to the handleSearch function with 'company' data type.
case 'search_companies': return await this.handleSearch('company', request.params.arguments); - src/index.ts:82-90 (helper)Validation helper function used by handleSearch to validate input arguments for search tools including search_companies.
const isValidSearchArgs = (args: any): args is { query: string; size?: number; } => { return typeof args === 'object' && args !== null && typeof args.query === 'string' && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 100)); };