Skip to main content
Glama

Generate text with OpenAI

openai_generate_text

Generate text with an OpenAI model through the Responses API and control output with system instructions, reasoning effort, JSON mode, and multi-turn chaining.

Instructions

Generate text with an OpenAI model through the Responses API — OpenAI's current interface for single-turn and chained generation.

Use this as the default text tool. It supports plain prompting, system instructions, reasoning effort control, forced JSON output and multi-turn chaining via previous_response_id.

Args:

  • input (string, required): the prompt

  • model (string): model ID, defaults to OPENAI_DEFAULT_TEXT_MODEL

  • instructions (string): system-level steering

  • max_output_tokens (number): 1-200000

  • temperature (number): 0-2

  • top_p (number): 0-1

  • reasoning_effort ('minimal'|'low'|'medium'|'high'): effort for reasoning models

  • json_object (boolean): force a valid JSON object as output (default false)

  • previous_response_id (string): continue an earlier stored response

  • store (boolean): persist the response for later chaining (default false)

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

Returns (JSON format): { "id": string, // response ID, usable as previous_response_id when store=true "model": string, // model that actually served the request "status": string | null, // e.g. "completed" or "incomplete" "output_text": string, // the generated text "usage": { "input_tokens": number|null, "output_tokens": number|null, "total_tokens": number|null } }

Examples:

  • Use when: "Summarise this contract clause" -> input=, instructions="Answer in German, max 3 sentences"

  • Use when: "Give me the result as JSON" -> json_object=true

  • Use when: continuing a stored conversation -> previous_response_id="resp_..."

  • Don't use when: you need to send an existing multi-message history verbatim (use openai_chat_completion)

Error Handling:

  • "Error: Not found" means the model ID does not exist for this key — call openai_list_models

  • "Error: Rate limit or quota exceeded" means retry later or lower the request rate

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe prompt sent to the model
modelNoModel ID, e.g. "gpt-5.6-sol". Defaults to OPENAI_DEFAULT_TEXT_MODEL. Call openai_list_models for the IDs this key can use.
storeNoPersist the response on OpenAI servers so it can be referenced via previous_response_id
top_pNoNucleus sampling cutoff; use either temperature or top_p, not both
json_objectNoForce the model to emit a syntactically valid JSON object
temperatureNoSampling temperature, 0 = deterministic, 2 = very random
instructionsNoSystem-level instructions that steer tone, role and constraints
response_formatNoOutput format: 'markdown' for a readable summary, 'json' for the full structured payloadmarkdown
reasoning_effortNoHow much internal reasoning a reasoning model should spend
max_output_tokensNoUpper bound on generated tokens
previous_response_idNoID of a previous response to continue from; requires that the earlier call used store=true

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
modelYes
usageYes
statusYes
output_textYes

Schema Changelog

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

  1. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, but the description goes beyond by disclosing the exact response shape, store=true prerequisite for chaining, error handling for model-not-found and rate-limit cases, and the reasoning-effort option. It also warns that temperature and top_p are mutually exclusive in the schema description, which is beyond structured data.

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

Conciseness4/5

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

Well-structured with clear sections (Description, Args, Returns, Examples, Error Handling), front-loaded with the key role. Slightly long but every section adds value; no filler. The Args section repeats schema info which is a minor redundancy given 100% schema coverage.

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?

Given 11 parameters, an output schema, and read/write annotations, the description fully covers usage: when to use, what result looks like, error handling, and the chaining prerequisite. Nothing an agent needs to invoke it correctly is missing.

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

Parameters4/5

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

The schema covers all 11 parameters at 100%, so the description's param list mostly restates what the schema already documents. However it adds clarification that json_object forces valid JSON and notes the output format nuances (markdown vs json payload) that go beyond schema lines. With high schema coverage, the description's param details add marginal value; I credit the clear examples and error-handling mapping that clarify semantics.

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?

We still have an explanation that after scoring format, but the argument is em empty. Describing the purpose of the empty "openai_generate_text" and "openai_generate_text" is an empty description that explains the purpose of generate_text. "Generate text with an OpenAI model through the Responses API" is a clear verb+resource description that distinguishes it from the sibling openai_chat_completion by naming its interface (Responses API) and scope (single-turn and chained generation). The description also explicitly states its role as the default text tool, which differentiates it from siblings.

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?

Explicitly says 'Use this as the default text tool' and gives four usage examples with conditions (including don't-use: use openai_chat_completion for verbatim message history). This is strong usage guidance that prevents both misuse and false negatives.

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