get_usdcode_help
Get expert assistance for Isaac Sim scripting, USD workflows, and Python API usage from NVIDIA's USDCode AI assistant to solve 3D graphics and simulation development challenges.
Instructions
Ask NVIDIA USDCode for help (Isaac Sim scripting, USD, Python/API tips).
Parameters: temperature (0-1, default 0.1), top_p (<=1, default 1), max_tokens (1-2048, default 1024), expert_type (auto|knowledge|code|helperfunction; default auto), stream (boolean; default false). Avoid changing temperature and top_p together.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes | Your prompt or question | |
| temperature | No | Sampling temperature (0-1). Default: 0.1 | |
| top_p | No | Top-p nucleus sampling mass (<=1). Default: 1 | |
| max_tokens | No | Max tokens to generate (1-2048). Default: 1024 | |
| expert_type | No | Expert to use: auto, knowledge, code, or helperfunction. Default: auto | |
| stream | No | Stream partial deltas via SSE. Default: false |
Implementation Reference
- src/server.ts:59-105 (handler)Async handler function that destructures input parameters, initializes OpenAI client for NVIDIA API, constructs the chat completion request to the USDCode model, handles both streaming and non-streaming responses by accumulating or extracting the generated text, and returns it in the expected MCP format.async (params: any) => { const { question, temperature = 0.1, top_p = 1, max_tokens = 1024, expert_type = "auto", stream = false, } = params ?? {}; const client = new OpenAI({ baseURL: "https://integrate.api.nvidia.com/v1", apiKey, }); // Build common request payload const request = { model: NVIDIA_MODEL, messages: [{ role: "user", content: question }], temperature, top_p, max_tokens, expert_type, } as any; let text = ""; if (stream) { // Handle streaming by accumulating deltas into a single string const s = await (client.chat.completions.create as any)({ ...request, stream: true, }); for await (const chunk of s as any) { const delta = chunk?.choices?.[0]?.delta?.content ?? ""; if (delta) text += String(delta); } if (!text) text = "No streamed content returned by USDCode."; } else { const completion = await (client.chat.completions.create as any)(request); text = completion.choices?.[0]?.message?.content?.toString() ?? "No content returned by USDCode."; } return { content: [{ type: "text", text }], }; }
- src/server.ts:33-58 (schema)Zod schema defining the input parameters: question (required string), and optional parameters for temperature, top_p, max_tokens, expert_type (enum), and stream (boolean).{ question: z.string().describe("Your prompt or question"), temperature: z .number() .optional() .describe("Sampling temperature (0-1). Default: 0.1"), top_p: z .number() .optional() .describe("Top-p nucleus sampling mass (<=1). Default: 1"), max_tokens: z .number() .int() .optional() .describe("Max tokens to generate (1-2048). Default: 1024"), expert_type: z .enum(["auto", "knowledge", "code", "helperfunction"]) // possible values per API .optional() .describe( "Expert to use: auto, knowledge, code, or helperfunction. Default: auto" ), stream: z .boolean() .optional() .describe("Stream partial deltas via SSE. Default: false"), },
- src/server.ts:30-106 (registration)Registration of the 'get_usdcode_help' tool on the MCP server, including name, description, input schema, and handler function.server.tool( "get_usdcode_help", "Ask NVIDIA USDCode for help (Isaac Sim scripting, USD, Python/API tips).\n\nParameters: temperature (0-1, default 0.1), top_p (<=1, default 1), max_tokens (1-2048, default 1024), expert_type (auto|knowledge|code|helperfunction; default auto), stream (boolean; default false). Avoid changing temperature and top_p together.", { question: z.string().describe("Your prompt or question"), temperature: z .number() .optional() .describe("Sampling temperature (0-1). Default: 0.1"), top_p: z .number() .optional() .describe("Top-p nucleus sampling mass (<=1). Default: 1"), max_tokens: z .number() .int() .optional() .describe("Max tokens to generate (1-2048). Default: 1024"), expert_type: z .enum(["auto", "knowledge", "code", "helperfunction"]) // possible values per API .optional() .describe( "Expert to use: auto, knowledge, code, or helperfunction. Default: auto" ), stream: z .boolean() .optional() .describe("Stream partial deltas via SSE. Default: false"), }, async (params: any) => { const { question, temperature = 0.1, top_p = 1, max_tokens = 1024, expert_type = "auto", stream = false, } = params ?? {}; const client = new OpenAI({ baseURL: "https://integrate.api.nvidia.com/v1", apiKey, }); // Build common request payload const request = { model: NVIDIA_MODEL, messages: [{ role: "user", content: question }], temperature, top_p, max_tokens, expert_type, } as any; let text = ""; if (stream) { // Handle streaming by accumulating deltas into a single string const s = await (client.chat.completions.create as any)({ ...request, stream: true, }); for await (const chunk of s as any) { const delta = chunk?.choices?.[0]?.delta?.content ?? ""; if (delta) text += String(delta); } if (!text) text = "No streamed content returned by USDCode."; } else { const completion = await (client.chat.completions.create as any)(request); text = completion.choices?.[0]?.message?.content?.toString() ?? "No content returned by USDCode."; } return { content: [{ type: "text", text }], }; } );