Skip to main content
Glama

get_workflow

Retrieve a specific workflow by its ID to access structured, multi-step task sequences for execution and analysis.

Instructions

Get a specific workflow by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • The handler function that executes the 'get_workflow' tool logic. Parses the input arguments using GetWorkflowSchema, retrieves the workflow from storage using the provided ID, handles not-found errors, and returns the workflow as a JSON-formatted text response.
    private async getWorkflow(args: unknown) {
      const parsed = GetWorkflowSchema.parse(args);
      
      const workflow = await this.storage.get(parsed.id);
      if (!workflow) {
        throw new Error(`Workflow not found: ${parsed.id}`);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              workflow,
            }, null, 2),
          },
        ],
      };
    }
  • Zod schema defining the input structure for the 'get_workflow' tool, requiring a single 'id' string parameter.
    const GetWorkflowSchema = z.object({
      id: z.string(),
    });
  • src/index.ts:262-266 (registration)
    Tool registration in the getTools() method, defining the name, description, and input schema for the 'get_workflow' tool.
    {
      name: 'get_workflow',
      description: 'Get a specific workflow by ID',
      inputSchema: zodToJsonSchema(GetWorkflowSchema),
    },
  • src/index.ts:126-127 (registration)
    Dispatch/registration in the CallToolRequestSchema handler switch statement, routing 'get_workflow' calls to the getWorkflow method.
    case 'get_workflow':
      return await this.getWorkflow(args);
  • Supporting method in WorkflowStorage that retrieves a workflow by ID from the filesystem, used by the getWorkflow handler.
    async get(id: string): Promise<Workflow | null> {
      try {
        const filePath = this.getWorkflowPath(id);
        const data = await fs.readFile(filePath, 'utf-8');
        return JSON.parse(data) as Workflow;
      } catch (error) {
        if ((error as any).code === 'ENOENT') {
          return null;
        }
        throw error;
      }
    }

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/FiveOhhWon/workflows-mcp'

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