Skip to main content
Glama

create_file

Create new files with specified content in Godot projects to manage game development assets and trigger automatic indexing updates.

Instructions

Create a new file with the given content. Triggers index update.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath for the new file
contentYesFile content

Implementation Reference

  • The handler for the 'create_file' tool, which creates a file and emits a file:changed event.
      name: "create_file",
      description: "Create a new file with the given content. Triggers index update.",
      schema: {
        path: z.string().describe("Path for the new file"),
        content: z.string().describe("File content"),
      },
      handler: async (ctx) => {
        const { path, content } = ctx.args;
        validatePath(path);
        try {
          const dir = dirname(path);
          if (!existsSync(dir)) {
            mkdirSync(dir, { recursive: true });
          }
    
          writeFileSync(path, content, "utf-8");
    
          await eventBus.emit("file:changed", {
            path,
            type: "created",
          });
    
          return makeTextResponse({
            data: { path, size: content.length },
            metadata: { source: "fallback" },
          });
        } catch (err) {
          return makeTextResponse({
            error: `Failed to create file: ${(err as Error).message}`,
            data: null,
          });
        }
      },
    },

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/woohq/godette-mcp'

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