The most common thing a context repository does is answer "how do we…?" questions: in a support tool, a Slack bot, an internal assistant. The answer has to come from your documents, not the model's general knowledge, and people need to be able to check it.
The shape is the same whichever way you build it:
- Search with the whole question.
search_knowledgematches meaning, so "can I refund $800 without asking anyone?" finds the refund policy even though it never says "asking anyone". - Read the documents behind the best passages. A passage alone can miss the exception two paragraphs down.
- Answer only from what was read, and cite each document's
url. - Admit gaps. If nothing covers it, say so and suggest who to ask with
who_knows.
Instructions that work
Every option below uses these instructions:
You answer questions about how our company works, using only PlaybookOps.
Search with search_knowledge using the person's whole question. Then read the
documents that look relevant with read_document; don't answer from search
passages alone. Answer from what the documents say, briefly, in plain words.
End with "Sources:" and a Markdown link to the url of each document you used.
If the documents don't answer the question, say so plainly. Don't fill the gap
from general knowledge. Use who_knows to suggest who to ask.
If two documents disagree, say which says what and link both.
Build it
Make a Read-only key for the agent first.
The Claude API connects to the MCP server itself, so there's no tool loop to write. The toolset turns everything off except the three tools the agent needs.
import os
import anthropic
INSTRUCTIONS = "..." # the instructions above
client = anthropic.Anthropic()
response = client.beta.messages.create(
model="claude-opus-5-5",
max_tokens=2000,
system=INSTRUCTIONS,
messages=[{"role": "user", "content": "Can I refund a customer $800 without approval?"}],
mcp_servers=[
{
"type": "url",
"url": "https://mcp.playbookops.ai",
"name": "playbookops",
"authorization_token": os.environ["PLAYBOOKOPS_API_KEY"],
}
],
tools=[
{
"type": "mcp_toolset",
"mcp_server_name": "playbookops",
"default_config": {"enabled": False},
"configs": {name: {"enabled": True} for name in ("search_knowledge", "read_document", "who_knows")},
}
],
betas=["mcp-client-2025-11-20"],
)
print("".join(block.text for block in response.content if block.type == "text"))
A good answer looks like this:
No. Refunds over $500 need a manager's approval before you issue them. Ask in
#support-leads with the order number, and refund once a manager confirms.
Sources:
- [Refunds and credits](https://app.playbookops.ai/playbooks/…)
Make it trustworthy
- Think about whose key it is. A bot that answers many people uses one key, so everyone asking sees what that key's owner can see. Make the key from an account that can open only the playbooks every asker should read. If people need different answers based on their own access, have each person connect with their own key instead.
- Keep a test set. Write down 20 real questions and the document each should cite. Run them after you change the instructions or reorganize playbooks, and check the citations, not just the wording.
- Fix the documents, not the prompt. When an answer is wrong, the cause is usually a missing or unclear document. Fix it in the app and every agent gets better at once.
- Watch the credits. Each search uses 1 AI credit; reads are free. Keep one search per question and let the agent read more documents rather than search again. Usage is under Admin → API.
Next
- Give coding agents your playbooks for the same pattern inside Claude Code, Cursor and Codex.
- Have agents keep docs current so gaps the agent finds get filled.