Skip to main content
Glama
bsmi021

Node Omnibus MCP Server

by bsmi021

update_tsconfig

Modify TypeScript compiler settings in a project directory to configure build behavior and development environment.

Instructions

Update TypeScript configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesProject directory path
optionsYesTypeScript compiler options

Implementation Reference

  • The handler function that reads (or creates) tsconfig.json, merges the provided options into compilerOptions, writes it back, and returns a success message. Uses validatePath helper.
    private async handleUpdateTsConfig(args: UpdateTsConfigArgs) {
        await this.validatePath(args.path);
    
        try {
            const tsconfigPath = path.join(args.path, 'tsconfig.json');
            interface TsConfig {
                compilerOptions: Record<string, unknown>;
                include?: string[];
                exclude?: string[];
            }
            let tsconfig: TsConfig = {
                compilerOptions: {}
            };
    
            try {
                tsconfig = JSON.parse(await fs.readFile(tsconfigPath, 'utf-8')) as TsConfig;
            } catch {
                // Create new tsconfig if it doesn't exist
                tsconfig = {
                    compilerOptions: {},
                    include: ["src/**/*"],
                    exclude: ["node_modules", "dist"]
                };
            }
    
            // Deep merge the new options
            tsconfig.compilerOptions = {
                ...tsconfig.compilerOptions,
                ...args.options,
            };
    
            await fs.writeFile(tsconfigPath, JSON.stringify(tsconfig, null, 2));
    
            return {
                content: [
                    {
                        type: 'text',
                        text: `Updated TypeScript configuration at ${tsconfigPath}`,
                    },
                ],
            };
        } catch (error) {
            throw new McpError(
                ErrorCode.InternalError,
                `Failed to update TypeScript configuration: ${error instanceof Error ? error.message : String(error)}`
            );
        }
    }
  • src/index.ts:346-364 (registration)
    The tool registration in ListToolsRequestSchema, defining name, description, and inputSchema for MCP tool listing.
    {
        name: 'update_tsconfig',
        description: 'Update TypeScript configuration',
        inputSchema: {
            type: 'object',
            properties: {
                path: {
                    type: 'string',
                    description: 'Project directory path',
                },
                options: {
                    type: 'object',
                    description: 'TypeScript compiler options',
                    additionalProperties: true,
                },
            },
            required: ['path', 'options'],
        },
    },
  • TypeScript interface defining the arguments for the update_tsconfig handler.
    interface UpdateTsConfigArgs extends Record<string, unknown> {
        path: string;
        options: Record<string, unknown>;
    }
  • src/index.ts:405-406 (registration)
    The switch case in CallToolRequestSchema handler that routes to the specific tool handler.
    case 'update_tsconfig':
        return await this.handleUpdateTsConfig(args as UpdateTsConfigArgs);
  • Local interface used within the handler for typing the tsconfig.json structure.
    interface TsConfig {
        compilerOptions: Record<string, unknown>;
        include?: string[];
        exclude?: string[];
    }

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