Skip to main content
Glama

Moderate content with OpenAI

openai_moderate_content
Read-onlyIdempotent

Check any text against OpenAI's moderation policy and get flagged categories with confidence scores, so you can reject or review unsafe content before publishing or forwarding user input.

Instructions

Check text against OpenAI's moderation policy and report which categories it triggers.

Use this before publishing or forwarding user-supplied text, or to explain why a generation was refused.

Args:

  • input (string, required): the text to check

  • model (string): moderation model ID, defaults to OPENAI_DEFAULT_MODERATION_MODEL

  • response_format ('markdown'|'json'): default 'markdown'

Returns (JSON format): { "model": string, "flagged": boolean, // true when any category was triggered "flagged_categories": string[], // e.g. ["violence", "harassment/threatening"] "scores": { "": number } // confidence per category, 0.0-1.0 }

Examples:

  • Use when: "Is this user comment acceptable?" -> input=

  • Use when: auditing a batch of support messages before archiving them

  • Don't use when: you need a stylistic or factual review (use openai_generate_text)

Error Handling:

  • "Error: Not found" means the moderation model ID is wrong — call openai_list_models with filter="moderation"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe text to check
modelNoModeration model ID. Defaults to OPENAI_DEFAULT_MODERATION_MODEL.
response_formatNoOutput format: 'markdown' or 'json'markdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYes
scoresYes
flaggedYes
flagged_categoriesYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.0.0

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is covered. The description adds useful behavioral context: error handling for invalid model IDs, the returned JSON shape, and the meaning of the 'flagged' field. This goes beyond what annotations alone provide, though it doesn't discuss rate limits, latency, or auth requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well organized with clear sections: purpose, usage guidance, arguments, return format, examples, and error handling. The most important information is front-loaded, and each section serves a distinct purpose without unnecessary fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is fully self-contained for effective use. It covers the tool's purpose, when to use it, when not to use it, parameter defaults, return format, example use cases, and a common error scenario. With output schema, annotations, and full schema coverage, nothing critical is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters. The description mostly restates the same information, such as defaults for model and response_format. It adds minor practical context through examples but does not fundamentally expand parameter understanding beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb and resource: 'Check text against OpenAI's moderation policy and report which categories it triggers.' It also distinguishes itself from siblings by explicitly saying not to use it for stylistic or factual review, which prevents confusion with openai_generate_text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use guidance: before publishing or forwarding user-supplied text, and to explain why a generation was refused. It also gives concrete examples and names the alternative tool to use when moderation is not the need, making the decision boundary very clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/piorkowskim79/openai-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server