{"record":{"id":"d9075fd0aa08b817","repo":"mastra-ai/mastra","slug":"workflow-workflow-id-key-workflowkey","errorCode":null,"errorMessage":"Workflow '${workflow.id}' (key: '${workflowKey}') must have a non-empty description to be used in an MCPServer.","messagePattern":"Workflow '(.+?)' \\(key: '(.+?)'\\) must have a non-empty description to be used in an MCPServer\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp/src/server/server.ts","lineNumber":1583,"sourceCode":"    definedConvertedTools?: Record<string, InternalCoreTool>,\n  ): Record<string, InternalCoreTool> {\n    const workflowTools: Record<string, InternalCoreTool> = {};\n    if (!workflowsConfig) {\n      return workflowTools;\n    }\n\n    for (const workflowKey in workflowsConfig) {\n      const workflow = workflowsConfig[workflowKey];\n      if (!workflow || typeof workflow.createRun !== 'function') {\n        this.logger.warn(\n          `Workflow instance for '${workflowKey}' is invalid or missing a createRun function. Skipping.`,\n        );\n        continue;\n      }\n\n      const workflowDescription = workflow.description;\n      if (!workflowDescription) {\n        throw new Error(\n          `Workflow '${workflow.id}' (key: '${workflowKey}') must have a non-empty description to be used in an MCPServer.`,\n        );\n      }\n\n      const workflowToolName = `run_${workflowKey}`;\n      if (definedConvertedTools?.[workflowToolName] || workflowTools[workflowToolName]) {\n        this.logger.warn(\n          `Tool with name '${workflowToolName}' already exists. Workflow '${workflowKey}' will not be added as a duplicate tool.`,\n        );\n        continue;\n      }\n\n      const workflowToolDefinition = createTool({\n        id: workflowToolName,\n        description: `Run workflow '${workflowKey}'. Workflow description: ${workflowDescription}`,\n        inputSchema: workflow.inputSchema,\n        execute: async (inputData, context) => {\n          this.logger.debug(","sourceCodeStart":1565,"sourceCodeEnd":1601,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/mcp/src/server/server.ts#L1565-L1601","documentation":"Workflows registered on an MCPServer become tools named `run_<workflowKey>`, and the server requires each workflow to have a non-empty `description` because MCP tool definitions need a description. This Error is thrown at server setup when a registered workflow's description is empty or undefined.","triggerScenarios":"new MCPServer({ workflows: { myWorkflow: workflow } }) where the Workflow was created without a description (new Workflow({ id, description }) omitted or set to ''), evaluated when the server builds its workflow tools.","commonSituations":"Workflows defined programmatically without descriptions for internal orchestration, then registered on an MCPServer; older workflow code predating the description requirement; a dynamically created workflow whose description argument was accidentally left empty.","solutions":["Pass a non-empty description when creating the Workflow: new Workflow({ id: 'myWorkflow', description: '...' })","Remove the workflow from the MCPServer's workflows map if it should not be exposed","Add a build-time or startup check that all MCPServer-registered workflows have descriptions"],"exampleFix":"// before\nconst wf = new Workflow({ id: 'etlWorkflow' });\nnew MCPServer({ workflows: { etlWorkflow: wf } });\n// after\nconst wf = new Workflow({ id: 'etlWorkflow', description: 'Runs the nightly ETL pipeline over uploaded CSVs.' });\nnew MCPServer({ workflows: { etlWorkflow: wf } });","handlingStrategy":"validation","validationCode":"for (const [key, workflow] of Object.entries(workflowsMap)) {\n  if (!workflow.description) {\n    throw new Error(`Workflow '${key}' has no description; add one before registering on an MCPServer.`);\n  }\n}","typeGuard":"function hasWorkflowDescription(workflow) {\n  return typeof workflow.description === 'string' && workflow.description.length > 0;\n}","tryCatchPattern":"try {\n  const server = new MCPServer({ name, version, workflows });\n  await server.start();\n} catch (e) {\n  if (e instanceof Error && e.message.includes('non-empty description')) {\n    // parse workflow id from the message and add a description\n  } else throw e;\n}","preventionTips":["Always pass a description when constructing workflows, even for internal use","Add a startup test that all MCPServer-registered workflows have non-empty descriptions","Use descriptions that would make sense as MCP tool descriptions for LLM consumers"],"tags":["mcp","workflow","configuration","missing-description"],"backgroundTag":"missing-required-config","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}