search_job_titles
Search for job titles using SQL-like queries to find specific roles. Retrieve relevant results up to a maximum of 100, enabling precise filtering and matching for job title data.
Instructions
Search for job titles matching specific criteria
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL-like query to search for job titles | |
| size | No | Number of results to return (max 100) |
Implementation Reference
- src/index.ts:543-566 (handler)Core handler function that performs the API call to People Data Labs for searching job titles (dataType='job_title'). Validates input, constructs query params, makes GET request to /job_title/search, and returns formatted JSON response.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:321-339 (registration)Registers the 'search_job_titles' tool with the MCP server in the ListTools response, including name, description, and input schema definition.name: 'search_job_titles', description: 'Search for job titles matching specific criteria', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'SQL-like query to search for job titles', }, size: { type: 'number', description: 'Number of results to return (max 100)', minimum: 1, maximum: 100, }, }, required: ['query'], }, },
- src/index.ts:418-419 (handler)Dispatch logic in the CallToolRequest handler that maps 'search_job_titles' tool invocations to handleSearch('job_title', arguments).case 'search_job_titles': return await this.handleSearch('job_title', request.params.arguments);
- src/index.ts:82-90 (helper)Input validation helper used by the search_job_titles handler to ensure query is provided and size is within bounds.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)); };