Contents

Documentation Town hall count

town-hall-count

Free Read-only mairies

Count French communes, and optionally elected officials by portfolio, that match some criteria. Free.

When to use it. Call it first to size a request (e.g. how many deputy mayors in charge of culture in department 38), then town-hall-search or officials-search for the rows. Portfolios are known for about one deputy mayor in six: a count of officials is a lower bound.

Ask your assistant

Once the server is connected, a request in plain words is enough. For example:

Example request
Use Mairies de France to count French communes, and optionally elected officials by portfolio, that match some criteria. Free.

Examples

Most clients only need the server address and a sign-in: see Connect. Clients configured by a file take the first block. Your assistant then writes the second one by itself.

Client configuration
{
  "mcpServers": {
    "mairies-de-france": {
      "url": "https://mairies.vosfichiers.com/mcp"
    }
  }
}
What the assistant sends
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "town-hall-count",
    "arguments": {
      "kind": "any"
    }
  }
}

Put an API key in the API_KEY environment variable first. Create a key

bash
curl -X POST https://mairies.vosfichiers.com/api/v1/town-hall-count \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "kind": "any"
}'

Put an API key in the API_KEY environment variable first. Create a key

python
import json
import os
import urllib.request

payload = {
    "kind": "any",
}
request = urllib.request.Request(
    "https://mairies.vosfichiers.com/api/v1/town-hall-count",
    data=json.dumps(payload).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["API_KEY"],
        "Content-Type": "application/json",
    },
    method="POST",
)
with urllib.request.urlopen(request) as response:
    print(json.load(response))

Put an API key in the API_KEY environment variable first. Create a key

javascript
const response = await fetch("https://mairies.vosfichiers.com/api/v1/town-hall-count", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "kind": "any"
  }),
});
console.log(await response.json());

Input

Fields this tool accepts
Field Type Required Default Description
department string optional none Department code, e.g. 38, 2A or 974. pattern ^(\d{2}|2A|2B|97\d)$
name string optional none Part of the commune name. 2 to 80 characters
population_min integer optional none Minimum population. ≥ 0
population_max integer optional none Maximum population. ≥ 0
profile string optional none Keep only communes with this profile: rurale, montagne, touristique, qpv, petites-villes-de-demain, villages-d-avenir. pattern ^(rurale|montagne|touristique|qpv|petites-villes-de-demain|villages-d-avenir)$
has_website boolean optional none True: only communes with a website.
portfolio string optional none Words of a portfolio (delegation), e.g. culture, urbanisme, écoles. 3 to 80 characters
kind enum optional "any" Kind of elected official to count. one of "any", "adjoint", "conseiller_delegue", "maire_delegue", "maire"

Output

A JSON object whose fields depend on the request; this tool declares no fixed shape.

Try it

Run this tool from your account, with a form built from the fields above. A run is a real call; this tool is free.

Open in the playground