query_sign_flow
Retrieve detailed status and progress information for electronic signature workflows using the flow ID.
Instructions
Query sign flow details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flowId | Yes | Sign flow ID |
Implementation Reference
- src/index.ts:675-718 (handler)Main handler for 'query_sign_flow' tool in the CallToolRequestSchema switch statement. Extracts flowId, calls getSignFlowDetail, formats status and times, and returns formatted details or error.case "query_sign_flow": { try { const args = request.params.arguments as { flowId: string }; const detail = await getSignFlowDetail(args.flowId); const statusMap: Record<number, string> = { 0: "草稿", 1: "签署中", 2: "完成", 3: "撤销", 5: "过期", 7: "拒签" }; const formatTime = (timestamp: number | null) => { if (!timestamp) return "未完成"; return new Date(timestamp).toLocaleString(); }; return { content: [{ type: "text", text: `签署流程详情: 状态:${statusMap[detail.signFlowStatus] || "未知"} (${detail.signFlowDescription}) 创建时间:${formatTime(detail.signFlowCreateTime)} 开始时间:${formatTime(detail.signFlowStartTime)} 完成时间:${formatTime(detail.signFlowFinishTime)} 文档:${detail.docs.map(doc => doc.fileName).join(", ")} 签署人:${detail.signers.map(signer => signer.psnSigner ? `${signer.psnSigner.psnName} (${signer.psnSigner.psnAccount.accountMobile})` : "企业签署" ).join(", ")}` }] }; } catch (err: any) { return { content: [{ type: "text", text: `Error: ${err.message}` }] }; } }
- src/index.ts:189-200 (schema)Input schema definition for 'query_sign_flow' tool, requiring 'flowId' string.name: "query_sign_flow", description: "Query sign flow details", inputSchema: { type: "object", properties: { flowId: { type: "string", description: "Sign flow ID" } }, required: ["flowId"] }
- src/index.ts:188-201 (registration)Tool registration in ListToolsRequestSchema response, defining name, description, and input schema.{ name: "query_sign_flow", description: "Query sign flow details", inputSchema: { type: "object", properties: { flowId: { type: "string", description: "Sign flow ID" } }, required: ["flowId"] } }
- src/index.ts:572-586 (helper)Helper function that queries the eSign API for sign flow details using the provided flowId.async function getSignFlowDetail(flowId: string): Promise<SignFlowDetailResponse> { const requestPath = `/v3/sign-flow/${flowId}/detail`; const headers = getCommonHeaders('GET', requestPath, 'application/json; charset=UTF-8'); const response = await fetch(`${config.host}${requestPath}`, { method: 'GET', headers: headers }); const result = await response.json() as ApiResponse<SignFlowDetailResponse>; if (result.code === 0) { return result.data; } throw new Error(`Failed to get sign flow detail: ${result.message}`); }
- src/index.ts:93-115 (schema)TypeScript interface defining the structure of the sign flow detail response from the API.interface SignFlowDetailResponse { signFlowStatus: number; signFlowDescription: string; signFlowCreateTime: number; signFlowStartTime: number; signFlowFinishTime: number | null; docs: Array<{ fileId: string; fileName: string; }>; signers: Array<{ psnSigner?: { psnName: string; psnAccount: { accountMobile: string; accountEmail: string | null; }; }; signerType: number; signOrder: number; signStatus: number; }>; }