Skip to main content
Glama
dwain-barnes

MCP Server Police UK

by dwain-barnes

get_crimes_at_location

Retrieve street-level crimes at a location using latitude/longitude or location ID, with optional filter by month (YYYY-MM).

Instructions

Retrieve crimes at a specific location by ID or nearest to lat/lng

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latNoLatitude of the requested crime area
lngNoLongitude of the requested crime area
location_idNoThe ID of the location
dateNoLimit results to a specific month (YYYY-MM)

Implementation Reference

  • The handler function getCrimesAtLocation that executes the tool logic. It accepts lat/lng or location_id and date params, builds the API request, and calls the police.uk 'crimes-at-location' endpoint.
    async function getCrimesAtLocation(args: any) {
      const { lat, lng, location_id, date } = args;
      const params: Record<string, any> = {};
      
      if (date) params.date = date;
      if (location_id) {
        params.location_id = location_id;
      } else if (lat && lng) {
        params.lat = lat;
        params.lng = lng;
      } else {
        return [];
      }
      
      return await makeApiRequest('crimes-at-location', params) || [];
    }
  • Input schema definition for the get_crimes_at_location tool, defining properties: lat (number), lng (number), location_id (number), date (string).
    {
      name: 'get_crimes_at_location',
      description: 'Retrieve crimes at a specific location by ID or nearest to lat/lng',
      inputSchema: {
        type: 'object',
        properties: {
          lat: { type: 'number', description: 'Latitude of the requested crime area' },
          lng: { type: 'number', description: 'Longitude of the requested crime area' },
          location_id: { type: 'number', description: 'The ID of the location' },
          date: { type: 'string', description: 'Limit results to a specific month (YYYY-MM)' }
        }
      }
    },
  • src/index.ts:447-469 (registration)
    Registration of the tool function mapping, where get_crimes_at_location is mapped to the getCrimesAtLocation handler function.
    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
    };
  • The makeApiRequest helper function used by getCrimesAtLocation to make HTTP requests to 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;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden. It says 'retrieve', implying a read operation, but does not explicitly state it is safe or non-destructive. No mention of rate limits, error conditions, or return format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence of 10 words, front-loaded with the action and resource. Every word contributes meaning with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and 4 optional parameters, the description lacks details on return format, pagination, error handling, and parameter combination rules (e.g., mutual exclusivity of location_id vs lat/lng). Leaves significant ambiguity for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, giving baseline 3. The description adds value by explaining that the location can be specified by ID or by lat/lng coordinates, clarifying the optional relationship between parameters. This goes beyond the schema's individual parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool retrieves crimes at a specific location, specifying two methods: by ID or by lat/lng coordinates. This distinguishes it from sibling tools like get_crimes_no_location (no location) and get_street_level_crimes (different type of crime data).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings, nor when to use location_id versus lat/lng. Does not explain prerequisites or trade-offs between the two location specification methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dwain-barnes/police-uk-api-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server