list_workflows
Lists all available workflow templates to help you select and initiate collaborative AI tasks among multiple models.
Instructions
列出所有可用的工作流模板
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_workflows"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/collaboration/workflow.ts:376-381 (handler)Core handler: The listWorkflows() method on WorkflowManager returns all workflow definitions by combining templates (predefined) and customWorkflows (registered at runtime).
listWorkflows(): WorkflowDefinition[] { return [ ...this.templates.values(), ...this.customWorkflows.values(), ]; } - src/collaboration/workflow.ts:51-66 (schema)Schema: WorkflowDefinition interface defines the shape of each workflow (id, name, description, triggers, steps, entryPoint, variables).
export interface WorkflowDefinition { /** 工作流 ID */ id: string; /** 工作流名称 */ name: string; /** 工作流描述 */ description: string; /** 适用场景 */ triggers: string[]; /** 工作流步骤 */ steps: WorkflowStep[]; /** 入口步骤 ID */ entryPoint: string; /** 变量定义 */ variables?: Record<string, string>; } - src/server.ts:357-364 (registration)Registration: The tool 'list_workflows' is registered in the server's tool definitions list with an empty input schema.
{ name: 'list_workflows', description: '列出所有可用的工作流模板', inputSchema: { type: 'object', properties: {}, }, }, - src/server.ts:869-883 (registration)Handler dispatch: The server routes the 'list_workflows' tool call, invokes workflowManager.listWorkflows(), formats the result as a Markdown list, and returns it.
case 'list_workflows': { const workflows = workflowManager.listWorkflows(); const list = workflows.map(w => { const stepsCount = w.steps.filter(s => s.type === 'expert').length; return `### ${w.name} (\`${w.id}\`) ${w.description} - **触发词**: ${w.triggers.join(', ')} - **步骤数**: ${stepsCount} 个专家步骤 - **流程**: ${w.steps.filter(s => s.type === 'expert').map(s => s.name).join(' → ')}`; }).join('\n\n'); return { content: [{ type: 'text', text: `# 📋 可用工作流模板\n\n${list}\n\n---\n> 使用 \`run_workflow\` 执行指定工作流,或使用 \`suggest_workflow\` 自动推荐` }], }; } - Helper: The singleton export 'workflowManager' is created as a new WorkflowManager instance, imported and used by the server.
export const workflowManager = new WorkflowManager();