Home / Servers / OpenAI API / create_thread_and_run

Create thread and run

An MCP tool from the OpenAI API server, hosted on mcp.hjlabs.in.

Create thread and run Create a thread and run it in one request. [POST /threads/runs]

Name on the gateway: openai_api__create_thread_and_run · may change things.

Parameters

NameTypeDescription
assistant_id requiredstringThe ID of the assistant to use to execute this run.
threadobjectOptions to create a new thread. If no thread is provided when running a…
modelstringThe ID of the Model to be used to execute this run. If a value is provided…
instructionsstringOverride the default system message of the assistant. This is useful for…
toolsarrayOverride the tools the assistant can use for this run. This is useful for…
tool_resourcesobjectA set of resources that are used by the assistant's tools. The resources are…
metadataobjectSet of 16 key-value pairs that can be attached to an object. This can be…
temperaturenumberWhat sampling temperature to use, between 0 and 2. Higher values like 0.8 will…
top_pnumberAn alternative to sampling with temperature, called nucleus sampling, where…
streambooleanIf true, returns a stream of events that happen during the Run as server-sent…
max_prompt_tokensintegerThe maximum number of prompt tokens that may be used over the course of the…
max_completion_tokensintegerThe maximum number of completion tokens that may be used over the course of…
truncation_strategyobjectControls for how a thread will be truncated prior to the run. Use this to…
tool_choiceobjectControls which (if any) tool is called by the model. none means the model will…
parallel_tool_callsbooleanWhether to enable parallel function calling during tool use.
response_formatobjectSpecifies the format that the model must output. Compatible with GPT-4o, GPT-4…

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "openai_api__create_thread_and_run",
  "arguments": {
    "assistant_id": "…"
  }
}

Or connect the OpenAI API server directly, which lists 371 tools including this one:

Run in your terminal
claude mcp add --transport http hj-openai-api https://mcp.hjlabs.in/mcp/openai-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the create thread and run tool with assistant_id set to ….

More from OpenAI API