Skip to main content
Glama

suggest_workflow

Recommends optimal workflows for given tasks by analyzing requirements and suggesting efficient processes to complete objectives.

Instructions

根据任务自动推荐合适的工作流

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYes任务描述

Implementation Reference

  • Handler implementation for the 'suggest_workflow' tool. Extracts the task from arguments, uses workflowManager.matchWorkflow to find matching workflow, and formats a response with recommendation or fallback list.
            case 'suggest_workflow': {
              const { task } = args as { task: string };
              
              const matched = workflowManager.matchWorkflow(task);
              
              if (matched) {
                const stepsDesc = matched.steps
                  .filter(s => s.type === 'expert')
                  .map((s, i) => `${i + 1}. **${s.name}** - ${s.expert?.role.slice(0, 50)}...`)
                  .join('\n');
                
                return {
                  content: [{ type: 'text', text: `# 💡 推荐工作流
    
    ## ${matched.name} (\`${matched.id}\`)
    ${matched.description}
    
    ### 执行步骤
    ${stepsDesc}
    
    ### 触发原因
    任务包含关键词: ${matched.triggers.filter(t => task.toLowerCase().includes(t.toLowerCase())).join(', ')}
    
    ---
    > 使用 \`run_workflow\` 执行此工作流:
    > \`{ "workflow": "${matched.id}", "task": "${task.slice(0, 50)}..." }\`` }],
                };
              } else {
                return {
                  content: [{ type: 'text', text: `# 💡 工作流推荐
    
    未找到匹配的预定义工作流。
    
    **建议**: 使用 \`team_work\` 让 Tech Lead 动态分析任务并创建专家团队。
    
    **可用工作流**:
    - \`code-generation\` - 代码生成(写、创建、实现)
    - \`bug-fix\` - Bug 修复(修复、错误、fix)
    - \`refactoring\` - 代码重构(重构、优化)
    - \`code-review\` - 代码审查(审查、review)
    - \`documentation\` - 文档生成(文档、doc)` }],
                };
              }
            }
  • src/server.ts:388-401 (registration)
    Registration of the 'suggest_workflow' tool in the MCP server's ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: 'suggest_workflow',
      description: '根据任务自动推荐合适的工作流',
      inputSchema: {
        type: 'object',
        properties: {
          task: {
            type: 'string',
            description: '任务描述',
          },
        },
        required: ['task'],
      },
    },
  • Input schema definition for suggest_workflow: requires a 'task' string describing the task to analyze.
    inputSchema: {
      type: 'object',
      properties: {
        task: {
          type: 'string',
          description: '任务描述',
        },
      },
      required: ['task'],
    },
  • Core helper function matchWorkflow that implements the workflow suggestion logic by checking task keywords against triggers in custom and predefined workflows.
    matchWorkflow(task: string): WorkflowDefinition | undefined {
      const taskLower = task.toLowerCase();
      
      // 先检查自定义工作流
      for (const workflow of this.customWorkflows.values()) {
        if (workflow.triggers.some(t => taskLower.includes(t.toLowerCase()))) {
          return workflow;
        }
      }
      
      // 再检查预定义模板
      for (const workflow of this.templates.values()) {
        if (workflow.triggers.some(t => taskLower.includes(t.toLowerCase()))) {
          return workflow;
        }
      }
      
      return undefined;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/7836246/claude-team-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server