script_delete
Remove a C# script from a Unity project by specifying the file path, streamlining script management and project organization.
Instructions
Delete a C# script from Unity project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the script file |
Implementation Reference
- src/tools/unity-mcp-tools.ts:353-364 (handler)Handler logic for the 'script_delete' tool in UnityMcpTools.executeTool: validates 'path' argument, delegates to adapter.deleteScript, and returns success response.case 'script_delete': { if (!args.path) { throw new Error('path is required'); } await this.adapter.deleteScript(args.path); return { content: [{ type: 'text', text: `Script deleted successfully: ${args.path}` }] }; }
- src/tools/unity-mcp-tools.ts:99-112 (schema)Tool definition including name, description, and input schema for 'script_delete' returned by UnityMcpTools.getTools().{ name: 'script_delete', description: 'Delete a C# script from Unity project', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the script file' } }, required: ['path'] } },
- src/simple-index.ts:35-37 (registration)MCP server registration: ListToolsRequestHandler returns the tools list from UnityMcpTools.getTools(), registering 'script_delete'.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: this.tools.getTools(), }));
- src/simple-index.ts:40-42 (registration)MCP server registration: CallToolRequestHandler delegates execution to UnityMcpTools.executeTool for tools including 'script_delete'.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { return this.tools.executeTool(request.params.name, request.params.arguments || {}); });
- Supporting method in UnityHttpAdapter that sends HTTP request to Unity server endpoint 'script/delete'.async deleteScript(path: string): Promise<any> { return this.call('script/delete', { path }); }