Frameworks

Two ways in, for any framework:

  • MCP: frameworks with an MCP client connect to https://www.prompt-tm.com/mcp/<server id>?user_id=<user> with the x-api-key header. See Connect an MCP client.
  • REST: fetch tool definitions in the framework's own shape (GET /api/v3/tools?format=anthropic|openai|openai_responses) and run each call the model makes with POST /api/v3/tools/execute/{slug}.

Anthropic Messages API (REST)

import Anthropic from "@anthropic-ai/sdk"
import { PromptTM } from "./prompt-tm"

const anthropic = new Anthropic()
const ptm = new PromptTM({ apiKey: process.env.PROMPT_TM_KEY! })
const { items: tools } = await ptm.tools.list({ toolkit_slug: "github", format: "anthropic" })

const messages: Anthropic.MessageParam[] = [{ role: "user", content: "Which of my repositories changed this week?" }]
for (;;) {
  const reply = await anthropic.messages.create({ model: "claude-sonnet-5-5", max_tokens: 2048, tools: tools as Anthropic.Tool[], messages })
  messages.push({ role: "assistant", content: reply.content })
  const calls = reply.content.filter((b) => b.type === "tool_use")
  if (!calls.length) break
  const results = await Promise.all(calls.map(async (c) => {
    const r = await ptm.tools.execute(c.name, { user_id: "alice", arguments: c.input as Record<string, unknown> })
    return { type: "tool_result" as const, tool_use_id: c.id, content: JSON.stringify(r.successful ? r.data : r.error), is_error: !r.successful }
  }))
  messages.push({ role: "user", content: results })
}

OpenAI Chat Completions (REST)

Use format=openai; each tool_calls[i].function.name is the tool slug and arguments is a JSON string to parse and pass to tools.execute.

OpenAI Agents SDK (MCP)

from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async with MCPServerStreamableHttp(params={"url": MCP_URL, "headers": {"x-api-key": KEY}}) as server:
    agent = Agent(name="ops", mcp_servers=[server])
    print((await Runner.run(agent, "List failed Vercel deployments")).final_output)

Vercel AI SDK (MCP)

import { createMCPClient } from "@ai-sdk/mcp"
import { generateText } from "ai"

const mcp = await createMCPClient({ transport: { type: "http", url: MCP_URL, headers: { "x-api-key": KEY } } })
const { text } = await generateText({ model, tools: await mcp.tools(), prompt: "Open an issue about the Safari bug" })
await mcp.close()

LangChain (MCP)

from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({"prompt-tm": {"url": MCP_URL, "transport": "streamable_http", "headers": {"x-api-key": KEY}}})
tools = await client.get_tools()

Claude Agent SDK

See Connect an MCP client.