Integration Examples

Copy these. Paste them into your agent, tool, or workflow. Each one hits a real endpoint.

1. Claude Desktop (MCP)

Add this to your Claude Desktop config. Claude can now answer: "Is my water safe in 10001?" by calling get-water-safety.

{
  "mcpServers": {
    "open-primitive": {
      "command": "npx",
      "args": ["-y", "open-primitive-mcp"]
    }
  }
}

2. Python agent (LangChain)

One function. Wrap it as a LangChain tool or call it directly.

import requests

def check_drug_safety(drug_name):
    data = requests.get(f'https://api.openprimitive.com/v1/drugs?name={drug_name}').json()
    return f"{data['drug']} has {data['totalEvents']} adverse events. Top reaction: {data['topReactions'][0]['reaction']}"

3. JavaScript agent

Fetch a location profile by ZIP. Returns a single summary string your agent can pass to the user.

async function getLocationProfile(zip) {
  const res = await fetch(`https://api.openprimitive.com/v1/location?zip=${zip}`);
  const data = await res.json();
  return data.summary;
  // "ZIP 90210, population 19,652, median income $190,382, safety score 75/100"
}

4. Natural language query

Ask a plain question. Get a plain answer.

curl "https://api.openprimitive.com/v1/ask?q=is+the+tap+water+safe+in+Flint+Michigan"

5. Compare two options

Pass two items and a domain. The API returns a direct comparison.

curl "https://api.openprimitive.com/v1/compare?type=drugs&a=ibuprofen&b=acetaminophen"

# Returns: "ibuprofen has fewer adverse events (275,816 vs 655,818)"

6. Webhook for real-time alerts

Subscribe your agent to food recalls, drug alerts, or both. You get a POST when something new lands.

POST /v1/webhooks

{
  "url": "https://your-agent.com/alerts",
  "domains": ["food", "drugs"],
  "events": ["new_recall"]
}