Skip to main content
Glama
bsmi021

Node Omnibus MCP Server

by bsmi021

create_type_definition

Generate TypeScript type definitions or interfaces by specifying name, file path, and properties to structure your Node.js project's data types.

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 implements the create_type_definition tool by generating and writing a TypeScript interface file based on the provided name, path, and properties.
    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)}` ); } }
  • TypeScript interface defining the input arguments for the create_type_definition tool.
    interface CreateTypeDefinitionArgs extends Record<string, unknown> { name: string; path: string; properties: Record<string, string>; }
  • src/index.ts:301-323 (registration)
    Registration of the create_type_definition tool in the ListToolsRequestSchema response, including its input schema.
    { 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'], }, },
  • src/index.ts:401-402 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes to the create_type_definition handler.
    case 'create_type_definition': return await this.handleCreateTypeDefinition(args as CreateTypeDefinitionArgs);

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