Help
Developers

Function calling

Every endpoint as a tool definition your agent can call, in the Anthropic and OpenAI shapes, generated from the contract.

The contract also ships as tool definitions, one per endpoint, so an agent can use the API without an SDK. Two files, regenerated with the reference pages and the SDKs:

  • Anthropic shape (name, description, input_schema): https://www.showpilot.com/docs/developers/tools/anthropic.json
  • OpenAI shape (type: function, function.parameters): https://www.showpilot.com/docs/developers/tools/openai.json

Tool names are the operation ids in snake_case (list_tours, answer_follow_up, create_segment). Path and query parameters and the body's fields are top-level properties; every schema stands alone, with no references. The description carries the endpoint, the method and the scope the key needs.

Using them

Load the file, hand every tool (or the subset your agent needs) to the model, and execute a call by mapping the tool name back to the endpoint. The SDKs make that one line: the Python client's method has the same name.

import json
from showpilot import ShowPilot

tools = json.load(open("anthropic.json"))
client = ShowPilot(api_key=KEY)

def run(name: str, args: dict):
    ns = next(ns for ns in vars(client) if not ns.startswith("_") and hasattr(getattr(client, ns), name))
    fn = getattr(getattr(client, ns), name)
    path_args = [args.pop(p) for p in ("id", "slug", "deliveryId") if p in args]
    return fn(*path_args, **args) if not any(k in args for k in ("url", "events", "answer")) else fn(*path_args, args)

For most agents a handful of tools is plenty: list_tours, get_visitor, list_conversations, retrieve_knowledge, answer_follow_up, create_segment. A model does better with seven relevant tools than with sixty.

Keeping them fresh

The files are generated from openapi.yaml; a contract change regenerates them alongside the reference and the SDKs, and a test fails if they drift.

On this page