Skip to main content
SERV Tools are features you turn on or off by adding a specially named tool to an ordinary request. They are not functions the model calls: SERV detects any tool whose name begins with serv_, applies the corresponding feature, and removes the tool before the request reaches the model. Because every major client supports a tools array, the mechanism works identically across the OpenAI SDK, the Anthropic SDK, the Vercel AI SDK, and raw HTTP. There is no SERV-specific API to learn: if you can declare a tool, you can use SERV Tools.

How it works

  1. Declare the tool. Add any of serv_prompt_guard, serv_disable_content_filter, or serv_shadow_agent to the request’s tools array, in whatever tool format your SDK uses.
  2. Configure through schema defaults. When a SERV tool accepts options, you do not pass arguments at call time. Instead, set a default value on each parameter in the tool’s schema, and SERV reads that default as the configured setting.
  3. SERV handles it server-side. SERV removes every serv_* tool before the model runs, so these tools never appear as tool calls in the response, and they never interfere with tool_choice or the model’s own tool use.
SERV Tools coexist with your application’s own tools. You can include serv_prompt_guard, serv_disable_content_filter, serv_shadow_agent, and your function tools in the same tools array: SERV intercepts only the serv_* names and forwards the rest to the model unchanged.

Available tools

serv_prompt_guard

Include serv_prompt_guard to protect your system prompt against injection-based leakage — attempts in user input to make the model reveal or override your instructions. The guard is opt-in: it runs only on requests that declare the tool. Declaring it by name is sufficient; no description or parameters are required.

serv_disable_content_filter

SERV runs a content filter on every request by default. It inspects the model’s output and blocks responses that would reveal your system prompt or other hidden instructions, so protection against instruction leakage is on out of the box. You don’t declare a tool to get it. Include serv_disable_content_filter to turn that default protection off for a request. As with the other SERV Tools, declaring it by name is enough; it takes no parameters. This is a SERV Tool that disables a default behavior rather than enabling an opt-in one. Disable the filter when your application wants the model to be able to quote or explain its own instructions. Common cases: a transparency or debugging mode, or a prompt where reproducing part of the system message is the intended output and the filter would otherwise flag it as a false positive.
With the content filter disabled, SERV no longer prevents the model from echoing your system prompt in its response. Only send serv_disable_content_filter on requests where revealing those instructions is acceptable.
The content filter and serv_prompt_guard are independent. The content filter is the always-on baseline that keeps your system prompt from leaking into output; serv_prompt_guard is an opt-in, stronger defense against prompt-injection attacks that try to override or extract your instructions. Disabling the content filter does not affect serv_prompt_guard, and vice versa.

serv_shadow_agent

Include serv_shadow_agent to run a validation loop over the model’s output. By default, the shadow agent evaluates whether the response is a meaningful, valid answer to the request. If it is not, the agent asks the model to revise its answer and validates again, repeating until the output passes or the iteration limit is reached. If no attempt passes, the output is marked as a failed output. Because it trades additional inference for higher accuracy on difficult tasks, the shadow agent is opt-in.

Parameters

Both parameters are optional. Set each one by assigning it a default in the tool’s schema; SERV uses that default as the value.
To run the shadow agent with its defaults — the meaningful-and-valid check and max_iterations: 3 — declare it by name with no parameters, exactly as with serv_prompt_guard above.
Vercel AI SDK versions. The inputSchema field shown here is AI SDK v5; on v4, use parameters instead. In both versions, the jsonSchema helper lets you set default directly, which is what SERV reads.

Combining tools

SERV Tools and your own tools share a single array. In this example, both SERV features run while get_quote is forwarded to the model as an ordinary callable tool:
OpenAI SDK
SERV intercepts serv_prompt_guard and serv_shadow_agent, then forwards only get_quote to the model.

See also