get_last_updated
Get the date when UK crime data was last updated to ensure you are using current information from police forces across England, Wales, and Northern Ireland.
Instructions
Retrieve the date when crime data was last updated
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:339-342 (handler)The actual handler function `getLastUpdated()` that calls the 'crime-last-updated' API endpoint and returns the date string.
async function getLastUpdated() { const data = await makeApiRequest('crime-last-updated'); return data?.date || ''; } - src/index.ts:88-95 (schema)The tool definition/schema for 'get_last_updated' including name, description, and empty inputSchema (no parameters).
{ name: 'get_last_updated', description: 'Retrieve the date when crime data was last updated', inputSchema: { type: 'object', properties: {} } }, - src/index.ts:447-469 (registration)The toolFunctions mapping that registers 'get_last_updated: getLastUpdated' so the CallToolRequestSchema handler can dispatch to it.
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, get_senior_officers: getSeniorOfficers, get_neighbourhoods: getNeighbourhoods, get_neighbourhood_details: getNeighbourhoodDetails, get_neighbourhood_boundary: getNeighbourhoodBoundary, get_neighbourhood_team: getNeighbourhoodTeam, get_neighbourhood_events: getNeighbourhoodEvents, get_neighbourhood_priorities: getNeighbourhoodPriorities, locate_neighbourhood: locateNeighbourhood, get_stop_searches_by_area: getStopSearchesByArea, get_stop_searches_by_location: getStopSearchesByLocation, get_stop_searches_no_location: getStopSearchesNoLocation, get_stop_searches_by_force: getStopSearchesByForce }; - src/index.ts:8-20 (helper)The `makeApiRequest` helper function used by getLastUpdated to call the police.uk API.
// Helper function to make API requests to police.uk 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; } }