Skip to main content
Glama

gva_count

Count geographic features in Valencian Community land activity data using SQL WHERE clauses to filter results.

Instructions

Count features matching a WHERE clause

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
whereNoSQL WHERE clause (e.g., '1=1' for all)1=1

Implementation Reference

  • Handler for the gva_count tool: queries the ArcGIS FeatureServer with returnCountOnly=true to get the count of matching features and returns it as text content.
    case "gva_count": {
      // Count features
      const countArgs = args as CountArguments;
      const url = `${BASE_URL}/${LAYER_ID}/query`;
      const params: RequestParams = {
        where: countArgs.where || "1=1",
        returnCountOnly: "true",
        f: "json",
      };
    
      const data = await makeRequest(url, params);
      const count = data.count || 0;
    
      return {
        content: [
          {
            type: "text",
            text: `Total features matching query: ${count}`,
          },
        ],
      };
    }
  • Registration of the gva_count tool in the list_tools handler, including its schema definition.
    {
      name: "gva_count",
      description: "Count features matching a WHERE clause",
      inputSchema: {
        type: "object",
        properties: {
          where: {
            type: "string",
            description: 'SQL WHERE clause (e.g., "1=1" for all)',
            default: "1=1",
          },
        },
        required: [],
      },
    },
  • TypeScript interface defining the input arguments for the gva_count tool.
    interface CountArguments {
      where?: string;
    }
  • Python handler for the gva_count tool: similar logic to query count from ArcGIS FeatureServer.
    elif name == "gva_count":
        # Count features
        url = f"{BASE_URL}/{LAYER_ID}/query"
        params = {
            'where': arguments.get('where', '1=1'),
            'returnCountOnly': 'true',
            'f': 'json'
        }
    
        data = make_request(url, params)
        count = data.get('count', 0)
    
        return [TextContent(
            type="text",
            text=f"Total features matching query: {count}"
        )]
  • Registration of the gva_count tool in Python implementation, including input schema.
    Tool(
        name="gva_count",
        description="Count features matching a WHERE clause",
        inputSchema={
            "type": "object",
            "properties": {
                "where": {
                    "type": "string",
                    "description": "SQL WHERE clause (e.g., '1=1' for all)",
                    "default": "1=1"
                }
            },
            "required": []
        }
    ),
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic function. It doesn't disclose behavioral traits like whether this is a read-only operation, performance implications, error handling for invalid SQL, or if it requires specific permissions. The description is minimal and lacks necessary context for safe use.

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 directly states the tool's function without any wasted words. It is appropriately sized and front-loaded, making it easy to grasp quickly.

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 annotations and no output schema, the description is incomplete for a tool that performs data operations. It doesn't explain what 'features' are, the data source, return format (e.g., integer count), or error cases, leaving significant gaps in understanding for effective use.

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?

The input schema has 100% description coverage, fully documenting the 'where' parameter with examples. The description adds no additional meaning beyond the schema, such as explaining valid SQL syntax or constraints, so it meets the baseline of 3 where 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 ('Count') and target ('features matching a WHERE clause'), making the purpose understandable. However, it doesn't specify what type of features or from what source (e.g., database table, GIS layer), nor does it differentiate from sibling tools like gva_query which might also involve filtering.

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?

The description provides no guidance on when to use this tool versus alternatives such as gva_query or gva_layer_info. It mentions a WHERE clause but doesn't explain scenarios where counting is preferred over querying or exporting, leaving usage context implied at best.

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