get_crimes_no_location
Fetch crimes that could not be mapped to a specific location, filtered by category, police force, and month.
Instructions
Retrieve crimes that could not be mapped to a location
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | The category of the crimes | |
| force | Yes | Specific police force | |
| date | No | Limit results to a specific month (YYYY-MM) |
Implementation Reference
- src/index.ts:326-331 (handler)Handler function that calls the police.uk API endpoint 'crimes-no-location' with category, force, and optional date parameters. Returns crimes that could not be mapped to a location.
async function getCrimesNoLocation(args: any) { const { category, force, date } = args; const params: Record<string, any> = { category, force }; if (date) params.date = date; return await makeApiRequest('crimes-no-location', params) || []; } - src/index.ts:65-77 (schema)Input schema definition for get_crimes_no_location tool. Requires 'category' and 'force', with optional 'date'.
{ name: 'get_crimes_no_location', description: 'Retrieve crimes that could not be mapped to a location', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'The category of the crimes' }, force: { type: 'string', description: 'Specific police force' }, date: { type: 'string', description: 'Limit results to a specific month (YYYY-MM)' } }, required: ['category', 'force'] } }, - src/index.ts:451-451 (registration)Registration of the getCrimesNoLocation handler function under the tool name 'get_crimes_no_location' in the toolFunctions mapping object.
get_crimes_no_location: getCrimesNoLocation, - src/index.ts:9-20 (helper)Shared helper function used by getCrimesNoLocation 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; } }