tool_use  ·  command-r-plus  ·  ToolDefinition  ·  cohere SDK

Slopshop for
Cohere Agents

real tools across 82 categories via Cohere's tool_use API. Define tools as ToolDefinition objects with the cohere Python SDK — Slopshop handles all execution.
Free persistent memory. Every result verified.

422
Real Tools
0cr
Memory Cost
Tool
Native Format
100%
Verified Results

Quickstart

Three steps. Cohere has tools.

Cohere's tool_use format uses ToolDefinition with ToolParameterDefinitionsValue. It's distinct from OpenAI's format — but Slopshop's schema converts cleanly.

Step 01 — Install

Install the cohere SDK

Use Cohere's official Python SDK. The cohere package gives you access to Command R+ with native tool_use support.

pip install cohere requestsclick to copy
Step 02 — Build Definitions

Create ToolDefinition objects

Fetch Slopshop's OpenAPI schema and convert each endpoint to Cohere's ToolDefinition format with parameter definitions.

ToolDefinition(name, description, parameter_definitions)
Step 03 — Handle tool_calls

Execute, return ToolResult

When finish_reason="TOOL_CALL", execute each tool_call via Slopshop and pass results back as ToolResult objects.

82 categories of tools · ToolResult format · verified

Code Example

tool_use with command-r-plus

Full agentic loop using the cohere SDK. Cohere's tool_use has a distinct API — tool calls arrive as tool_calls[] and results go back as ToolResult objects in a tool_results turn.

cohere_agent.py python
import os, json, requests
import cohere
from cohere.types import (
    ToolDefinition, ToolParameterDefinitionsValue, ToolResult, ToolCall
)

co = cohere.Client(api_key=os.environ["COHERE_API_KEY"])

SLOP_KEY = os.environ["SLOPSHOP_API_KEY"]
SLOP_URL = "https://slopshop.gg"

# 1. Convert Slopshop OpenAPI schema to Cohere ToolDefinitions
def get_tools(slugs: list[str]) -> list[ToolDefinition]:
    schema = requests.get(
        f"{SLOP_URL}/v1/openapi.json",
        headers={"Authorization": f"Bearer {SLOP_KEY}"}
    ).json()

    tools = []
    for slug in slugs:
        path = schema["paths"].get(f"/v1/{slug}", {}).get("post", {})
        if not path:
            continue
        params_schema = path["requestBody"]["content"]["application/json"]["schema"]
        props = params_schema.get("properties", {})
        required = params_schema.get("required", [])

        # Build Cohere-style parameter definitions
        param_defs = {}
        for prop_name, prop_schema in props.items():
            param_defs[prop_name] = ToolParameterDefinitionsValue(
                description=prop_schema.get("description", ""),
                type=prop_schema.get("type", "str"),
                required=prop_name in required
            )

        tools.append(ToolDefinition(
            name=slug,
            description=path.get("summary", ""),
            parameter_definitions=param_defs
        ))
    return tools

# 2. Execute a Slopshop tool
def call_tool(name: str, args: dict) -> dict:
    res = requests.post(
        f"{SLOP_URL}/v1/{name}",
        json=args,
        headers={"Authorization": f"Bearer {SLOP_KEY}"}
    )
    return res.json()

# 3. Agentic loop — Cohere decides, Slopshop executes
def run_agent(user_message: str) -> str:
    tools = get_tools(["dns-lookup", "ssl-check", "http-request",
                       "whois", "hash", "memory-set", "memory-get"])

    # First turn: user message
    response = co.chat(
        model="command-r-plus",
        message=user_message,
        tools=tools
    )

    while response.finish_reason == "TOOL_CALL":
        tool_results = []
        for tc in response.tool_calls:
            result = call_tool(tc.name, tc.parameters)
            tool_results.append(ToolResult(
                call=tc,
                outputs=[result]
            ))

        # Send tool results back to Cohere
        response = co.chat(
            model="command-r-plus",
            chat_history=response.chat_history,
            message="",
            tools=tools,
            tool_results=tool_results
        )

    return response.text

answer = run_agent("Audit slopshop.gg: check DNS records, SSL validity, and save results to memory")
print(answer)
Cohere tool_calls → Slopshop → ToolResult
Cohere → tool_calls[]
{
  "name": "dns-lookup",
  "parameters": {
    "host": "slopshop.gg",
    "type": "A"
  },
  "generation_id": "gen_abc"
}
Slopshop → ToolResult outputs[0]
{
  "records": ["76.76.21.21"],
  "ttl": 300,
  "type": "A",
  "_engine": "real"
}

What You Get

Everything Command R+ needs to act on its reasoning

Cohere's Command models excel at RAG and enterprise tasks. Slopshop gives them the execution layer — real tools across 82 categories, all verified.

🀅

78 Categories of Real Tools

DNS, SSL, HTTP, crypto, hashing, code execution, data transforms, document generation. All real. No hallucinated outputs.

🧠

Free Persistent Memory

Command agents can write to and read from Slopshop's key-value store at zero credit cost. State persists across chat sessions.

🔗

ToolDefinition Format

Slopshop schemas convert directly to Cohere's ToolDefinition / ToolParameterDefinitionsValue format. No raw dict wrangling.

👀

Full Observability

Audit logs, per-request tracing, credit usage per tool call. Every invocation logged with inputs, outputs, and latency.

🏠

Self-Hostable

Run the entire Slopshop tool server on your own infrastructure. Zero external dependencies for compute APIs.


Give Command R+ real tools across 82 categories

cohere SDK. ToolDefinition format. 82 categories of tools. Free memory.
Command plans — Slopshop executes.

Get Started Free OpenAPI Schema Browse Browse All Tools
→ Full Docs → Browse Tools → Agent Templates → Savings Calculator