get_last_run
Retrieve results and metadata from the most recent pipeline execution, including task outcomes, duration, and completion status.
Instructions
Get results and metadata from the most recent devpipe run, including task results, duration, and success status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | No | Path to config.toml file to determine output directory |
Implementation Reference
- src/index.ts:413-449 (handler)Main handler for 'get_last_run' tool: finds config, output dir, last run dir, reads metadata and summary, returns JSON.case 'get_last_run': { const configPath = args?.config || await findConfigFile(); if (!configPath) { throw new Error('No config.toml file found'); } const config = await parseConfig(configPath); const outputDir = getOutputDir(configPath, config); const lastRunDir = await getLastRunDir(outputDir); if (!lastRunDir) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'No previous runs found' }, null, 2), }, ], }; } const metadata = await readRunMetadata(lastRunDir); const summary = await readSummary(outputDir); return { content: [ { type: 'text', text: JSON.stringify({ runDirectory: lastRunDir, metadata, summary, }, null, 2), }, ], }; }
- src/index.ts:157-168 (registration)Tool registration in ListToolsRequestSchema handler, including name, description, and input schema.name: 'get_last_run', description: 'Get results and metadata from the most recent devpipe run, including task results, duration, and success status.', inputSchema: { type: 'object', properties: { config: { type: 'string', description: 'Path to config.toml file to determine output directory', }, }, }, },
- src/index.ts:159-168 (schema)Input schema definition for 'get_last_run' tool.inputSchema: { type: 'object', properties: { config: { type: 'string', description: 'Path to config.toml file to determine output directory', }, }, }, },
- src/utils.ts:75-100 (helper)Core helper function that finds and returns the path to the most recent devpipe run directory by scanning outputDir/runs/ and sorting directories.export async function getLastRunDir(outputDir: string): Promise<string | null> { try { const runsDir = join(outputDir, 'runs'); const entries = await readdir(runsDir); // Filter for directories and sort by name (timestamp-based) const runDirs = []; for (const entry of entries) { const fullPath = join(runsDir, entry); const stats = await stat(fullPath); if (stats.isDirectory()) { runDirs.push({ name: entry, path: fullPath }); } } if (runDirs.length === 0) { return null; } // Sort descending (most recent first) runDirs.sort((a, b) => b.name.localeCompare(a.name)); return runDirs[0].path; } catch (error) { return null; } }