Skip to main content
Glama

gva_query

Query geographic data from the Valencian Community's GIS layer using SQL-like filters, field selection, and pagination controls to retrieve land activity information.

Instructions

Query features from the GVA GIS layer with SQL-like WHERE clause and optional parameters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
whereNoSQL WHERE clause (e.g., '1=1' for all, 'MUNICIPIO="Valencia"')1=1
out_fieldsNoComma-separated field names or '*' for all fields*
return_geometryNoWhether to return geometry data
result_record_countNoMaximum number of records to return
result_offsetNoOffset for pagination

Implementation Reference

  • The handler function for the 'gva_query' tool. It constructs the query parameters from the input arguments and makes an HTTP request to the ArcGIS FeatureServer /query endpoint, returning the JSON response as text content.
    elif name == "gva_query":
        # Query features
        url = f"{BASE_URL}/{LAYER_ID}/query"
        params = {
            'where': arguments.get('where', '1=1'),
            'outFields': arguments.get('out_fields', '*'),
            'returnGeometry': str(arguments.get('return_geometry', True)).lower(),
            'resultRecordCount': arguments.get('result_record_count', 10),
            'resultOffset': arguments.get('result_offset', 0),
            'f': 'json'
        }
    
        data = make_request(url, params)
    
        return [TextContent(
            type="text",
            text=json.dumps(data, indent=2, ensure_ascii=False)
        )]
  • Registration of the 'gva_query' tool in the list_tools function, including its description and detailed input schema.
    Tool(
        name="gva_query",
        description="Query features from the GVA GIS layer with SQL-like WHERE clause and optional parameters",
        inputSchema={
            "type": "object",
            "properties": {
                "where": {
                    "type": "string",
                    "description": "SQL WHERE clause (e.g., '1=1' for all, 'MUNICIPIO=\"Valencia\"')",
                    "default": "1=1"
                },
                "out_fields": {
                    "type": "string",
                    "description": "Comma-separated field names or '*' for all fields",
                    "default": "*"
                },
                "return_geometry": {
                    "type": "boolean",
                    "description": "Whether to return geometry data",
                    "default": True
                },
                "result_record_count": {
                    "type": "integer",
                    "description": "Maximum number of records to return",
                    "default": 10
                },
                "result_offset": {
                    "type": "integer",
                    "description": "Offset for pagination",
                    "default": 0
                }
            },
            "required": []
        }
    ),
  • The TypeScript handler for the 'gva_query' tool. Constructs query parameters and performs an HTTP request to the ArcGIS FeatureServer /query endpoint, returning the JSON response.
    case "gva_query": {
      // Query features
      const queryArgs = args as QueryArguments;
      const url = `${BASE_URL}/${LAYER_ID}/query`;
      const params: RequestParams = {
        where: queryArgs.where || "1=1",
        outFields: queryArgs.out_fields || "*",
        returnGeometry: String(queryArgs.return_geometry ?? true).toLowerCase(),
        resultRecordCount: queryArgs.result_record_count || 10,
        resultOffset: queryArgs.result_offset || 0,
        f: "json",
      };
    
      const data = await makeRequest(url, params);
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Registration of the 'gva_query' tool in the TypeScript list tools handler, including description and input schema.
    {
      name: "gva_query",
      description: "Query features from the GVA GIS layer with SQL-like WHERE clause and optional parameters",
      inputSchema: {
        type: "object",
        properties: {
          where: {
            type: "string",
            description: 'SQL WHERE clause (e.g., "1=1" for all, "MUNICIPIO=\'Valencia\'")',
            default: "1=1",
          },
          out_fields: {
            type: "string",
            description: "Comma-separated field names or '*' for all fields",
            default: "*",
          },
          return_geometry: {
            type: "boolean",
            description: "Whether to return geometry data",
            default: true,
          },
          result_record_count: {
            type: "number",
            description: "Maximum number of records to return",
            default: 10,
          },
          result_offset: {
            type: "number",
            description: "Offset for pagination",
            default: 0,
          },
        },
        required: [],
      },
    },
  • Shared helper function used by gva_query (and other tools) to perform HTTP requests to the ArcGIS API with browser-like headers to avoid blocking.
    def make_request(url: str, params: dict) -> dict:
        """Make HTTP request to the API with browser-like headers"""
        headers = {
            'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
            'Accept': 'application/json, text/plain, */*',
            'Accept-Language': 'es-ES,es;q=0.9,en;q=0.8'
        }
    
        try:
            response = requests.get(url, params=params, headers=headers, timeout=30)
            response.raise_for_status()
            return response.json()
        except requests.RequestException as e:
            logger.error(f"Request failed: {e}")
            raise
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'SQL-like WHERE clause and optional parameters' but fails to describe critical behaviors such as authentication requirements, rate limits, error handling, or the format of returned data (especially given no output schema). This leaves significant gaps for an agent to understand how to interact with the tool effectively.

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?

The description is a single, efficient sentence that front-loads the core purpose ('Query features from the GVA GIS layer') and adds essential detail ('with SQL-like WHERE clause and optional parameters'). Every word earns its place with zero waste.

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 the complexity of a query tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It lacks details on authentication, rate limits, error cases, and the structure of returned data (e.g., geometry format, pagination behavior). This leaves the agent poorly equipped to handle real-world usage scenarios.

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

Parameters3/5

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

Schema description coverage is 100%, so the input schema fully documents all 5 parameters with descriptions and defaults. The description adds minimal value beyond this, mentioning 'SQL-like WHERE clause and optional parameters' but not elaborating on parameter interactions or usage nuances. Baseline 3 is appropriate as the schema does the heavy lifting.

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 action ('Query features') and resource ('from the GVA GIS layer'), specifying it uses a SQL-like WHERE clause with optional parameters. It distinguishes from siblings like gva_count (counting) and gva_export_geojson (exporting), but doesn't explicitly differentiate from gva_layer_info (which likely provides metadata).

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 versus alternatives like gva_count or gva_export_geojson is provided. The description implies usage for querying features with filtering, but lacks context on prerequisites, performance considerations, or specific scenarios where other tools might be more appropriate.

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/pepo1275/mcp4gva'

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