Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

Geo search

geo_search
Read-only

Finds rows nearest a longitude/latitude point using PostGIS distance, returning the closest matches; reports unavailable when PostGIS is not installed.

Instructions

Find the rows nearest to a lon/lat point by PostGIS distance. Reports available=false if the postgis extension is not installed.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "schema": "<schema>",
      "table": "<table>",
      "column": "<column>",
      "longitude": "<longitude>",
      "latitude": "<latitude>"
    },
    "name": "geo_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
tableYes
columnYes
schemaYes
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.
latitudeYes
longitudeYes

Output Schema

NameRequiredDescriptionDefault
matchesYes
availableYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. First observedv0.6.8

TDQS

B3.3/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description contributes one genuinely useful behavioural fact beyond that — it returns available=false rather than erroring when the postgis extension is absent — but says nothing about result ordering, distance units (meters vs degrees), whether it uses geometry or geography semantics, or how the limit interacts with ties.

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?

Two tight sentences with the core operation front-loaded and the failure mode appended. Nothing is repeated from the schema or annotations, and there is no filler.

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?

An output schema exists, so return values need not be described, and the extension-availability caveat is a helpful addition. But for a 7-parameter spatial query the definition leaves the agent guessing about column type requirements, distance units, and result ordering — gaps that matter for calling it correctly.

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

Parameters2/5

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

Schema description coverage is only 14%: just the optional 'database' parameter is documented in the schema. The description clarifies that latitude/longitude form a single query point and that 'column' is a geo column, but the five required parameters (schema, table, column, longitude, latitude) plus limit have no documented semantics — no accepted column types, no units, no ordering or default-limit behaviour — so the description does not compensate for the coverage gap.

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 gives a specific verb and resource — 'Find the rows nearest to a lon/lat point by PostGIS distance' — which is far more precise than the title 'Geo search'. The phrase 'by PostGIS distance' distinguishes it from embedding-space neighbours like vector_search or fuzzy_search, though it never names those siblings explicitly.

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

Usage Guidelines3/5

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

Usage is only implied: the agent must infer that this applies to tables with a geometry/geography column and a lon/lat query point. There is no statement of when to prefer this over vector_search, mmr_search, or a plain run_select with a bounding-box WHERE clause, and no mention of prerequisites such as having the PostGIS extension installed before calling.

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

Deploy Server

Other Tools