services
Trefle
Examples

Trefle Examples

Practical examples for using Trefle tools.

Search Plants

MCP Protocol Tester

Protocol Flow

Example: Search Plants

curl -X POST \
  -H "x-api-key: dev-key-12345" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "trefle.search_plants",
      "arguments": {
        "q": "coconut",
        "data_format": "cleaned"
      }
    }
  }' \
  http://localhost:3001/api/v1/services/trefle/mcp

Example: Get Plant by Slug

curl -X POST \
  -H "x-api-key: dev-key-12345" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "trefle.get_plant",
      "arguments": {
        "slug": "cocos-nucifera",
        "data_format": "raw"
      }
    }
  }' \
  http://localhost:3001/api/v1/services/trefle/mcp

Example: Search Species

curl -X POST \
  -H "x-api-key: dev-key-12345" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "trefle.search_species",
      "arguments": {
        "q": "rose",
        "page": 1,
        "per_page": 10,
        "data_format": "cleaned"
      }
    }
  }' \
  http://localhost:3001/api/v1/services/trefle/mcp

Example: Get Service Metadata

curl -X POST \
  -H "x-api-key: dev-key-12345" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "tools/call",
    "params": {
      "name": "trefle.metadata",
      "arguments": {}
    }
  }' \
  http://localhost:3001/api/v1/services/trefle/mcp

Note: trefle.metadata does not require a Trefle API token.