get_senior_officers
Retrieve senior officers for any UK police force by specifying its force ID. Get leadership information for police forces in England, Wales, and Northern Ireland.
Instructions
Retrieve senior officers for a specific police force
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force_id | Yes | The unique identifier for the force |
Implementation Reference
- src/index.ts:126-136 (schema)Schema/registration definition for the 'get_senior_officers' tool, defining its name, description, and input schema requiring a 'force_id' string.
{ name: 'get_senior_officers', description: 'Retrieve senior officers for a specific police force', inputSchema: { type: 'object', properties: { force_id: { type: 'string', description: 'The unique identifier for the force' } }, required: ['force_id'] } }, - src/index.ts:360-364 (handler)Handler function 'getSeniorOfficers' that executes the tool logic. It extracts force_id from args, constructs the API endpoint 'forces/{force_id}/people', and calls makeApiRequest.
async function getSeniorOfficers(args: any) { const { force_id } = args; const endpoint = `forces/${force_id}/people`; return await makeApiRequest(endpoint) || []; } - src/index.ts:457-457 (registration)Registration of the 'get_senior_officers' tool name to its handler function in the toolFunctions mapping object.
get_senior_officers: getSeniorOfficers, - src/index.ts:9-20 (helper)Helper function 'makeApiRequest' used by the handler to make HTTP requests to the police.uk API.
async function makeApiRequest(endpoint: string, params?: Record<string, any>) { const baseUrl = 'https://data.police.uk/api'; const url = `${baseUrl}/${endpoint}`; try { const response = await axios.get(url, { params, timeout: 10000 }); return response.data; } catch (error) { console.error(`API request failed: ${error}`); return null; } }