Model Context Protocol

Politipuls MCP

Leseorientert tilgang til norske politihendelser og aggregater fra Politiloggen. Endepunktet krever ingen autentisering og støtter ti verktøy over Streamable HTTP.

Trenger du rådata direkte fra kilden? Se guiden til Politiloggen API.

Endepunkt
https://politipuls.no/api/mcp
Protokoll
2025-11-25
Tidssone
Europe/Oslo

Omfang og sannhetsgrenser

Bruk og personvern

Ingen innlogging eller Politipuls-konto er nødvendig. Send bare de eksplisitte parametrene verktøyet trenger, som kommune, kategori, tidsrom eller hendelses-ID. Hele samtalen er ikke nødvendig; ikke send samtalehistorikk eller sensitive personopplysninger.

Politipuls behandler tekniske sesjonsdata, pseudonymiserte rate-limit-tellere og aggregert bruksstatistikk. Se personvernerklæringenfor opplysninger om lagring og sletting. Dokumentert API- og MCP-bruk er tillatt innenfor bruksgrensene og vilkårene. AI-klientens behandling av samtalen følger klientleverandørens egne vilkår.

Koble til

Send JSON-RPC 2.0 til https://politipuls.no/api/mcp. Serveren svarer påinitialize med headeren MCP-Session-Id. Bruk samme header i resten av sesjonen. Send også den forhandlede protokollversjonen i MCP-Protocol-Version på etterfølgende kall. Eldre klienter uten denne headeren bruker versjonen som allerede er lagret i sesjonen; en annen verdi avvises.

Vanlige MCP-klienter kobler til fra en server eller lokal prosess og påvirkes ikke av nettleser-CORS. Nettleserkall støttes bare fra Politipuls sine egne origins og lokale Capacitor-origins. Avslutt en sesjon med DELETE, MCP-Session-Id ogContent-Type: application/json. Innholdstypen kreves også når DELETE-kallet ikke har en body, fordi Astro sin globale CSRF-port ellers avviser forespørselen før MCP-ruten.

  1. 1. Initialiser

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "initialize",
      "params": {
        "protocolVersion": "2025-11-25",
        "capabilities": {},
        "clientInfo": {
          "name": "eksempel-klient",
          "version": "1.0.0"
        }
      }
    }
  2. 2. Bekreft initialisering

    Send denne notifikasjonen med MCP-Session-Id fra første svar:

    {
      "jsonrpc": "2.0",
      "method": "notifications/initialized"
    }
  3. 3. List verktøy

    {
      "jsonrpc": "2.0",
      "id": 2,
      "method": "tools/list",
      "params": {}
    }

Tilgjengelige verktøy

Denne listen rendres fra det samme manifestet som brukes av tools/list og discovery-endepunktene.

list_incidents

List recent Politipuls incidents, including authoritative GeoJSON and separate display-anchor semantics when available, with optional district, category, municipality, and active-only filters. Municipality is the requested incident area; never request the user’s precise location. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "limit": {
      "type": "number",
      "minimum": 1,
      "maximum": 100
    },
    "district": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "municipality": {
      "type": "string"
    },
    "activeOnly": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}

get_incident

Fetch one Politipuls incident by id, including authoritative GeoJSON and separate display-anchor semantics when available. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    }
  },
  "required": [
    "id"
  ],
  "additionalProperties": false
}

get_incident_messages

Fetch the timeline messages for one Politipuls incident. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    }
  },
  "required": [
    "id"
  ],
  "additionalProperties": false
}

get_filter_options

Fetch available districts, municipalities, and categories for Politipuls filtering. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}

aggregate_by_category

Count incidents grouped by category. Use this for category bar/pie charts. Returns rows ordered by count desc. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "timeRange": {
      "type": "string",
      "enum": [
        "24h",
        "7d",
        "30d",
        "90d",
        "180d",
        "365d",
        "all"
      ]
    },
    "district": {
      "type": "string"
    },
    "municipality": {
      "type": "string"
    },
    "limit": {
      "type": "number",
      "minimum": 1,
      "maximum": 100
    }
  },
  "additionalProperties": false
}

aggregate_by_district

Count incidents grouped by district. Use this for district leaderboards or maps. Returns rows ordered by count desc. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "timeRange": {
      "type": "string",
      "enum": [
        "24h",
        "7d",
        "30d",
        "90d",
        "180d",
        "365d",
        "all"
      ]
    },
    "category": {
      "type": "string"
    },
    "limit": {
      "type": "number",
      "minimum": 1,
      "maximum": 100
    }
  },
  "additionalProperties": false
}

top_municipalities

Top N municipalities by incident count. Optional district filter. Use for ranking visualizations. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "timeRange": {
      "type": "string",
      "enum": [
        "24h",
        "7d",
        "30d",
        "90d",
        "180d",
        "365d",
        "all"
      ]
    },
    "district": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "limit": {
      "type": "number",
      "minimum": 1,
      "maximum": 100
    }
  },
  "additionalProperties": false
}

time_series

Time-bucketed incident counts (daily, weekly, or monthly) from nightly pre-aggregated stats. Use for trend lines and time-series charts. For totals and averages, use the server-computed summary rather than summing buckets yourself. Label averagePerReturnedBucket as an average per returned day/week/month according to granularity, not per requested day; missing buckets are not zero-filled. Optional district/category filter. Time-series buckets are materialized nightly. Each query selects one canonical aggregation level so incidents are not double-counted. Later source edits, removals, and the currently open bucket can cause a small difference from live incident aggregates over nominally similar periods. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "granularity": {
      "type": "string",
      "enum": [
        "daily",
        "weekly",
        "monthly"
      ]
    },
    "days": {
      "type": "number",
      "enum": [
        7,
        14,
        30,
        60,
        90,
        180,
        365
      ]
    },
    "district": {
      "type": "string"
    },
    "category": {
      "type": "string"
    }
  },
  "additionalProperties": false
}

incidents_in_bbox

List incidents with documented physical points within a geographic bounding box, including authoritative GeoJSON when available. Incidents represented only by a technical anchor or non-point geometry abstain rather than being treated as point hits. north/south are latitudes, east/west are longitudes. Bounds describe the requested incident area; never request the user’s GPS location or address. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "north": {
      "type": "number",
      "minimum": -90,
      "maximum": 90
    },
    "south": {
      "type": "number",
      "minimum": -90,
      "maximum": 90
    },
    "east": {
      "type": "number",
      "minimum": -180,
      "maximum": 180
    },
    "west": {
      "type": "number",
      "minimum": -180,
      "maximum": 180
    },
    "timeRange": {
      "type": "string",
      "enum": [
        "24h",
        "7d",
        "30d",
        "90d",
        "180d",
        "365d",
        "all"
      ]
    },
    "category": {
      "type": "string"
    },
    "limit": {
      "type": "number",
      "minimum": 1,
      "maximum": 500
    }
  },
  "required": [
    "north",
    "south",
    "east",
    "west"
  ],
  "additionalProperties": false
}

category_trends

Month-over-month trend per (district, category) — current vs previous month with percent change. Use for trend dashboards. Preserve the clickable source attribution supplied with the result when presenting its data.

Input-schema
{
  "type": "object",
  "properties": {
    "district": {
      "type": "string"
    },
    "limit": {
      "type": "number",
      "minimum": 1,
      "maximum": 100
    }
  },
  "additionalProperties": false
}

Sesjon og rate limits

Sesjonslevetid
3600 sekunder, glidende ved gyldige kall.
Initialize
60 kall per 60 sekunder per IP-adresse.
Verktøykall
600 kall per 60 sekunder per MCP-sesjon.
Rate-limit-feil
JSON-RPC-kode -32099.

Databegrensninger

Results reflect the latest successfully ingested Politiloggen snapshot; delays and later source edits can occur.