get_neighbourhood_events
Retrieve scheduled events for a specific UK neighbourhood by providing force and neighbourhood IDs, enabling access to local police events.
Instructions
Retrieve events scheduled for a specific neighbourhood
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force_id | Yes | The unique identifier for the force | |
| neighbourhood_id | Yes | The unique identifier for the neighbourhood |
Implementation Reference
- src/index.ts:390-394 (handler)The handler function for get_neighbourhood_events. Makes an API request to the UK Police Data API to retrieve events for a given police force and neighbourhood.
async function getNeighbourhoodEvents(args: any) { const { force_id, neighbourhood_id } = args; const endpoint = `${force_id}/${neighbourhood_id}/events`; return await makeApiRequest(endpoint) || []; } - src/index.ts:184-194 (schema)The tool schema/definition for get_neighbourhood_events, including its name, description, and inputSchema (requiring force_id and neighbourhood_id strings).
{ name: 'get_neighbourhood_events', description: 'Retrieve events scheduled for a specific neighbourhood', inputSchema: { type: 'object', properties: { force_id: { type: 'string', description: 'The unique identifier for the force' }, neighbourhood_id: { type: 'string', description: 'The unique identifier for the neighbourhood' } }, required: ['force_id', 'neighbourhood_id'] } - src/index.ts:462-462 (registration)The tool function mapping that registers get_neighbourhood_events (string name) to the getNeighbourhoodEvents handler function.
get_neighbourhood_events: getNeighbourhoodEvents, - src/index.ts:8-20 (helper)The makeApiRequest helper function used by the handler to make HTTP requests to the UK Police Data 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; } }