get_usdcode_help
Get expert assistance for Isaac Sim scripting, USD workflows, and Python API usage from NVIDIA's USDCode AI assistant to support 3D graphics and simulation development.
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 |
|---|---|---|---|
| expert_type | No | Expert to use: auto, knowledge, code, or helperfunction. Default: auto | |
| max_tokens | No | Max tokens to generate (1-2048). Default: 1024 | |
| question | Yes | Your prompt or question | |
| stream | No | Stream partial deltas via SSE. Default: false | |
| temperature | No | Sampling temperature (0-1). Default: 0.1 | |
| top_p | No | Top-p nucleus sampling mass (<=1). Default: 1 |
Implementation Reference
- src/server.ts:59-105 (handler)The handler function that executes the tool: extracts parameters, calls NVIDIA USDCode model via OpenAI client (with optional streaming), and returns the generated text as MCP content.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:34-58 (schema)Zod input schema defining parameters: required 'question', optional 'temperature', 'top_p', 'max_tokens', 'expert_type', 'stream'.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)MCP server.tool() registration of the 'get_usdcode_help' tool, 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 }], }; } );