new_heim_application
Generate backend applications from OpenAPI 3.0.1 specifications using Rust or CSharp. Specify paths, language, and version to create project folders and configuration files efficiently.
Instructions
Runs 'heim new' command on your local computer to create application schafholding from an OpenAPI 3.0.1 specification.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| basePath | No | The base path added bafore the path in the OpenAPI schema. Defaults to not adding a base path. | / |
| language | Yes | The programming language you want to use for creating an application from an OpenAPI specification. Currently Rust and CSharp are supported. | |
| name | Yes | The name of the application. This will be used to name the application folder and set the name in the application.toml file. | |
| openApiPath | Yes | Absolute windows path to OpenAPI file. The schema requires operationId and a full list of what Heim supports of the OpenAPI schema can be found here: https://cloud.heim.dev/heim/docs/templates/openapi/#openapi-root-object | |
| overwrite | No | Should the new application overwrite an existing folder if it already exists? Defaults to `false`. | |
| path | Yes | Absolute windows path to the folder where the project should be created. The created project will be under this path with a folder name called 'name'. The code to modify will be under <PATH>/<NAME>/src/ and the heim folder within shouldn't be modified. | |
| version | No | The version number it will set for the application in SemVer format. Defaults to `0.1.0`. | 0.1.0 |
Implementation Reference
- src/tools.ts:61-94 (handler)The handler function that runs the 'heim new' command to scaffold a new Heim application from an OpenAPI specification, then builds the generated project using Cargo (for Rust) or dotnet (for C#).async (request) => { const execPromise = util.promisify(exec); try { const { stdout, stderr } = await execPromise( `heim new --path ${request.path} --spec ${ request.openApiPath } --name ${request.name} --version ${request.version} --language ${ request.language } --base-path ${request.basePath} ${ request.overwrite ? "--force" : "" }` ); const output2 = await execPromise( request.language == "rust" ? `cargo build --manifest-path ${request.path}/${request.name}/Cargo.toml --target wasm32-wasip2` : `dotnet build ${request.path}/${request.name}/${request.name}.csproj` ); return { content: [ { type: "text", text: `new stdout:\n${stdout}\nbuild stdout:${output2.stdout}\nnew stderr:\n${stderr}\nbuild stdout:${output2.stdout}`, }, ], }; } catch (err: any) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true, }; } }
- src/tools.ts:14-53 (schema)Zod-based input schema defining parameters for the 'new_heim_application' tool: path, openApiPath, name, language (rust/csharp), version, basePath, overwrite.inputSchema: { path: z .string() .describe( "Absolute windows path to the folder where the project should be created. The created project will be under this path with a folder name called 'name'. The code to modify will be under <PATH>/<NAME>/src/ and the heim folder within shouldn't be modified." ), openApiPath: z .string() .describe( "Absolute windows path to OpenAPI file. The schema requires operationId and a full list of what Heim supports of the OpenAPI schema can be found here: https://cloud.heim.dev/heim/docs/templates/openapi/#openapi-root-object" ), name: z .string() .describe( "The name of the application. This will be used to name the application folder and set the name in the application.toml file." ), language: z .union([z.literal("rust"), z.literal("csharp")]) .describe( "The programming language you want to use for creating an application from an OpenAPI specification. Currently Rust and CSharp are supported." ), version: z .string() .default("0.1.0") .describe( "The version number it will set for the application in SemVer format. Defaults to `0.1.0`." ), basePath: z .string() .default("/") .describe( "The base path added bafore the path in the OpenAPI schema. Defaults to not adding a base path." ), overwrite: z .boolean() .default(false) .describe( "Should the new application overwrite an existing folder if it already exists? Defaults to `false`." ), },
- src/tools.ts:8-95 (registration)Registration of the 'new_heim_application' tool using server.registerTool, including title, description, inputSchema, annotations, and handler function.server.registerTool( "new_heim_application", { title: "New Heim Application", description: "Runs 'heim new' command on your local computer to create application schafholding from an OpenAPI 3.0.1 specification.", inputSchema: { path: z .string() .describe( "Absolute windows path to the folder where the project should be created. The created project will be under this path with a folder name called 'name'. The code to modify will be under <PATH>/<NAME>/src/ and the heim folder within shouldn't be modified." ), openApiPath: z .string() .describe( "Absolute windows path to OpenAPI file. The schema requires operationId and a full list of what Heim supports of the OpenAPI schema can be found here: https://cloud.heim.dev/heim/docs/templates/openapi/#openapi-root-object" ), name: z .string() .describe( "The name of the application. This will be used to name the application folder and set the name in the application.toml file." ), language: z .union([z.literal("rust"), z.literal("csharp")]) .describe( "The programming language you want to use for creating an application from an OpenAPI specification. Currently Rust and CSharp are supported." ), version: z .string() .default("0.1.0") .describe( "The version number it will set for the application in SemVer format. Defaults to `0.1.0`." ), basePath: z .string() .default("/") .describe( "The base path added bafore the path in the OpenAPI schema. Defaults to not adding a base path." ), overwrite: z .boolean() .default(false) .describe( "Should the new application overwrite an existing folder if it already exists? Defaults to `false`." ), }, annotations: { destructiveHint: false, readOnlyHint: false, idempotentHint: false, openWorldHint: false, }, }, async (request) => { const execPromise = util.promisify(exec); try { const { stdout, stderr } = await execPromise( `heim new --path ${request.path} --spec ${ request.openApiPath } --name ${request.name} --version ${request.version} --language ${ request.language } --base-path ${request.basePath} ${ request.overwrite ? "--force" : "" }` ); const output2 = await execPromise( request.language == "rust" ? `cargo build --manifest-path ${request.path}/${request.name}/Cargo.toml --target wasm32-wasip2` : `dotnet build ${request.path}/${request.name}/${request.name}.csproj` ); return { content: [ { type: "text", text: `new stdout:\n${stdout}\nbuild stdout:${output2.stdout}\nnew stderr:\n${stderr}\nbuild stdout:${output2.stdout}`, }, ], }; } catch (err: any) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true, }; } } );