deployment_history
View and filter deployment history by network, contract name, or status, then export to JSON, CSV, or Markdown for tracking, auditing, and documentation.
Instructions
View deployment history with filtering and export.
FILTERS: By network, contract name, status EXPORTS: JSON, CSV, or Markdown format
USE FOR: Tracking deployments, auditing, documentation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | ||
| contractName | No | Filter by name | |
| limit | No | Max results (default: 20) | |
| exportFormat | No |
Implementation Reference
- src/tools/deploy.ts:196-268 (handler)The primary handler function implementing the deployment_history tool logic. It queries the deployment service for filtered records, applies pagination, supports multiple export formats (JSON, CSV, Markdown), handles errors, and returns a standardized ToolResult object.export async function deploymentHistory(args: { network?: HederaNetwork; contractName?: string; status?: 'pending' | 'deploying' | 'deployed' | 'failed' | 'verified'; limit?: number; offset?: number; exportFormat?: 'json' | 'csv' | 'markdown'; }): Promise<ToolResult> { try { const limit = args.limit || 20; const offset = args.offset || 0; const exportFormat = args.exportFormat || 'json'; logger.info('Fetching deployment history', { network: args.network, contractName: args.contractName, status: args.status, limit, offset, }); const records = deploymentService.getDeploymentHistory({ network: args.network, contractName: args.contractName, status: args.status, limit: limit + offset, // Get limit + offset to handle pagination }); // Apply offset const paginatedRecords = records.slice(offset, offset + limit); const totalCount = records.length; const hasMore = totalCount > offset + limit; let data: any = { deployments: paginatedRecords, pagination: { offset, limit, total: totalCount, returned: paginatedRecords.length, hasMore, }, }; // Format output if (exportFormat === 'csv') { const csv = convertToCSV(paginatedRecords); data = { csv, ...data.pagination }; } else if (exportFormat === 'markdown') { const markdown = convertToMarkdown(paginatedRecords); data = { markdown, ...data.pagination }; } return { success: true, data, metadata: { executedVia: 'deployment-service', command: 'deployment_history', }, }; } catch (error: any) { logger.error('Failed to fetch deployment history', { error: error.message }); return { success: false, error: error.message, metadata: { executedVia: 'deployment-service', command: 'deployment_history', }, }; } }
- src/index.ts:480-503 (schema)The input schema and tool definition for 'deployment_history' as registered in the MCP server's optimizedToolDefinitions array, used by listTools for validation and documentation.{ name: 'deployment_history', description: `View deployment history with filtering and export. FILTERS: By network, contract name, status EXPORTS: JSON, CSV, or Markdown format USE FOR: Tracking deployments, auditing, documentation.`, inputSchema: { type: 'object' as const, properties: { network: { type: 'string', enum: ['mainnet', 'testnet', 'previewnet'], }, contractName: { type: 'string', description: 'Filter by name' }, limit: { type: 'number', description: 'Max results (default: 20)' }, exportFormat: { type: 'string', enum: ['json', 'csv', 'markdown'], }, }, }, },
- src/index.ts:639-641 (registration)Registration in the MCP tool execution dispatcher (switch statement) that routes calls to the deployment_history tool to the imported deploymentHistory handler function.case 'deployment_history': result = await deploymentHistory(args as any); break;
- Key helper method in DeploymentService that filters, sorts by date (newest first), limits, and returns deployment records from persistent JSON storage. Called directly by the tool handler.getDeploymentHistory(filters?: { network?: HederaNetwork; contractName?: string; status?: DeploymentStatus; limit?: number; }): DeploymentRecord[] { let filtered = [...this.deploymentHistory]; if (filters?.network) { filtered = filtered.filter((r) => r.network === filters.network); } if (filters?.contractName) { filtered = filtered.filter((r) => r.contractName === filters.contractName); } if (filters?.status) { filtered = filtered.filter((r) => r.status === filters.status); } // Sort by most recent first filtered.sort((a, b) => new Date(b.deployedAt).getTime() - new Date(a.deployedAt).getTime()); if (filters?.limit) { filtered = filtered.slice(0, filters.limit); } return filtered; }