get_list_of_forces
Get a comprehensive list of all police forces in the UK using the Police UK API. Retrieve force names and identifiers for use with other crime data queries.
Instructions
Retrieve a list of all police forces
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:350-352 (handler)The handler function for get_list_of_forces. It calls the police.uk API 'forces' endpoint and returns the list of all police forces.
async function getListOfForces() { return await makeApiRequest('forces') || []; } - src/index.ts:107-114 (schema)Schema definition for get_list_of_forces tool. It takes no input parameters (empty properties object).
{ name: 'get_list_of_forces', description: 'Retrieve a list of all police forces', inputSchema: { type: 'object', properties: {} } }, - src/index.ts:455-455 (registration)Registration mapping the tool name 'get_list_of_forces' to its handler function getListOfForces in the toolFunctions object.
get_list_of_forces: getListOfForces, - dist/index.js:344-346 (handler)The compiled handler function for get_list_of_forces in the dist file.
async function getListOfForces() { return await makeApiRequest('forces') || []; } - dist/index.js:439-439 (registration)Registration mapping in the dist file.
get_list_of_forces: getListOfForces, - src/index.ts:9-20 (helper)The makeApiRequest helper function used by getListOfForces to call 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; } }