Skip to main content
Glama

disconnect_signal

Remove signal connections from Godot scene files to manage event handling and clean up node interactions in game development projects.

Instructions

Remove a signal connection from a .tscn scene file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneYesPath to the .tscn file
sourceYesSource node name
signalYesSignal name
targetYesTarget node name
methodYesHandler method name
expectedHashNoExpected content hash for stale-edit prevention

Implementation Reference

  • The implementation of the disconnect_signal tool, which includes schema definition, parsing, logic to find and remove a signal connection from a Godot .tscn file, and error handling.
    {
      name: "disconnect_signal",
      description: "Remove a signal connection from a .tscn scene file.",
      schema: {
        scene: z.string().describe("Path to the .tscn file"),
        source: z.string().describe("Source node name"),
        signal: z.string().describe("Signal name"),
        target: z.string().describe("Target node name"),
        method: z.string().describe("Handler method name"),
        expectedHash: z
          .string()
          .optional()
          .describe("Expected content hash for stale-edit prevention"),
      },
      handler: async (ctx) => {
        const {
          scene: scenePath,
          source: sourceNode,
          signal: signalName,
          target: targetNode,
          method,
          expectedHash,
        } = ctx.args;
        validatePath(scenePath);
    
        return withFileLock(scenePath, async () => {
          try {
            const { source, scene } = await readAndParse(scenePath);
            const hashErr = hashCheck(source, expectedHash);
            if (hashErr) return makeTextResponse({ error: hashErr, data: null });
    
            const idx = scene.signalConnections.findIndex(
              (c) =>
                c.signalName === signalName &&
                c.sourceNode === sourceNode &&
                c.targetNode === targetNode &&
                c.targetMethod === method,
            );
    
            if (idx === -1) {
              return makeTextResponse({
                error: `Connection not found: ${signalName} from ${sourceNode} to ${targetNode}::${method}`,
                data: null,
              });
            }
    
            scene.signalConnections.splice(idx, 1);
    
            await writeAndEmit(scenePath, scene, eventBus, ctx.signal);
    
            return makeTextResponse({
              data: {
                removed: {
                  signal: signalName,
                  from: sourceNode,
                  to: targetNode,
                  method,
                },
              },
              metadata: { source: "index" },
            });
          } catch (err) {
            return makeTextResponse({
              error: `Failed to disconnect signal: ${(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