list-templates
Browse available GPU instance templates for Novita AI platform, filtering by type and channel to find suitable configurations.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list-templates"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageSize | No | Number of templates to return in each page | |
| pageNum | No | Page number to return, start from 1 | |
| type | No | Type of template to return | |
| channel | No | Channels of template to return |
Implementation Reference
- src/tools.ts:304-326 (handler)The handler function for the 'list-templates' tool. It constructs query parameters based on input params (pageSize, pageNum, type, channel), makes an API request to '/templates' endpoint using novitaRequest, and returns the result as a formatted text content block.
}, async (params) => { const queryParams = new URLSearchParams(); if (params.pageSize) queryParams.append("pageSize", params.pageSize.toString()); if (params.pageNum) queryParams.append("pageNum", params.pageNum.toString()); if (params.type) queryParams.append("type", params.type); if (params.channel) queryParams.append("channel", params.channel.join(",")); const queryString = queryParams.toString() ? `?${queryParams.toString()}` : ""; const result = await novitaRequest(`/templates${queryString}`); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }); - src/tools.ts:283-303 (schema)Zod schema defining input parameters for the 'list-templates' tool: pagination (pageSize, pageNum), filtering by type (instance/serverless) and channel (private/community/official).
pageSize: z .number() .min(0) .default(20) .optional() .describe("Number of templates to return in each page"), pageNum: z .number() .min(0) .default(1) .optional() .describe("Page number to return, start from 1"), type: z .enum(["instance", "serverless"]) .optional() .describe("Type of template to return"), channel: z .enum(["private", "community", "official"]) .array() .optional() .describe("Channels of template to return"), - src/tools.ts:282-326 (registration)Registration of the 'list-templates' MCP tool using server.tool(), including input schema and inline handler implementation within registerTemplateTools function.
server.tool("list-templates", { pageSize: z .number() .min(0) .default(20) .optional() .describe("Number of templates to return in each page"), pageNum: z .number() .min(0) .default(1) .optional() .describe("Page number to return, start from 1"), type: z .enum(["instance", "serverless"]) .optional() .describe("Type of template to return"), channel: z .enum(["private", "community", "official"]) .array() .optional() .describe("Channels of template to return"), }, async (params) => { const queryParams = new URLSearchParams(); if (params.pageSize) queryParams.append("pageSize", params.pageSize.toString()); if (params.pageNum) queryParams.append("pageNum", params.pageNum.toString()); if (params.type) queryParams.append("type", params.type); if (params.channel) queryParams.append("channel", params.channel.join(",")); const queryString = queryParams.toString() ? `?${queryParams.toString()}` : ""; const result = await novitaRequest(`/templates${queryString}`); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; });