get-results
Retrieve output data from the most recent script executed in Adobe After Effects using MCP server integration, streamlining post-processing workflows.
Instructions
Get results from the last script executed in After Effects
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:282-309 (registration)Registration of the "get-results" MCP tool, including the inline async handler function and empty input schema ({}).server.tool( "get-results", "Get results from the last script executed in After Effects", {}, async () => { try { const result = readResultsFromTempFile(); return { content: [ { type: "text", text: result } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting results: ${String(error)}` } ], isError: true }; } } );
- src/index.ts:286-307 (handler)Inline handler function for the "get-results" tool that calls readResultsFromTempFile() to retrieve results and returns them as text content, with error handling.async () => { try { const result = readResultsFromTempFile(); return { content: [ { type: "text", text: result } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting results: ${String(error)}` } ], isError: true }; }
- src/index.ts:87-123 (helper)Helper function readResultsFromTempFile() that reads the 'ae_mcp_result.json' file from the system temp directory, checks if it's stale (older than 30s), logs debug info, and returns the content as string or error/warning JSON.function readResultsFromTempFile(): string { try { const tempFilePath = path.join(process.env.TEMP || process.env.TMP || '', 'ae_mcp_result.json'); // Add debugging info console.error(`Checking for results at: ${tempFilePath}`); if (fs.existsSync(tempFilePath)) { // Get file stats to check modification time const stats = fs.statSync(tempFilePath); console.error(`Result file exists, last modified: ${stats.mtime.toISOString()}`); const content = fs.readFileSync(tempFilePath, 'utf8'); console.error(`Result file content length: ${content.length} bytes`); // If the result file is older than 30 seconds, warn the user const thirtySecondsAgo = new Date(Date.now() - 30 * 1000); if (stats.mtime < thirtySecondsAgo) { console.error(`WARNING: Result file is older than 30 seconds. After Effects may not be updating results.`); return JSON.stringify({ warning: "Result file appears to be stale (not recently updated).", message: "This could indicate After Effects is not properly writing results or the MCP Bridge Auto panel isn't running.", lastModified: stats.mtime.toISOString(), originalContent: content }); } return content; } else { console.error(`Result file not found at: ${tempFilePath}`); return JSON.stringify({ error: "No results file found. Please run a script in After Effects first." }); } } catch (error) { console.error("Error reading results file:", error); return JSON.stringify({ error: `Failed to read results: ${String(error)}` }); } }