Skip to main content
Glama
dwain-barnes

MCP Server Police UK

by dwain-barnes

get_stop_searches_by_area

Retrieve stop and search incidents within a 1-mile radius or custom polygon area by specifying coordinates. Filter results by month to analyze patterns in UK police stop-and-search data.

Instructions

Retrieve stop and searches within a 1-mile radius or custom area

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latNoLatitude of the centre point
lngNoLongitude of the centre point
polyNoLat/lng pairs defining a polygon
dateNoSpecific month (YYYY-MM)

Implementation Reference

  • The handler function for getStopSearchesByArea. Accepts lat, lng, poly, and date arguments. Builds query params and calls the police.uk API endpoint 'stops-street'.
    async function getStopSearchesByArea(args: any) {
      const { lat, lng, poly, date } = args;
      const params: Record<string, any> = {};
      
      if (date) params.date = date;
      if (lat !== undefined && lng !== undefined) {
        params.lat = lat;
        params.lng = lng;
      } else if (poly) {
        params.poly = poly;
      } else {
        return [];
      }
      
      return await makeApiRequest('stops-street', params) || [];
    }
  • Input schema for get_stop_searches_by_area tool. Defines optional properties: lat (number), lng (number), poly (string), and date (string).
    {
      name: 'get_stop_searches_by_area',
      description: 'Retrieve stop and searches within a 1-mile radius or custom area',
      inputSchema: {
        type: 'object',
        properties: {
          lat: { type: 'number', description: 'Latitude of the centre point' },
          lng: { type: 'number', description: 'Longitude of the centre point' },
          poly: { type: 'string', description: 'Lat/lng pairs defining a polygon' },
          date: { type: 'string', description: 'Specific month (YYYY-MM)' }
        }
      }
    },
  • src/index.ts:446-469 (registration)
    Tool function mapping that registers get_stop_searches_by_area to the getStopSearchesByArea handler function.
    // Tool function mapping
    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:487-517 (registration)
    The CallToolRequestSchema handler that dispatches tool calls by name to the corresponding tool function.
    // Handle tool calls
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      
      try {
        const toolFunction = toolFunctions[name as keyof typeof toolFunctions];
        if (!toolFunction) {
          throw new Error(`Unknown tool: ${name}`);
        }
        
        const result = await toolFunction(args);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    });
  • The makeApiRequest helper function used by getStopSearchesByArea 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;
      }
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It mentions radius and polygon options, but lacks details on behavior when conflicting parameters are provided, rate limits, or data completeness.

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

Conciseness4/5

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

Single concise sentence that conveys the core functionality. No wasted words, but could benefit from slight expansion on usage context.

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

Completeness3/5

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

Lacks description of return format or any behavioral details beyond the basic scope. For a tool with no output schema, more context on what is returned would improve completeness.

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 coverage is 100% with basic parameter descriptions. The tool description adds value by explaining the '1-mile radius' concept, which is not in the schema, and frames the parameters as supporting either point+radius or polygon area.

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

Purpose4/5

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

The description clearly states the tool retrieves stop and searches, specifying geographic scope (1-mile radius or custom area). This distinguishes it from siblings like get_stop_searches_by_location or get_stop_searches_by_force.

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 explicit guidance on when to use this tool vs alternatives. The description implies area-based queries, but does not differentiate from point-based or force-based queries.

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