Skip to main content
command

gws-modelarmor-sanitize-response — Claude Code command

Sanitizes LLM outputs through Google Model Armor security templates using the gws CLI before delivering them to users.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --command google-workspace/gws-modelarmor-sanitize-response
Open on GitHub

What gws-modelarmor-sanitize-response does

This command runs outbound safety checks on generated model text via Google Model Armor. It requires the template resource path in the --template flag and accepts output content via --text or full payloads via --json.

The execution flow checks the gws binary, confirms authentication using gws auth status, and inspects method schema before triggering gws modelarmor +sanitize-response. Piped shell output can also feed directly into the tool.

Without a working gws CLI installation and verified credentials, execution fails immediately. Note that this specific command handles model-to-user safety rather than incoming user prompt inspection.

What it helps with

  • validate model output against a Google Model Armor template
  • pass raw output text or JSON payloads into safety filters
  • automate outbound LLM sanitization in command-line workflows

Example prompts for the agent

  • Sanitize this model output using template projects/P/locations/L/templates/T
  • Run /gws-modelarmor-sanitize-response on the generated JSON output
  • Filter model response text through gws modelarmor +sanitize-response --template <NAME>

How to install gws-modelarmor-sanitize-response

1claude-code-templates

npx claude-code-templates@latest --command google-workspace/gws-modelarmor-sanitize-response

2Manually: put the files in place

.claude/commands/gws-modelarmor-sanitize-response.md

Call it with /gws-modelarmor-sanitize-response. For all projects use ~/.claude/commands/

Questions about gws-modelarmor-sanitize-response

How to install gws-modelarmor-sanitize-response in Claude Code?

Run npx claude-code-templates@latest --command google-workspace/gws-modelarmor-sanitize-response in your terminal. This saves the command configuration to .claude/commands/gws-modelarmor-sanitize-response.md.

What does gws-modelarmor-sanitize-response do?

It submits generated text to Google Model Armor to detect policy violations and filter outbound responses before reaching the user.

How does sanitize-response differ from sanitize-prompt?

The sanitize-response command checks outbound model output. For inspecting incoming user input sent toward the model, use +sanitize-prompt instead.

Source text

gws-modelarmor-sanitize-response.md · MIT
---
allowed-tools: Bash, Read, Write, Edit
argument-hint: "[resource] [method] [flags]"
description: "Google Model Armor: Sanitize a model response through a Model Armor template."
---

# Google Workspace Modelarmor Sanitize Response

Execute Google Workspace Modelarmor Sanitize Response operations: $ARGUMENTS

## Prerequisites

- Google Workspace CLI (`gws`) must be installed
- Authentication configured: Run `gws auth status` to verify
- Review `gws modelarmor-sanitize-response --help` for all available commands

## Available Resources and Methods

# modelarmor +sanitize-response

> **PREREQUISITE:** Read `../gws-shared/SKILL.md` for auth, global flags, and security rules. If missing, run `gws generate-skills` to create it.

Sanitize a model response through a Model Armor template

## Usage

```bash
gws modelarmor +sanitize-response --template <NAME>
```

## Flags

| Flag | Required | Default | Description |
|------|----------|---------|-------------|
| `--template` | ✓ | — | Full template resource name (projects/PROJECT/locations/LOCATION/templates/TEMPLATE) |
| `--text` | — | — | Text content to sanitize |
| `--json` | — | — | Full JSON request body (overrides --text) |

## Examples

```bash
gws modelarmor +sanitize-response --template projects/P/locations/L/templates/T --text 'model output'
model_cmd | gws modelarmor +sanitize-response --template ...
```

## Tips

- Use for outbound safety (model -> user).
- For inbound safety (user -> model), use +sanitize-prompt.

## See Also

- [gws-shared](../gws-shared/SKILL.md) — Global flags and auth
- [gws-modelarmor](../gws-modelarmor/SKILL.md) — All filter user-generated content for safety commands

## Usage

```bash
# List available resources and methods
gws modelarmor-sanitize-response --help

# Inspect method schema before calling
gws schema modelarmor-sanitize-response.<resource>.<method>

# Execute command with arguments
gws modelarmor-sanitize-response $ARGUMENTS
```

## Task

Execute the requested Modelarmor Sanitize Response operation: $ARGUMENTS

1. **Verify Prerequisites**
   - Check `gws` is installed: `gws --version`
   - Verify authentication: `gws auth status`
   - Review available commands: `gws modelarmor-sanitize-response --help`

2. **Inspect Method Schema**
   - Before calling any method, inspect its parameters
   - Use `gws schema` to understand required fields
   - Review parameter types and constraints

3. **Execute Operation**
   - Build command with appropriate flags
   - Use `--params` for query/path parameters
   - Use `--json` for request body
   - Handle pagination with `--max-results` or `--page-token`

4. **Error Handling**
   - Check command output for errors
   - Review API quotas and rate limits
   - Handle authentication issues
   - Retry transient failures

---

**License**: Apache License 2.0
**Source**: [Google Workspace CLI](https://github.com/googleworkspace/cli)
**Original Skill**: `gws-modelarmor-sanitize-response`

© davila7 · MIT · davila7/claude-code-templates

Similar slash commands

All slash commands for Security →

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor