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
| Name | Required | Description | Default |
|---|---|---|---|
| where | No | SQL WHERE clause (e.g., '1=1' for all) | 1=1 |
Implementation Reference
- typescript/src/index.ts:239-260 (handler)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}`, }, ], }; }
- typescript/src/index.ts:138-152 (registration)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/src/index.ts:37-39 (schema)TypeScript interface defining the input arguments for the gva_count tool.interface CountArguments { where?: string; }
- mcp4gva/server.py:181-197 (handler)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}" )]
- mcp4gva/server.py:93-107 (registration)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": [] } ),