GetLawED
Law library › Developers › Use with the OpenAI and Anthropic APIs

Use with the OpenAI and Anthropic APIs

Parameter names checked against the OpenAI and Anthropic documentation on 2026-10-13. Both platforms change these features from time to time — check their docs if a request is refused. Replace YOUR_MODEL with a current model that supports remote MCP tools on that platform.

OpenAI Responses API — remote MCP tool

Add a tool of type mcp; pass your GetLawED key in authorization (sent as a Bearer token, not stored by the platform — send it with every request). require_approval: "never" lets the model call the read-only GetLawED tools without a confirmation round-trip.

curl https://api.openai.com/v1/responses \
  -H "Authorization: Bearer $OPENAI_API_KEY" -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL",
    "tools": [{
      "type": "mcp",
      "server_label": "getlawed",
      "server_description": "Verified South African law: official legal texts and citation checks.",
      "server_url": "https://getlawed.co.za/api/mcp/law",
      "authorization": "'"$GETLAWED_KEY"'",
      "require_approval": "never",
      "allowed_tools": ["legal_library_search", "legal_get_section", "legal_verify_citations"]
    }],
    "input": "Under the Labour Relations Act, what can an arbitrator order if a dismissal is unfair? Quote the section."
  }'
from openai import OpenAI
import os

client = OpenAI()
response = client.responses.create(
    model="YOUR_MODEL",
    tools=[{
        "type": "mcp",
        "server_label": "getlawed",
        "server_description": "Verified South African law: official legal texts and citation checks.",
        "server_url": "https://getlawed.co.za/api/mcp/law",
        "authorization": os.environ["GETLAWED_KEY"],
        "require_approval": "never",
    }],
    input="Check this citation before I use it: S v Makwanyane and Another 1995 (3) SA 391 (CC)",
)
print(response.output_text)

Anthropic Messages API — MCP connector

Needs the beta header mcp-client-2025-11-20, a mcp_servers entry (with your key as authorization_token) and a matching mcp_toolset in tools.

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: mcp-client-2025-11-20" -H "content-type: application/json" \
  -d '{
    "model": "YOUR_MODEL",
    "max_tokens": 4096,
    "mcp_servers": [{
      "type": "url",
      "url": "https://getlawed.co.za/api/mcp/law",
      "name": "getlawed",
      "authorization_token": "'"$GETLAWED_KEY"'"
    }],
    "tools": [{ "type": "mcp_toolset", "mcp_server_name": "getlawed" }],
    "messages": [{ "role": "user", "content": "Under the Labour Relations Act, what can an arbitrator order if a dismissal is unfair? Quote the section." }]
  }'
import anthropic, os

client = anthropic.Anthropic()
response = client.beta.messages.create(
    model="YOUR_MODEL",
    max_tokens=4096,
    betas=["mcp-client-2025-11-20"],
    mcp_servers=[{
        "type": "url",
        "url": "https://getlawed.co.za/api/mcp/law",
        "name": "getlawed",
        "authorization_token": os.environ["GETLAWED_KEY"],
    }],
    tools=[{"type": "mcp_toolset", "mcp_server_name": "getlawed"}],
    messages=[{"role": "user", "content": "Check this citation before I use it: S v Makwanyane and Another 1995 (3) SA 391 (CC)"}],
)
print(response.content)

In Claude and ChatGPT apps

Add https://getlawed.co.za/api/mcp/law as a custom connector (works without a key on the free tier). Ask for example: "Check the citations in this paragraph with GetLawED".

Using an AI assistant? Connect it to GetLawED's verified South African law library — it can then quote provisions with their official source and check citations before you rely on them. How to connect