get_outcomes_for_crime
Retrieve the outcome of a UK crime using its 64-character unique persistent ID. Get closure details such as court results or police actions for specific crimes.
Instructions
Retrieve outcomes for a specific crime by persistent ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| persistent_id | Yes | The 64-character unique identifier for the crime |
Implementation Reference
- src/index.ts:344-348 (handler)Handler function that executes the 'get_outcomes_for_crime' tool logic. Extracts the 'persistent_id' from args and calls the UK Police API endpoint 'outcomes-for-crime/{persistent_id}'.
async function getOutcomesForCrime(args: any) { const { persistent_id } = args; const endpoint = `outcomes-for-crime/${persistent_id}`; return await makeApiRequest(endpoint) || {}; } - src/index.ts:96-106 (schema)Schema/input validation definition for the 'get_outcomes_for_crime' tool, specifying the required 'persistent_id' string parameter.
{ name: 'get_outcomes_for_crime', description: 'Retrieve outcomes for a specific crime by persistent ID', inputSchema: { type: 'object', properties: { persistent_id: { type: 'string', description: 'The 64-character unique identifier for the crime' } }, required: ['persistent_id'] } }, - src/index.ts:447-456 (registration)Registration mapping that links the tool name 'get_outcomes_for_crime' to its handler function getOutcomesForCrime.
const toolFunctions = { get_street_level_crimes: getStreetLevelCrimes, get_street_level_outcomes: getStreetLevelOutcomes, get_crimes_at_location: getCrimesAtLocation, get_crimes_no_location: getCrimesNoLocation, get_crime_categories: getCrimeCategories, get_last_updated: getLastUpdated, get_outcomes_for_crime: getOutcomesForCrime, get_list_of_forces: getListOfForces, get_force_details: getForceDetails, - src/index.ts:9-20 (helper)Helper utility used by getOutcomesForCrime to make HTTP GET requests to the data.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; } }