GRANSKA

Model Context Protocol

POSThttps://api.granska.cloud/v1/mcp

Speaks the Model Context Protocol, so an AI assistant can use this API without anybody writing code against it.

Bearer tokenSpends 1 run per call that starts an analysisAnswers with the rate-limit headers whenever the meter can be read

What this is for

Every other page here describes a call you make from code you wrote. This one describes the same gateway spoken to by an AI assistant — Claude, ChatGPT or anything else that implements the Model Context Protocol. You give the assistant this URL, and it discovers what is here for itself. What it presents is either a connection an administrator approved in the browser, which is how Codex and Claude Code connect, or a bearer token you obtained yourself with an API key.

It is the same gateway and the same tenant as every other route. Nothing about your account changes because a call arrived over MCP.

Discovery. server/discover reports which protocol revision this server speaks and what it is capable of, and tools/list answers with 24 tools. The review workflow comes first: get_legal_agreement, upload_url, analyze, get_job, delete_job, get_profiles, action, search_laws, get_law, get_snippets, get_quotas, ai_status, which says whether the AI service itself is degraded, and read_guide, which opens GRANSKA's guide for AI agents. Beside it are the reads of your organisation's configuration, get_profile, get_snippet_by_id, get_actions, get_action and get_config, the whole resolved setup in one answer, and last come the writes: create_profile, update_profile, create_snippet, update_snippet, create_action and update_action, so an assistant can build and publish a profile, its rules and its actions as well as run one. Nothing here deletes a profile, a rule or an action: a deletion cannot be undone, so a person makes it, in the web application or through the routes of this reference. Each tool is generated from the same table that describes the routes on the rest of this reference, so a tool cannot say anything the route it stands for does not do.

The connector tells the assistant how GRANSKA works. server/discover, and initialize on an earlier revision, carry instructions: the opening note of GRANSKA's guide for AI agents, which says what a review is, the words the tools use, a review step by step and how to present a result. It ends with what the connector cannot do: deleting, example documents, PDFs and an action on a review whose result is gone are not offered here, and the note says where each can be done instead, so the assistant tells the person rather than trying another way. read_guide opens the guide's topics — reading a result, building profiles and rules, actions, masking, and waiting for a review — when the assistant needs one; GET /v1/guide is the same guide over HTTP.

Calling. tools/call runs the route the named tool stands for, under your own token and for your own organisation. params.name is the tool and params.arguments its arguments. Before the route runs, the endpoint checks which arguments were sent, by name, and not what they hold: an argument the tool's inputSchema does not offer is refused with -32602 rather than passed on — which is how a tool that deliberately withholds one keeps it withheld — and so is a call that leaves out a required one. What an argument holds is the route's to judge, and its refusal comes back as a tool result with isError set — the two envelopes below shows one of each. The result comes back as a text block carrying the route's own JSON.

A JSON object comes back in machine-readable form as well. When the route answers an object, the result also carries it as structuredContent, so a client that reads structured results needs no parsing. The text block beside it is the same string it would be without it, so an assistant that reads only content sees no difference. An accepted analyze call comes back like this:

{
  "jsonrpc": "2.0",
  "id": 5,
  "result": {
    "resultType": "complete",
    "content": [
      {
        "type": "text",
        "text": "{\n  \"success\": true,\n  \"jobId\": \"job_7d41c9\",\n  \"status\": \"QUEUED\"\n}"
      }
    ],
    "structuredContent": {
      "success": true,
      "jobId": "job_7d41c9",
      "status": "QUEUED"
    },
    "isError": false
  }
}

structuredContent is what the text block says and nothing more: the same answer from the same route. A route that answers anything other than an object, such as a list, is text only, and so is every result with isError set, which carries the route's refusal as a sentence. No tool publishes an outputSchema: the object is whatever the route answers, and its shape is described on that route's own page of this reference. An assistant on an earlier revision gets the same structuredContent beside the same text. Like the cut-short example further down, this one leaves out the _meta server-info block every answer carries.

What a call costs is what the route costs. analyze and action each draw a run from the same quota, the same counter and the same period as calling POST /v1/analyze or POST /v1/action directly — one run per started group of three reviewers, so a profile with five reviewers costs two, and a granskningspaket costs one per member. get_law draws from a second counter, the hourly configuration-write floor, and only on the calls that have to fetch: a law this API already holds is free, one it has to go and get ticks the floor once. The six configuration writes tick the same floor once per call, exactly as POST and PATCH on /v1/profiles, /v1/snippets and /v1/actions do over HTTP. The other tools draw nothing, and neither does tools/list. A call that the route then refuses gives the run straight back, exactly as it does over HTTP.

get_quotas is how an assistant reads those counters before it spends one. The X-RateLimit-* headers below are read by the MCP client library, not by the model driving it — so without this tool an assistant can only discover that a review is unaffordable by starting one and being refused, which on analyze happens after it has already decided to spend. The tool takes no arguments, draws nothing itself, and reports both counters: the run quota and the hourly configuration-write floor. It is also where an assistant reads limits.maxWorkersPerProfile, how many workers dynamicContext.workerContext may name on analyze: that ceiling is the organisation's own, so the analyze schema states no number for it and points here instead.

A configuration write the floor refuses is the gateway's 429, with the floor's numbers. The endpoint checks the floor before the route runs, so nothing is written, and it answers 429 TOO_MANY_REQUESTS with the floor's own sentence, as the same write is refused over HTTP. That one answer's X-RateLimit-* headers describe the floor, so a client backing off waits for the hour to turn rather than for the run period.

A get_law the floor refuses arrives as a tool execution error, not as a 429. Every other answer's three X-RateLimit-* headers describe the run quota, never the floor, and a route's own headers are not forwarded — so this refusal, which the route answers from inside, answered as a 429 would arrive under numbers that never moved and invite an assistant to back off from the wrong counter. It comes back inside a 200 instead, carrying the floor's own sentence, beside run-quota headers that may well look untouched. Read the floor from GET /v1/quotas, which reports both counters — over MCP that is the get_quotas tool.

Two answers are the gateway's rather than the protocol's, and both are HTTP rather than JSON-RPC: a missing or unreadable credential is 401, and a spent run quota is 429 TOO_MANY_REQUESTS — whether the quota was already spent when the call arrived or ran out while the route was resolving how many runs it needed — and so is a configuration write that finds the hourly floor spent. Every answer the endpoint's own handler produces carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset, that 429 and every tool execution error included, so an assistant can see where the period stands without having to spend a run to find out. Two answers do not carry them, and neither is a fault in your client. A 401 is refused above the handler, so there is no organisation to report a quota for. And the numbers are read after the call has run — a tools/call that starts an analysis has to be counted before they are true — so on the rare occasion that read itself fails, the answer is sent without the three headers rather than thrown away: it may already name an analysis that is queued and charged, and that name is the only way to fetch it. What you lose there is one reading of where the period stands, not the review.

Request
curl https://api.granska.cloud/v1/mcp \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: server/discover" \
  -d '{
    "jsonrpc": "2.0",
    "id": "discover-1",
    "method": "server/discover",
    "params": {
      "_meta": {
        "io.modelcontextprotocol/protocolVersion": "2026-07-28",
        "io.modelcontextprotocol/clientInfo": { "name": "ExampleClient", "version": "1.0.0" },
        "io.modelcontextprotocol/clientCapabilities": {}
      }
    }
  }'
Response
{
  "jsonrpc": "2.0",
  "id": "discover-1",
  "result": {
    "resultType": "complete",
    "supportedVersions": [
      "2026-07-28"
    ],
    "capabilities": {
      "tools": {}
    },
    "_meta": {
      "io.modelcontextprotocol/serverInfo": {
        "name": "Utredningsgranskaren",
        "version": "2026-07-28"
      }
    },
    "ttlMs": 3600000,
    "cacheScope": "public"
  }
}

Connecting Codex or Claude Code

An administrator connects an installed assistant without an API key. The assistant is given this endpoint's URL, opens a browser on GRANSKA's approval page, and is handed access of its own once the administrator approves. Nothing secret is pasted into the assistant: no client secret, no token and no password. Codex and Claude Code are the two assistants this is set up and tested for. Another client that implements the same MCP authorization standard may work, and is not promised to.

1. Add the server. One command, in a terminal on the computer where the assistant is installed. For Codex:

codex mcp add granska --url "https://api.granska.cloud/v1/mcp"

For Claude Code:

claude mcp add --transport http granska "https://api.granska.cloud/v1/mcp"

Claude Code adds the server for the project directory the command is run in. Add --scope user to have it in every project.

2. Approve in the browser. Codex opens the browser as soon as it has added the server; if no browser opened, codex mcp login granska starts the approval again. Claude Code opens it on claude mcp login granska, or when you choose the server under /mcp inside a session. Sign in to GRANSKA as you usually do, with email and password or with Google. The approval page names the assistant, the one organisation the connection reaches and what it allows, and you approve or deny. Only an administrator of that organisation can approve it. Anyone else is told so, and nothing is connected.

3. Know what you approved.

  • Full read and write access to the organisation's API. There is one level and no narrower one. The connection acts as the administrator who approved it, in that one organisation: it reaches every route of this reference the organisation is licensed for, changes included, and it spends the organisation's quota.
  • The tools are narrower than the access, on purpose. tools/list offers the 24 tools named above: the review workflow, with clinicalData withheld and the document taken only as an upload, so that no document travels through a model's context and a finished report is never pasted back into one, and the reads and writes of profiles, rules and actions, with no delete among them. A finished report does reach the assistant when it reads the job, as the bullet on the assistant's provider below says. The other routes are not offered as tools. They are part of what was approved all the same: a program holding the connection's access token can call them as ordinary HTTP, as this reference describes them.
  • A connection reads only the jobs it started. A job belongs to the connection that created it. The connection cannot read or delete a job started in the web application, by another connection or with an API key, and none of those can read the connection's.
  • It ends after 90 days. To continue, connect the assistant again.
  • The assistant's provider can receive what the API returns. The assistant is an external service: whatever a tool call or a route answers, a finished analysis with its findings and quotes included, can reach the provider, which keeps and uses it under its own terms and not ours.
  • Disconnect it in the web application, under Administer Organisation in the administration area, in the list of agent connections. Any administrator of the organisation can disconnect a connection, whoever approved it, and it is refused from its next request. Removing the server from the assistant, or codex mcp logout granska and claude mcp logout granska, makes the assistant forget its access but leaves the connection listed until it is disconnected or expires.

This URL is the organisation API's. GRANSKA's own platform administrators connect to a separate platform API, at another address and with an approval of its own. A connection never reaches both, and platform status approves nothing here: this endpoint asks for an administrator of the organisation.

An API key still works, and nothing about it has changed. A program that holds a client id and secret trades them for a bearer token as Authentication describes, and sends it to this endpoint as to any other.

The revision this server speaks

2026-07-28, which is the revision this page describes.

That revision removed protocol sessions, the initialize handshake and the Mcp-Session-Id header. Every request carries its own protocol version and its own capabilities in _meta, so there is no connection state to establish and none to lose — which is what lets this live on one ordinary POST behind the same authentication as everything else.

Assistants on an earlier revision are answered too. Many assistants installed today, Codex among them, still open with the initialize handshake of 2025-11-25 or an earlier revision. A request that carries no _meta version and either opens with initialize or names 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 or 2024-10-07 in MCP-Protocol-Version is answered by that revision's handshake, statelessly: no Mcp-Session-Id is issued. It reaches the same tools, under the same token and the same quota. A refused tool call keeps its JSON-RPC code and message, and a spent run quota is still the gateway's 429. The one difference is the status line: these revisions carry a JSON-RPC error on HTTP 200.

A request whose _meta names any other revision, or whose MCP-Protocol-Version names a revision neither handshake speaks, is refused with 400 and JSON-RPC code -32022, and the error's data.supported lists the revision _meta may name:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32022,
    "message": "Unsupported protocol version",
    "data": { "supported": ["2026-07-28"], "requested": "2025-11-25" }
  }
}

A _meta claim decides which revision a request is: one that makes it is held to 2026-07-28 whatever its headers say, so a request cannot mix the two.

ParameterDescription
MCP-Protocol-Version
"2026-07-28"·header·required
The protocol revision this request uses. Must equal the version in params._meta.A request with no params._meta that opens with initialize, or names 2025-11-25 or an earlier revision here, is answered by that revision's own stateless handshake instead. Any other revision is refused with JSON-RPC code -32022, whose data.supported lists the revision params._meta may name.
Mcp-Method
string·header·required
The body's method, mirrored into a header so gateways can route without parsing the body. Must equal it.
Mcp-Name
string·header
Required only on tools/call, resources/read and prompts/get, where it mirrors params.name or params.uri. Of the three, this server implements tools/call, where it must equal params.name.

Two envelopes, and where the line runs

This is the one endpoint on the gateway that answers in two different shapes, and it is worth ten seconds of your attention because a client that reads only one of them will throw at the worst moment.

Above the handler, it is an ordinary route. A missing, unreadable or expired bearer token is refused by the same middleware that refuses every other route, in the envelope every other page here documents:

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Unauthorized",
    "documentation_url": "https://www.granska.cloud/docs/api/errors#UNAUTHORIZED"
  }
}

On this endpoint that 401 also carries a WWW-Authenticate: Bearer header naming where an assistant finds out how to be approved. The body and the status are the gateway's own, unchanged; what the header points at is at the end of this page.

Past it, it is JSON-RPC. Everything the transport itself decides — a missing header, a malformed body, an unknown method — comes back as a JSON-RPC error, whose code is a number from the protocol's own number space and not one of this API's error codes:

| Code | HTTP | When | | --- | --- | --- | | -32600 | 400 | The body is not a single JSON-RPC request or notification. No batching, and never a response. | | -32602 | 400 | params._meta is missing io.modelcontextprotocol/protocolVersion or io.modelcontextprotocol/clientCapabilities. | | -32020 | 400 | A required header is missing, or a header disagrees with the body it mirrors. | | -32022 | 400 | The request declares a protocol revision this server does not implement. | | -32601 | 404 | No such method. Anything but server/discover, tools/list and tools/call. |

tools/call adds refusals of its own, all -32602 and all decided before the route runs, so nothing is executed and no run is drawn. There are six, and the status beside each is this revision's — an earlier revision carries the same error on HTTP 200:

  • 400 — params.name is an empty string. On this revision a name that is missing or is not a string never gets this far: Mcp-Name has to mirror it, so the header check refuses the request first, with the -32020 above. An earlier revision has no such header, and there both are -32602 as well.
  • 404 — params.name names no tool tools/list reports.
  • 400 — params.arguments is present and is not an object.
  • 400 — an argument is sent that the tool's inputSchema does not list among its properties, one the tool withholds, such as clinicalData on action, included.
  • 400 — an argument the schema lists as required is not sent.
  • 400 — the schema says exactly one of several arguments must be sent (oneOf), and none or more than one is. No tool here publishes a oneOf today: action offers one of its route's two alternatives, so its schema simply requires jobId.

The last three are the whole check of the arguments, and it reads their names only. It is not a JSON Schema validation of the call. A type, an enum, a minLength, a minimum, and everything inside an argument that is an object or an array — its nested properties, items and additionalProperties — are published so that a model can form a correct call, and are not enforced at this level. A value that breaks one of them is passed to the route, which judges its own inputs exactly as it does over HTTP.

A route that runs and then refuses is not an error at this level. It comes back as an ordinary result with isError set and the route's own message inside, which is the half the specification asks clients to hand back to the model so it can correct itself and try again. That is where a wrong value lands — so do not read the absence of a -32602 as the arguments having been accepted.

Two calls to analyze show the line. The first sends an argument the tool does not offer:

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "analyze",
    "arguments": {
      "profileId": "lss_utredning",
      "jobId": "job_7d41c9",
      "priority": "high"
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

It is refused by name, with 400, and the route never runs:

{
  "jsonrpc": "2.0",
  "id": 3,
  "error": {
    "code": -32602,
    "message": "Invalid arguments for tool 'analyze': \"priority\" is not an argument of tool \"analyze\""
  }
}

The second sends only arguments the tool offers, with a value the published schema rules out two levels down — customRules is an array of sentences, and here it is one sentence:

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "analyze",
    "arguments": {
      "profileId": "lss_utredning",
      "jobId": "job_7d41c9",
      "dynamicContext": {
        "workerContext": {
          "worker_1": { "customRules": "Cite the statute behind every finding." }
        }
      }
    },
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Every name is one the tool offers, so the call reaches POST /v1/analyze, and the route refuses it with the 400 it answers over HTTP. That arrives as a 200 carrying a tool result:

{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "resultType": "complete",
    "content": [
      {
        "type": "text",
        "text": "POST /v1/analyze refused this call with HTTP 400 BAD_REQUEST: Invalid dynamicContext: …"
      }
    ],
    "isError": true
  }
}

The route's own sentence follows where the example is cut short, and it names the field. analyze costs a run, so this second call drew one before the route ran and was given it straight back; the first drew nothing. The result also carries the _meta server-info block every answer has, left out here.

An assistant on an earlier revision gets the same two answers. The first is the same JSON-RPC error, code and message, on HTTP 200 rather than 400, which is how those revisions carry a refused tool call. The second is the same tool result with isError set, without resultType.

An MCP client library handles all of these for you. You will only meet them by hand while wiring up credentials — and if you meet a 401, it is HTTP, not MCP.

ErrorWhen
401
UNAUTHORIZED
The Authorization header is missing, is not a readable bearer token, or names no tenant.
401
TOKEN_EXPIRED
The access token was issued by this gateway and has since expired. Not probed: it needs a token older than its own lifetime.
429
TOO_MANY_REQUESTS
A tools/call naming a tool that starts an analysis found the organisation's run quota spent for the current period — either when the call arrived, or while the route was working out how many runs it needed, which is where a granskningspaket meets the ceiling one member profile at a time. Or a tools/call naming a tool that writes a profile, a rule or an action found the organisation's hourly configuration-write floor spent: then nothing is written, and this answer's three rate-limit headers describe the floor rather than the run quota. Only a tool that costs a run or writes configuration can reach it: tools/list, server/discover and a tools/call on a read-only tool are never refused this way. Not probed: reaching it would mean spending a real organisation's whole period, or sixty writes.
500
INTERNAL_ERROR
An unexpected server-side failure. Not probable from outside — reaching it means something is wrong.

Sending a request by hand

Three headers beyond the token, because this transport mirrors parts of the body into headers so that gateways and proxies can route without parsing JSON:

  • MCP-Protocol-Version — must equal the version in params._meta.
  • Mcp-Method — must equal the body's method.
  • Mcp-Name — only on tools/call, resources/read and prompts/get, where it mirrors params.name or params.uri. Required on tools/call, where it must equal the tool name in params.name, and refused on server/discover and tools/list, which take no name at all. A name that cannot be a plain ASCII header value is sent Base64-wrapped as =?base64?…?=, and is compared decoded.

If a header and the body disagree, the request is refused rather than resolved in favour of one of them: that disagreement is exactly how a request gets routed as one thing and executed as another.

tools/list answers the tools, and says how long you may cache them:

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "resultType": "complete",
    "tools": [
      {
        "name": "get_legal_agreement",
        "description": "Reads the upload agreement every uploaded document is submitted under: its current version, where it is read, and whether your organisation has accepted it. Read only: an administrator accepts it for the organisation in the GRANSKA app.\n\nCall this before upload_url. When organisationRequired is true and organisationAccepted is false, an administrator of the organisation must accept the agreement in the GRANSKA app at agreementUrl first; no tool here can accept it, so tell the person and stop.\n\nCalls GET /v1/legal-agreement.",
        "inputSchema": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      {
        "name": "upload_url",
        "description": "Issues a job id and a pre-signed URL to upload a PDF to: the one way to give POST /v1/analyze its document.\n\nThe document is never sent through this conversation: it is far too large, and it does not belong in a model's context. Call upload_url first, have whatever holds the file PUT it to the returned URL, then call analyze with the jobId that came back. Send uploadAttestation to upload_url, with the agreementVersion get_legal_agreement names, only once the person you act for has confirmed that they may submit this document; analyze takes no attestation of its own.\n\nCalls POST /v1/upload-url.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "uploadAttestation": {
              "type": "object",
              "properties": {
                "agreementVersion": {
                  "type": "string",
                  "pattern": "^legal:[1-9][0-9]*$",
                  "description": "The agreement version GET /v1/legal-agreement names as current."
                },
                "uploadAuthorised": {
                  "type": "boolean",
                  "enum": [
                    true
                  ],
                  "description": "Always true: your confirmation that you may submit this document. false is refused."
                }
              },
              "required": [
                "agreementVersion",
                "uploadAuthorised"
              ],
              "additionalProperties": false,
              "description": "Your confirmation, for this one document, that you are authorised to submit it under the current upload agreement. Send it only once the person or system you act for has confirmed it. Required once the agreement is enforced, together with your organisation's acceptance, which an administrator gives in the GRANSKA app."
            }
          },
          "additionalProperties": false
        }
      },
      {
        "name": "analyze",
        "description": "Queues an analysis of one document and answers immediately with a job id. Consumes one run from the tenant's quota for every started group of three workers the analysis runs: 1 to 3 workers cost one run, 4 or 5 cost two. A review package consumes the sum of its reviews.\n\nThe document is never sent through this conversation: it is far too large, and it does not belong in a model's context. Call upload_url first, have whatever holds the file PUT it to the returned URL, then call analyze with the jobId that came back. Send uploadAttestation to upload_url, with the agreementVersion get_legal_agreement names, only once the person you act for has confirmed that they may submit this document; analyze takes no attestation of its own. The analysis runs asynchronously: this returns a jobId to poll with get_job. Before you call it, count the workers the profile runs in get_profiles, or the ones requestedWorkerIds names, and tell the person when the analysis will cost more than one run.\n\nCalls POST /v1/analyze.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "profileId": {
              "type": "string",
              "minLength": 1,
              "description": "Which analysis profile to run. GET /v1/profiles lists the ones your organisation is licensed for."
            },
            "jobId": {
              "type": "string",
              "minLength": 1,
              "description": "The job id POST /v1/upload-url returned, after the document was PUT to the upload URL that came with it. This is the only way to give an analysis its document: pdfBase64 and pdfUrl are no longer accepted, and a request that carries either is refused with 400 before anything else is read or a run is spent. It starts one job: sent again once a job stands under it, the request is refused with 409 CONFLICT."
            },
            "includeDiagnostics": {
              "type": "boolean",
              "description": "Adds each reviewer's own output and every consolidation step's output to the finished job under result.diagnostics. The consolidation half is result.diagnostics.reducers, one entry per review keyed by its profileId — one entry for an ordinary run, one per member for a review package. The older result.diagnostics.reducer holds the same record for an ordinary run and is deprecated; it is null for a review package, which has one consolidation per review and no single answer to give."
            },
            "dynamicContext": {
              "type": "object",
              "properties": {
                "entityId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "description": "Your own label for whoever the document is about. Accepted and validated, and then read by nothing: it is not stored on the job and no endpoint publishes it, so it cannot serve as a correlation key — hold your own mapping against the jobId this call returns. Not an identifier from this API — never a profileId, a jobId or a snippetKey. At most 200 characters, counted as Unicode code points; a longer value is refused with 400."
                },
                "entityName": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "description": "Your own display name for whoever the document is about. It is written into the user prompt of every worker you name in workerContext, as client-supplied context — so it reaches the language model rather than being an inert label. Workers you do not name in workerContext never see it, nothing stores it, and no endpoint publishes it back. At most 200 characters, counted as Unicode code points; a longer value is refused with 400."
                },
                "workerContext": {
                  "type": "object",
                  "maxProperties": 5,
                  "description": "Keyed by worker id. Each value adds rules or legal sources to that one worker. Every key must name a worker this analysis runs — after requestedWorkerIds has narrowed the profile — and no two keys may name the same worker; otherwise the request is refused with 400 before any job is created. It may name every worker the analysis runs, at most 5, the most a profile can hold.",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "customRules": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "maxItems": 20,
                        "description": "Extra instructions for this one worker, in plain sentences. Free text, not identifiers. At most 20 rules for one worker, each at most 1000 characters and together at most 10000 characters, counted as Unicode code points; one rule more, one rule longer, or more text in total, and the request is refused with 400."
                      },
                      "snippetIds": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        },
                        "maxItems": 10,
                        "description": "The snippetKey each authored legal source was minted under — the value GET /v1/snippets publishes for every source this tenant may use, and the same value POST /v1/snippets returns when a source is created. Never the document id: a document id is a well-formed string, so it is accepted, the job answers 200, and it resolves to nothing without a word. These sources are added to the worker on top of its own rules and the snippet keys already stored on it, so a key that resolves to nothing does not empty its legal framework — it drops exactly the extra source you were trying to add, and the finished job does not say it is missing. At most 10 keys for one worker; one key more and the request is refused with 400."
                      }
                    },
                    "additionalProperties": false
                  }
                }
              },
              "additionalProperties": false,
              "description": "Supplementary legal context merged into the targeted workers' prompts for this one job."
            },
            "webhookUrl": {
              "type": "string",
              "description": "Called when the job finishes, instead of polling GET /v1/jobs/:jobId."
            },
            "webhookSecret": {
              "type": "string",
              "description": "Signs the webhook call with HMAC-SHA256 so the receiver can verify it came from here."
            }
          },
          "additionalProperties": false,
          "required": [
            "profileId",
            "jobId"
          ]
        }
      },
      {
        "name": "get_job",
        "description": "Reads the state of one job, and its result once the job has finished.\n\nPoll this until status is COMPLETED or FAILED. Reading does not delete the result; the retention sweep removes a finished job between 15 and 30 minutes after its last update, and delete_job removes it at once. Before you explain a finished result, read read_guide topic \"results\". PROFILE_RULE is a criterion set by the author of a platform profile your organisation runs: it can carry a finding on its own. PROFILE_GUIDANCE only supports a finding. Neither is law or your organisation's own rule. A finding resting on a PROFILE_RULE says the document departs from the profile's criterion, not that it breaks the law.\n\nCalls GET /v1/jobs/:jobId.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "jobId": {
              "type": "string",
              "minLength": 1,
              "description": "The id POST /v1/analyze or POST /v1/action returned."
            },
            "includeTrace": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Set to \"true\" to add `result.analysisTrace` to a completed analysis: the run's legal trace, or `null` when the run has none that is valid. It adds nothing to an action, or to a job that has no result yet. Any other value, or the parameter sent twice, answers 400."
            }
          },
          "additionalProperties": false,
          "required": [
            "jobId"
          ]
        }
      },
      {
        "name": "delete_job",
        "description": "Deletes a finished job before it would expire on its own.\n\nCall this once get_job has answered COMPLETED or FAILED and you have what you need from the result. It deletes the job and its result at once; a job that is still QUEUED or IN_PROGRESS answers 409, so wait and try again.\n\nCalls DELETE /v1/jobs/:jobId.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "jobId": {
              "type": "string",
              "minLength": 1,
              "description": "The id of a job that has reached COMPLETED or FAILED."
            }
          },
          "additionalProperties": false,
          "required": [
            "jobId"
          ]
        }
      },
      {
        "name": "get_profiles",
        "description": "Lists the analysis profiles this tenant is licensed for — who owns each one, whether it is published, and the workers it runs, each with its public description where one is written.\n\nCall this before analyze: it names the profiles this organisation may run.\n\nCalls GET /v1/profiles.",
        "inputSchema": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      {
        "name": "get_profile",
        "description": "Reads one profile in full: every reviewer it runs, and every legal source each of those holds. For a review bundle, the same for each profile in it.\n\nCalls GET /v1/profiles/:id.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "description": "The profile to read, as GET /v1/profiles returned it. Must be one your organisation is licensed for."
            }
          },
          "additionalProperties": false,
          "required": [
            "id"
          ]
        }
      },
      {
        "name": "get_snippet_by_id",
        "description": "Reads one legal source by its document id or its snippetKey, full text included.\n\nCalls GET /v1/snippets/:id.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "description": "The id GET /v1/snippets returned, or a snippetKey a granskare's snippetIds cites. A document id is matched first."
            }
          },
          "additionalProperties": false,
          "required": [
            "id"
          ]
        }
      },
      {
        "name": "get_actions",
        "description": "Lists the follow-up actions this tenant may run against a finished analysis.\n\nCalls GET /v1/actions.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "profileId": {
              "type": "string",
              "description": "Lists only the actions written for this profile — the same id you pass to POST /v1/analyze, a bundle profile included. Omit it and the whole list comes back, exactly as before this parameter existed."
            }
          },
          "additionalProperties": false
        }
      },
      {
        "name": "get_action",
        "description": "Reads one action in full — the brief it was written with, and every section it writes.\n\nCalls GET /v1/actions/:id.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "description": "The action to read, as GET /v1/actions returned it. Must be one your organisation is licensed for."
            }
          },
          "additionalProperties": false,
          "required": [
            "id"
          ]
        }
      },
      {
        "name": "get_config",
        "description": "Reads this tenant's resolved workspace configuration — profiles, actions and limits in one call.\n\nReads the whole resolved setup in one answer. Prefer get_profiles, get_actions or get_quotas when one of them answers the question; this answer is far longer.\n\nCalls GET /v1/config.",
        "inputSchema": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      {
        "name": "action",
        "description": "Queues a follow-up action over a finished analysis and answers immediately with a job id. Consumes one run from the tenant's quota.\n\nRuns over a finished analysis and returns a new jobId to poll with get_job.\n\nNot available through this tool: clinicalData.\n\nCalls POST /v1/action.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "jobId": {
              "type": "string",
              "minLength": 1,
              "description": "The analysis to act on, named rather than pasted: the id POST /v1/analyze returned. The gateway reads the finished analysis off that job itself. Send this or clinicalData, never both. include_in_action cannot be used with this form — it is a mark on the analysis you send, and this form sends none, so the action is written from every finding."
            },
            "actionType": {
              "type": "string",
              "minLength": 1,
              "description": "Which action to run. GET /v1/actions lists the ones your organisation is licensed for."
            },
            "profileId": {
              "type": "string",
              "minLength": 1,
              "description": "The profile the analysis was produced with — the same id you passed to POST /v1/analyze, a granskningspaket included. Omitting it is a 400. Name a bundle and it is expanded into its member profiles: the action is one document written from the union of both members' law, and the findings you send back must carry profile_id tags naming that bundle's own members and nothing else."
            },
            "includeDiagnostics": {
              "type": "boolean",
              "description": "Adds the action job's diagnostic output to the finished job."
            },
            "webhookUrl": {
              "type": "string",
              "description": "Called when the job finishes, instead of polling GET /v1/jobs/:jobId."
            },
            "webhookSecret": {
              "type": "string",
              "description": "Signs the webhook call with HMAC-SHA256 so the receiver can verify it came from here."
            }
          },
          "additionalProperties": false,
          "required": [
            "actionType",
            "profileId",
            "jobId"
          ]
        }
      },
      {
        "name": "search_laws",
        "description": "Searches a jurisdiction's catalogue of laws, and says which of them this corpus holds.\n\nFinds the work identifier get_law and get_snippets need. When unavailableSources is not empty, a law source was down and the list is missing its hits: say so rather than presenting the list as complete.\n\nCalls GET /v1/laws.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "jurisdiction": {
              "type": "string",
              "minLength": 1,
              "description": "Which legal order to search, as a code such as SE. Only a legal order with an integrated law source can be searched — SE, NO, DK, US_FED and EU resolve today; anything else is refused by name."
            },
            "query": {
              "type": "string",
              "minLength": 2,
              "description": "Free text matched against each law's number and title. At least two characters."
            },
            "limit": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "description": "How many hits to return, between 1 and 50. Defaults to 50."
            }
          },
          "additionalProperties": false,
          "required": [
            "jurisdiction",
            "query"
          ]
        }
      },
      {
        "name": "get_law",
        "description": "Reads one law's provisions, each with the pinpoint a profile must cite it by.\n\nCalls GET /v1/laws/:jurisdiction/:work.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "jurisdiction": {
              "type": "string",
              "minLength": 1,
              "description": "Which legal order the law belongs to, as a code such as SE. Only a legal order with an integrated law source resolves — SE, NO, DK, US_FED and EU resolve today; the refusal names the ones that do."
            },
            "work": {
              "type": "string",
              "minLength": 1,
              "description": "Which law, exactly as GET /v1/laws spells it. Opaque — never parsed, and never assembled with the pinpoint into one string."
            },
            "cursor": {
              "type": "string",
              "minLength": 1,
              "description": "The nextCursor a previous response carried, to read the page after it. Omit for the first page. Opaque — send it back exactly as received, never build one. Paging costs nothing: only the first call can fetch the law."
            }
          },
          "additionalProperties": false,
          "required": [
            "jurisdiction",
            "work"
          ]
        }
      },
      {
        "name": "get_snippets",
        "description": "Lists the legal sources this tenant may use, or resolves exactly one of them.\n\nUse this to read the legal text behind a finding the analysis reported.\n\nCalls GET /v1/snippets.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "includeText": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Set to \"true\" to get each source's full text rather than metadata alone."
            },
            "snippetKey": {
              "type": "string",
              "minLength": 1,
              "description": "Resolves the one authored source with this key instead of listing. Cannot be combined with the reference fields."
            },
            "jurisdiction": {
              "type": "string",
              "minLength": 1,
              "description": "Which legal order the provision belongs to — a code such as SE or US_NH, matched exactly. Given together with work and pinpoint, resolves one statute provision."
            },
            "work": {
              "type": "string",
              "minLength": 1,
              "description": "Which law. Given together with jurisdiction and pinpoint, resolves one statute provision."
            },
            "pinpoint": {
              "type": "string",
              "minLength": 1,
              "description": "Where in the law — the id the provision is addressed by (\"par_7§\"), never the label it is printed as (\"7 §\"). Given together with jurisdiction and work, resolves one statute provision."
            },
            "partKey": {
              "type": "string",
              "minLength": 1,
              "description": "One part the source publishes inside the pinpoint, exactly as a delivered citation carries it. Given with jurisdiction, work and pinpoint, resolves that part and its subparts only. Opaque — never parsed."
            }
          },
          "additionalProperties": false
        }
      },
      {
        "name": "get_quotas",
        "description": "Reads this tenant's run limit, what it has spent this period, when the period resets, and how many workers this organisation's own profiles may hold.\n\nanalyze and action are the tools that spend a run, and get_law can tick the hourly configuration-write floor. Call this first to see whether the next one is affordable; it draws nothing itself.\n\nCalls GET /v1/quotas.",
        "inputSchema": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      {
        "name": "ai_status",
        "description": "Reads the latest saved AI service availability verdict. Takes a bearer token but spends no runs.\n\nCall this when an analysis fails or is unusually slow, to see whether the AI service itself is degraded. It draws no run.\n\nCalls GET /v1/ai-status.",
        "inputSchema": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      {
        "name": "read_guide",
        "description": "Reads GRANSKA's guide for AI agents: how a review works, how to read and present a result, and how to build profiles, rules and actions. Spends nothing.\n\nCall this with a topic before you explain a first result, build a profile, a rule or an action, mask a document, or handle a slow or failed review. It draws nothing.\n\nCalls GET /v1/guide.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "topic": {
              "type": "string",
              "enum": [
                "results",
                "profiles",
                "actions",
                "masking",
                "waiting"
              ],
              "description": "One topic of the guide. Omit it to get the opening note and the list of topics."
            }
          },
          "additionalProperties": false
        }
      },
      {
        "name": "create_profile",
        "description": "Creates an analysis profile and the workers it runs. The profile is created as a draft.\n\nThe profile is created as a draft. Publish it with update_profile status PUBLISHED once the person you act for has read it. Every worker needs at least one binding source: a law found with search_laws and get_law, or a rule of a binding kind, such as OWN_RULE. Counts against the organisation's hourly configuration-write floor; get_quotas shows what is left.\n\nCalls POST /v1/profiles.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "description": "What the profile is called in the workspace it is created in."
            },
            "documentType": {
              "type": "string",
              "minLength": 1,
              "description": "The kind of document this profile audits, e.g. \"LSS\". Free text, and what a follow-up action matches on when no profile is named."
            },
            "workers": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "instructions": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "rules": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "jurisdiction": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}(?:_[A-Z0-9]{1,3})?$"
                        },
                        "work": {
                          "type": "string",
                          "pattern": "^[^/]+$"
                        },
                        "pinpoint": {
                          "type": "string",
                          "minLength": 1
                        },
                        "partKey": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "jurisdiction",
                        "work",
                        "pinpoint"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "snippetIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "publicDescription": {
                    "type": "string",
                    "maxLength": 400
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              },
              "description": "The workers the profile runs, each with a name, an optional instruction and the legal sources it holds. At least one, and at most the organisation's configured limit."
            },
            "snippets": {
              "type": "array",
              "maxItems": 75,
              "items": {
                "type": "object",
                "properties": {
                  "ref": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "source": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "content": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2500
                  },
                  "authorityType": {
                    "type": "string",
                    "enum": [
                      "CONSTITUTIONAL_LAW",
                      "STATUTE",
                      "ORDINANCE",
                      "AGENCY_REGULATION",
                      "LOCAL_REGULATION",
                      "EU_TREATY",
                      "EU_REGULATION",
                      "EU_DIRECTIVE",
                      "EU_DECISION",
                      "CASE_LAW",
                      "SUPERVISORY_DECISION",
                      "PREPARATORY_WORKS",
                      "GENERAL_ADVICE",
                      "GUIDANCE",
                      "OWN_RULE",
                      "OWN_GUIDANCE"
                    ]
                  },
                  "validFromYear": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "validToYear": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "ref",
                  "name",
                  "source",
                  "content",
                  "authorityType"
                ],
                "additionalProperties": false
              },
              "description": "Legal sources this organisation authors in the same request, each named by a ref the workers' snippetIds cite. The server mints each source's id and snippetKey, stores the key in snippetIds in place of the ref, and answers both identities beside the ref."
            },
            "jurisdictions": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[A-Z]{2}(?:_[A-Z0-9]{1,3})?$"
              },
              "description": "The countries whose legal order the profile applies, as codes such as SE or US_NH. Each must be open on this platform — the ones your organisation may use are in its settings. The legal orders whose own law a worker cites are always added, so send this for a legal order no cited provision names, such as US_NY beside federal provisions when its state law is in your own rule sets: those rule sets are then weighed against that state's hierarchy. A legal order that sits under another, such as US_NY under US_FED, brings that one with it; never the reverse. A provision cited from EU law (jurisdiction EU) is a source, never a country: when every provision cited is EU law, send the country here, and it decides whether each EU act binds."
            },
            "categoryPath": {
              "type": "string",
              "description": "Where the profile is filed in the workspace's own grouping. Defaults to \"Generell\"."
            },
            "userHelpText": {
              "type": "string",
              "description": "The help text shown beside the profile to the people who choose it."
            },
            "urlSlug": {
              "type": "string",
              "description": "A shortcut this profile answers on, as /p/{urlSlug}. Unique within your organisation: a shortcut another of your profiles already holds is a 409."
            },
            "unlisted": {
              "type": "boolean",
              "description": "Keeps the profile out of the pickers your organisation's own people choose from, leaving it reachable on its /p/{urlSlug} shortcut. Defaults to false, which is a profile that appears everywhere."
            },
            "outputLanguage": {
              "type": "string",
              "enum": [
                "Swedish",
                "Norwegian (Bokmål)",
                "Danish",
                "English"
              ],
              "description": "The language this profile's reports are written in. One of Swedish, Norwegian (Bokmål), Danish and English — the value is the instruction the model reads, so it is the English name of the language and not the language's own name for itself. Omit to inherit the organisation's."
            }
          },
          "additionalProperties": false,
          "required": [
            "name",
            "documentType",
            "workers"
          ]
        }
      },
      {
        "name": "update_profile",
        "description": "Edits a profile this tenant owns, and publishes or unpublishes it. What the request omits keeps the value it had, status included.\n\nRead the profile with get_profile first. workers replaces the whole set: send every worker the profile should keep, each with its id, or it leaves the profile. Counts against the organisation's hourly configuration-write floor; get_quotas shows what is left.\n\nCalls PATCH /v1/profiles/:id.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "description": "The profile to edit, as GET /v1/profiles returned it. Must belong to the organisation behind this credential."
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "description": "A new name for the profile. Omit to keep the stored one."
            },
            "documentType": {
              "type": "string",
              "minLength": 1,
              "description": "A new document type. Omit to keep the stored one."
            },
            "workers": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1
                  },
                  "instructions": {
                    "type": "string",
                    "description": "At most 1000 characters, or as long as the stored instructions of the reviewer named by id."
                  },
                  "rules": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "jurisdiction": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}(?:_[A-Z0-9]{1,3})?$"
                        },
                        "work": {
                          "type": "string",
                          "pattern": "^[^/]+$"
                        },
                        "pinpoint": {
                          "type": "string",
                          "minLength": 1
                        },
                        "partKey": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "jurisdiction",
                        "work",
                        "pinpoint"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "snippetIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "publicDescription": {
                    "type": "string",
                    "description": "At most 400 characters, or as long as the stored description of the reviewer named by id."
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              },
              "description": "Replaces the whole set of workers this profile runs. Omit it and the workers are left untouched."
            },
            "snippets": {
              "type": "array",
              "maxItems": 75,
              "items": {
                "type": "object",
                "properties": {
                  "ref": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "source": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 250
                  },
                  "content": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2500
                  },
                  "authorityType": {
                    "type": "string",
                    "enum": [
                      "CONSTITUTIONAL_LAW",
                      "STATUTE",
                      "ORDINANCE",
                      "AGENCY_REGULATION",
                      "LOCAL_REGULATION",
                      "EU_TREATY",
                      "EU_REGULATION",
                      "EU_DIRECTIVE",
                      "EU_DECISION",
                      "CASE_LAW",
                      "SUPERVISORY_DECISION",
                      "PREPARATORY_WORKS",
                      "GENERAL_ADVICE",
                      "GUIDANCE",
                      "OWN_RULE",
                      "OWN_GUIDANCE"
                    ]
                  },
                  "validFromYear": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "validToYear": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "ref",
                  "name",
                  "source",
                  "content",
                  "authorityType"
                ],
                "additionalProperties": false
              },
              "description": "Legal sources this organisation authors in the same request, each named by a ref the workers' snippetIds cite. The server mints each source's id and snippetKey, stores the key in snippetIds in place of the ref, and answers both identities beside the ref."
            },
            "jurisdictions": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[A-Z]{2}(?:_[A-Z0-9]{1,3})?$"
              },
              "description": "The countries whose legal order the profile applies, as codes such as SE or US_NY. Sent only together with workers. The legal orders whose own law the workers cite are always added; sent, this replaces the others the profile declares, and [] removes them (refused when the workers cite no law at all); omitted, the ones added before stay beside the cited ones, while the ones the previous provisions decided follow the new provisions. A legal order that sits under another, such as US_NY under US_FED, brings that one with it. A provision cited from EU law (jurisdiction EU) is a source and never becomes one."
            },
            "categoryPath": {
              "type": "string",
              "description": "Where the profile is filed in the workspace's own grouping."
            },
            "userHelpText": {
              "type": "string",
              "description": "The help text shown beside the profile to the people who choose it."
            },
            "urlSlug": {
              "type": "string",
              "description": "A new shortcut this profile answers on, as /p/{urlSlug}. Omit to keep the stored one; send \"\" to remove it. Unique within your organisation: a shortcut another of your profiles already holds is a 409."
            },
            "unlisted": {
              "type": "boolean",
              "description": "Whether the profile is kept out of the pickers your organisation's own people choose from. Send true to hide it, false to list it again. Omit to keep the stored setting."
            },
            "outputLanguage": {
              "type": "string",
              "enum": [
                "Swedish",
                "Norwegian (Bokmål)",
                "Danish",
                "English"
              ],
              "description": "The language this profile's reports are written in — one of Swedish, Norwegian (Bokmål), Danish and English. Omit to keep the stored setting."
            },
            "status": {
              "type": "string",
              "enum": [
                "DRAFT",
                "PUBLISHED"
              ],
              "description": "Whether the profile is offered to your organisation's own people. Send \"PUBLISHED\" to publish it, \"DRAFT\" to take it back to a draft. Omit it and the stored status stands — an edit that says nothing about status leaves a published profile published."
            }
          },
          "additionalProperties": false,
          "required": [
            "id"
          ]
        }
      },
      {
        "name": "create_snippet",
        "description": "Creates a legal source this organisation owns — its own rules, guidance or statutes — and mints the key a reviewer cites it by.\n\nA rule you write yourself supports a finding unless you give it a binding kind. Give it the kind OWN_RULE if it should carry a finding on its own, or OWN_GUIDANCE if it should only support one. Neither is presented as law. Counts against the organisation's hourly configuration-write floor; get_quotas shows what is left.\n\nCalls POST /v1/snippets.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 250,
              "description": "The provision label this source is cited as, e.g. \"4 kap. 1 §\" or \"§ 12 Ordningsregler\"."
            },
            "source": {
              "type": "string",
              "minLength": 1,
              "maxLength": 250,
              "description": "The instrument the provision belongs to, e.g. \"Socialtjänstlag (2001:453)\" or \"Stadgar för Brf Almen\". It is what the model is told the text is from."
            },
            "content": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2500,
              "description": "The text itself, as a person would read it, at most 2500 characters. The server compiles it into the citable element the model receives — you do not send that element, and text is not a field this route accepts."
            },
            "authorityType": {
              "type": "string",
              "enum": [
                "CONSTITUTIONAL_LAW",
                "STATUTE",
                "ORDINANCE",
                "AGENCY_REGULATION",
                "LOCAL_REGULATION",
                "EU_TREATY",
                "EU_REGULATION",
                "EU_DIRECTIVE",
                "EU_DECISION",
                "CASE_LAW",
                "SUPERVISORY_DECISION",
                "PREPARATORY_WORKS",
                "GENERAL_ADVICE",
                "GUIDANCE",
                "OWN_RULE",
                "OWN_GUIDANCE"
              ],
              "description": "What kind of instrument this is — one of CONSTITUTIONAL_LAW, STATUTE, ORDINANCE, AGENCY_REGULATION, LOCAL_REGULATION, EU_TREATY, EU_REGULATION, EU_DIRECTIVE, EU_DECISION, CASE_LAW, SUPERVISORY_DECISION, PREPARATORY_WORKS, GENERAL_ADVICE, GUIDANCE, OWN_RULE or OWN_GUIDANCE. It decides how heavily a finding citing this source weighs. A value outside the list is a 400 naming them."
            },
            "validFromYear": {
              "type": [
                "integer",
                "null"
              ],
              "description": "The year the provision took effect, or null when it does not apply. Defaults to null."
            },
            "validToYear": {
              "type": [
                "integer",
                "null"
              ],
              "description": "The year the provision ceased to apply, or null while it still does. Defaults to null."
            }
          },
          "additionalProperties": false,
          "required": [
            "name",
            "source",
            "content",
            "authorityType"
          ]
        }
      },
      {
        "name": "update_snippet",
        "description": "Edits a legal source this organisation owns. What the request omits keeps the value it had, and the key reviewers cite never moves.\n\nA rule you write yourself supports a finding unless you give it a binding kind. Give it the kind OWN_RULE if it should carry a finding on its own, or OWN_GUIDANCE if it should only support one. Neither is presented as law. Counts against the organisation's hourly configuration-write floor; get_quotas shows what is left.\n\nCalls PATCH /v1/snippets/:id.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "description": "The source to edit, as the id GET /v1/snippets published — not its snippetKey. Must be one this organisation owns."
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 250,
              "description": "The provision label. Omit to keep the stored one."
            },
            "source": {
              "type": "string",
              "minLength": 1,
              "maxLength": 250,
              "description": "The instrument the provision belongs to. Omit to keep the stored one."
            },
            "content": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2500,
              "description": "The text itself, at most 2500 characters. Sending it recompiles the citable element the model receives. Omitting it leaves the stored text alone only when the request also leaves name and source alone: changing either of those rebuilds the element from the stored content, exactly as changing the content does. An edit that touches nothing but authorityType is the one that annotates the stored element in place."
            },
            "authorityType": {
              "type": "string",
              "enum": [
                "CONSTITUTIONAL_LAW",
                "STATUTE",
                "ORDINANCE",
                "AGENCY_REGULATION",
                "LOCAL_REGULATION",
                "EU_TREATY",
                "EU_REGULATION",
                "EU_DIRECTIVE",
                "EU_DECISION",
                "CASE_LAW",
                "SUPERVISORY_DECISION",
                "PREPARATORY_WORKS",
                "GENERAL_ADVICE",
                "GUIDANCE",
                "OWN_RULE",
                "OWN_GUIDANCE"
              ],
              "description": "What kind of instrument this is. Omit to keep the stored one; a value outside the published list is a 400 naming them. OWN_RULE is your organisation's own binding rule: it can anchor a finding on its own, in every country. OWN_GUIDANCE is your own guidance and only supports a finding. Neither is law."
            },
            "validFromYear": {
              "type": [
                "integer",
                "null"
              ],
              "description": "The year the provision took effect, or null. Omit to keep the stored value."
            },
            "validToYear": {
              "type": [
                "integer",
                "null"
              ],
              "description": "The year the provision ceased to apply, or null. Omit to keep the stored value."
            }
          },
          "additionalProperties": false,
          "required": [
            "id"
          ]
        }
      },
      {
        "name": "create_action",
        "description": "Creates a follow-up action this organisation owns, as a draft. Not POST /v1/action, which runs one: /v1/actions with an s writes the action, /v1/action without one runs it.\n\nCounts against the organisation's hourly configuration-write floor; get_quotas shows what is left.\n\nCalls POST /v1/actions.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "description": "The action's name, as your organisation's menu shows it."
            },
            "instructions": {
              "type": "string",
              "maxLength": 20000,
              "description": "The brief for the whole document: what the action is for and how it should read, at most 20000 characters. It goes into the model's prompt on every run."
            },
            "sections": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1
                  },
                  "label": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "TEXT",
                      "LIST",
                      "FLAW_MAPPED_LIST"
                    ]
                  },
                  "instructions": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "QUOTE",
                      "SUCCESS_BOX",
                      "WARNING_BOX"
                    ]
                  }
                },
                "required": [
                  "key",
                  "label",
                  "type",
                  "instructions"
                ],
                "additionalProperties": false
              },
              "description": "The sections the document is written in, in order. Each is { key, label, type, instructions, variant? }: key a non-empty string unique to this action, label and instructions strings, type one of TEXT, LIST, FLAW_MAPPED_LIST, and variant, optional, one of STANDARD, QUOTE, SUCCESS_BOX, WARNING_BOX."
            },
            "tagline": {
              "type": "string",
              "description": "One line under the name in the menu."
            },
            "description": {
              "type": "string",
              "description": "A short description of what the action produces."
            },
            "longDesc": {
              "type": "string",
              "description": "A longer description, shown where the action is explained in full."
            },
            "warningMessage": {
              "type": "string",
              "description": "A reservation the reader sees before running the action, such as what it does not do."
            },
            "icon": {
              "type": "string",
              "description": "The name of the icon the menu draws beside the action."
            },
            "category": {
              "type": "string",
              "description": "The heading the action is filed under in your organisation's menu."
            },
            "sortOrder": {
              "type": "number",
              "description": "Where the action sorts within its category, lowest first."
            },
            "jurisdictions": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "pattern": "^[A-Z]{2}(?:_[A-Z0-9]{1,3})?$"
              },
              "description": "The legal orders the action is written for, as codes such as SE. Each must be open on this platform; when sent, at least one."
            },
            "practiceAreas": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "enum": [
                  "CHILD_WELFARE",
                  "FAMILY_LAW",
                  "DISABILITY_SUPPORT",
                  "CRIMINAL_LAW",
                  "SOCIAL_INSURANCE",
                  "HEALTHCARE",
                  "EMPLOYMENT",
                  "PLANNING_AND_BUILDING",
                  "STATE_LIABILITY",
                  "ASSOCIATION_LAW",
                  "INFORMATION_SECURITY",
                  "GENERAL"
                ]
              },
              "description": "The practice areas the action fits, each one of CHILD_WELFARE, FAMILY_LAW, DISABILITY_SUPPORT, CRIMINAL_LAW, SOCIAL_INSURANCE, HEALTHCARE, EMPLOYMENT, PLANNING_AND_BUILDING, STATE_LIABILITY, ASSOCIATION_LAW, INFORMATION_SECURITY, GENERAL; when sent, at least one."
            },
            "fitsProfileIds": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "The profiles the action is written for, as the ids GET /v1/profiles returns. GET /v1/actions?profileId= lists it under each of them; left out, nobody has decided and it is listed for every profile."
            },
            "outputLanguage": {
              "type": "string",
              "enum": [
                "Swedish",
                "Norwegian (Bokmål)",
                "Danish",
                "English"
              ],
              "description": "The language the document is written in — one of Swedish, Norwegian (Bokmål), Danish and English. Left out, the document follows the language of the profile the analysis ran with, then your organisation's."
            }
          },
          "additionalProperties": false,
          "required": [
            "name",
            "instructions",
            "sections"
          ]
        }
      },
      {
        "name": "update_action",
        "description": "Edits a follow-up action this organisation owns, and publishes or unpublishes it. What the request omits keeps the value it had, status included.\n\nCounts against the organisation's hourly configuration-write floor; get_quotas shows what is left.\n\nCalls PATCH /v1/actions/:id.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "description": "The action to edit, as GET /v1/actions and POST /v1/actions returned it. Must be one this organisation owns."
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "description": "The action's name, as your organisation's menu shows it. Omit to keep the stored one."
            },
            "instructions": {
              "type": "string",
              "maxLength": 20000,
              "description": "The brief for the whole document: what the action is for and how it should read, at most 20000 characters. It goes into the model's prompt on every run. Omit to keep the stored one."
            },
            "sections": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "minLength": 1
                  },
                  "label": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "TEXT",
                      "LIST",
                      "FLAW_MAPPED_LIST"
                    ]
                  },
                  "instructions": {
                    "type": "string"
                  },
                  "variant": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "QUOTE",
                      "SUCCESS_BOX",
                      "WARNING_BOX"
                    ]
                  }
                },
                "required": [
                  "key",
                  "label",
                  "type",
                  "instructions"
                ],
                "additionalProperties": false
              },
              "description": "The sections the document is written in, in order. Each is { key, label, type, instructions, variant? }: key a non-empty string unique to this action, label and instructions strings, type one of TEXT, LIST, FLAW_MAPPED_LIST, and variant, optional, one of STANDARD, QUOTE, SUCCESS_BOX, WARNING_BOX. Sending it replaces the stored list."
            },
            "tagline": {
              "type": "string",
              "description": "One line under the name in the menu. Omit to keep the stored one."
            },
            "description": {
              "type": "string",
              "description": "A short description of what the action produces. Omit to keep the stored one."
            },
            "longDesc": {
              "type": "string",
              "description": "A longer description, shown where the action is explained in full. Omit to keep the stored one."
            },
            "warningMessage": {
              "type": "string",
              "description": "A reservation the reader sees before running the action, such as what it does not do. Omit to keep the stored one."
            },
            "icon": {
              "type": "string",
              "description": "The name of the icon the menu draws beside the action. Omit to keep the stored one."
            },
            "category": {
              "type": "string",
              "description": "The heading the action is filed under in your organisation's menu. Omit to keep the stored one."
            },
            "sortOrder": {
              "type": "number",
              "description": "Where the action sorts within its category, lowest first. Omit to keep the stored one."
            },
            "jurisdictions": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "pattern": "^[A-Z]{2}(?:_[A-Z0-9]{1,3})?$"
              },
              "description": "The legal orders the action is written for, as codes such as SE. Each must be open on this platform; when sent, at least one. Omit to keep the stored one."
            },
            "practiceAreas": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "enum": [
                  "CHILD_WELFARE",
                  "FAMILY_LAW",
                  "DISABILITY_SUPPORT",
                  "CRIMINAL_LAW",
                  "SOCIAL_INSURANCE",
                  "HEALTHCARE",
                  "EMPLOYMENT",
                  "PLANNING_AND_BUILDING",
                  "STATE_LIABILITY",
                  "ASSOCIATION_LAW",
                  "INFORMATION_SECURITY",
                  "GENERAL"
                ]
              },
              "description": "The practice areas the action fits, each one of CHILD_WELFARE, FAMILY_LAW, DISABILITY_SUPPORT, CRIMINAL_LAW, SOCIAL_INSURANCE, HEALTHCARE, EMPLOYMENT, PLANNING_AND_BUILDING, STATE_LIABILITY, ASSOCIATION_LAW, INFORMATION_SECURITY, GENERAL; when sent, at least one. Omit to keep the stored one."
            },
            "fitsProfileIds": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "description": "The profiles the action is written for, as the ids GET /v1/profiles returns. GET /v1/actions?profileId= lists it under each of them; left out, nobody has decided and it is listed for every profile. Omit to keep the stored one."
            },
            "outputLanguage": {
              "type": "string",
              "enum": [
                "Swedish",
                "Norwegian (Bokmål)",
                "Danish",
                "English"
              ],
              "description": "The language the document is written in — one of Swedish, Norwegian (Bokmål), Danish and English. Left out, the document follows the language of the profile the analysis ran with, then your organisation's. Omit to keep the stored one."
            },
            "status": {
              "type": "string",
              "enum": [
                "DRAFT",
                "PUBLISHED",
                "UPCOMING"
              ],
              "description": "Send \"PUBLISHED\" to put the action in your organisation's menu, \"DRAFT\" to take it back to a draft, or \"UPCOMING\" to show it as coming. Omit it and the stored status stands."
            }
          },
          "additionalProperties": false,
          "required": [
            "id"
          ]
        }
      }
    ],
    "ttlMs": 60000,
    "cacheScope": "private"
  }
}

One minute, and private to your own client. Both are deliberate: the list will be derived from what your tenant may reach, so it is never a shared cache — and a short life means your assistant picks up a change to it within the minute.

Three things the descriptions say out loud, because an assistant gets each wrong otherwise. The document never travels through the assistant's context: upload_url returns a job id and a URL, whatever holds the file uploads it there, and analyze is then given that job id, the only document argument it takes. A pinpoint is the id a provision is addressed by, par_7§, never the label it is printed as, 7 §. And reading a result does not delete it: get_job leaves a finished job in place until the retention sweep removes it, between 15 and 30 minutes after its last update, while delete_job removes the job and its result at once — once get_job has answered COMPLETED or FAILED, since a job still running is refused with 409.

A result you read enters the assistant's context. Once get_job has returned a finished analysis, its findings and quotes are in the conversation, and from then on they are kept under your assistant provider's terms, not ours. delete_job removes our copy; it cannot remove theirs.

ParameterDescription
jsonrpc
"2.0"·body·required
The JSON-RPC version. Always the string 2.0.
id
string | number·body
Correlates the answer with the call. Omit it entirely to send a notification, which is answered 202 with no body.Never null. This revision of MCP forbids a null id, and one is refused rather than read as a notification.
method
string·body·required
Which MCP method to call: server/discover, tools/list or tools/call. Anything else is 404 with JSON-RPC code -32601.tools/call runs the route the named tool stands for, with your own token and organisation, and costs exactly what calling that route directly would cost — a tool that starts an analysis draws a run from the same quota, one that writes configuration ticks the same hourly configuration-write floor, and one that only reads draws nothing. params.name is the tool and params.arguments its arguments. Before the route runs, only the argument names are checked against the tool's own inputSchema: an argument that schema does not offer is refused with -32602 rather than passed on, and so is a call that leaves out a required one. The values are validated by the route, whose refusal comes back as a tool result with isError set rather than as -32602.
params
object·body·required
The method's arguments. Its _meta must carry "io.modelcontextprotocol/protocolVersion" and "io.modelcontextprotocol/clientCapabilities" on every request.A request missing either is refused with JSON-RPC code -32602, as the protocol requires.

Limits, and one thing this endpoint does not do

What it spends is what the tool spends. Discovery and tools/list read nothing and cost nothing. tools/call draws exactly what the route behind the named tool draws — a run each for analyze and action, a step of the hourly configuration-write floor for each configuration write and for a get_law that has to fetch the law rather than read one already held, nothing for the other tools — and the three rate-limit headers come back on every answer the handler produces, the free calls included, with the two exceptions named at the top of this page. Those headers report the run quota on every answer but one, including a configuration write or a get_law that just spent the floor: the 429 a configuration write gets when the floor is spent reports the floor. Otherwise the floor is readable only from GET /v1/quotas.

GET and DELETE are 404, not 405. The specification suggests 405 on the MCP endpoint for those verbs. This gateway answers 404 NOT_FOUND to every wrong verb on every route, so that a client reading error.code gets an answer it can resolve. An assistant on an earlier revision that asks for the optional GET stream is told 404 and carries on without it: nothing here is ever sent on that stream.

Request
curl https://api.granska.cloud/v1/mcp \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: server/discover" \
  -d '{
    "jsonrpc": "2.0",
    "id": "discover-1",
    "method": "server/discover",
    "params": {
      "_meta": {
        "io.modelcontextprotocol/protocolVersion": "2026-07-28",
        "io.modelcontextprotocol/clientInfo": { "name": "ExampleClient", "version": "1.0.0" },
        "io.modelcontextprotocol/clientCapabilities": {}
      }
    }
  }'

How an assistant finds the approval

An MCP client library does all of this for you. It is written down for whoever is wiring one up by hand, or reading a trace of one.

The endpoint says where to go. A request to this endpoint with no credential, or with one that is refused, is answered 401 with WWW-Authenticate: Bearer, carrying resource_metadata and scope, and error="invalid_token" when a bearer was sent. resource_metadata is this endpoint's protected-resource document (RFC 9728) at https://api.granska.cloud/.well-known/oauth-protected-resource/v1/mcp. It names the resource, which is this URL exactly, its one scope, customer.full, and its authorisation server, https://api.granska.cloud, whose own metadata (RFC 8414) is at /.well-known/oauth-authorization-server.

The client registers itself and holds no secret. Registration is dynamic (RFC 7591) and public: a client states a name and its exact redirect URIs, https or http on a loopback address, and is given a client_id and nothing else. Client ID Metadata Documents are not supported. The name is the client's own claim, which is why the approval page shows it as unverified.

Approval is the authorisation-code grant with PKCE S256. The authorisation endpoint holds the request for ten minutes and sends the browser to the approval page. An approved request returns a single-use code, valid for five minutes, with the issuer in iss.

What the assistant is handed is short-lived and bound to this URL. An access token lasts 15 minutes and is refused anywhere but the resource it was approved for. A refresh token is exchanged once and replaced on every use, and a refresh token presented a second time ends the connection. The connection as a whole ends 90 days after it was approved, however often it was refreshed. Every request and every refresh is checked against the connection as it stands, so a disconnect, or the approving administrator losing the role or the account, refuses the next one.

These endpoints are not POST /v1/oauth/token. That route is the client-credentials exchange for an API key and is unchanged. An approved assistant's tokens come from the authorisation server's own token endpoint, which its metadata names.

There is no listing in an assistant's own directory. Connecting is the URL above, added by hand.

Send it without writing a client

If your organisation already has an account, an administrator can send this call from the API tester at /admin/api-tester — the real gateway, with your own credentials. This is the first route on the API that requires headers of its client, so the tester renders them as fields of their own: MCP-Protocol-Version arrives filled in with the revision this page describes, and Mcp-Method is yours to type — it is the method from the body beside it, server/discover in the example the tester loads.