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": []
        }
    ),

Tool Definition Quality

Score is being calculated. Check back soon.

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