Skip to main content
Glama
bsmi021

Node Omnibus MCP Server

by bsmi021

create_type_definition

Generate TypeScript type definitions or interfaces by specifying type name, file path, and properties. Simplify development with automated type creation for Node.js projects.

Instructions

Create TypeScript type definitions or interfaces

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesType name
pathYesFile path
propertiesYesType properties and their types

Implementation Reference

  • The handler function that validates the path, generates a TypeScript interface from the provided properties, writes it to a .ts file, and returns success message or throws error.
    private async handleCreateTypeDefinition(args: CreateTypeDefinitionArgs) { await this.validatePath(args.path); const typeContent = `export interface ${args.name} { ${Object.entries(args.properties) .map(([key, type]) => `${key}: ${type};`) .join('\n ')} } `; const filePath = path.join(args.path, `${args.name}.ts`); try { await fs.writeFile(filePath, typeContent); return { content: [ { type: 'text', text: `Type definition ${args.name} created successfully at ${filePath}`, }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to create type definition: ${error instanceof Error ? error.message : String(error)}` ); } }
  • src/index.ts:301-323 (registration)
    Registers the 'create_type_definition' tool in the MCP server with its description and input schema defining name, path, and properties.
    { name: 'create_type_definition', description: 'Create TypeScript type definitions or interfaces', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Type name', }, path: { type: 'string', description: 'File path', }, properties: { type: 'object', description: 'Type properties and their types', additionalProperties: { type: 'string' }, }, }, required: ['name', 'path', 'properties'], }, },
  • TypeScript interface defining the expected arguments for the create_type_definition handler.
    interface CreateTypeDefinitionArgs extends Record<string, unknown> { name: string; path: string; properties: Record<string, string>; }
  • Switch case in the main tool request handler that dispatches to the specific create_type_definition handler.
    case 'create_type_definition': return await this.handleCreateTypeDefinition(args as CreateTypeDefinitionArgs);

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bsmi021/mcp-node-omnibus-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server