workflow_info
Retrieve workflow details including input fields, recent runs, and creator information by providing the workflow ID.
Instructions
Get detailed information about a workflow (glif) including its input fields, recent runs, and creator info.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the workflow (glif) to show details for |
Implementation Reference
- src/tools/glif-info.ts:33-84 (handler)The main handler function for the 'workflow_info' tool. Parses arguments (id), calls getGlifDetails API, extracts input fields from nodes, builds a formatted text response with glif details and recent runs.
export async function handler(request: ToolRequest): Promise<ToolResponse> { const args = parseToolArguments(request, schema); const { glif, recentRuns } = await getGlifDetails(args.id); // Extract input field names from glif data const inputFields = glif.data?.nodes ?.filter((node) => node.type.includes("input")) .map((node) => ({ name: node.name, type: node.type, params: node.params, })) ?? []; const details = [ `Name: ${glif.name}`, `Description: ${glif.description}`, `Created by: ${glif.user.name} (@${glif.user.username})`, `Created: ${new Date(glif.createdAt).toLocaleString()}`, `Runs: ${glif.completedSpellRunCount}`, `Average Duration: ${glif.averageDuration}ms`, `Likes: ${glif.likeCount}`, "", "Input Fields:", ...inputFields.map((field) => `- ${field.name} (${field.type})`), "", "Recent Runs:", ...recentRuns.map( (run) => `Time: ${new Date(run.createdAt).toLocaleString()} Duration: ${run.totalDuration}ms Output: ${run.output || "No output"} By: ${run.user.name} (@${run.user.username}) ${ run.inputs ? Object.entries(run.inputs) .map(([key, value]) => ` Input "${key}": ${value}`) .join("\n") : "No inputs" }` ), ]; return { content: [ { type: "text", text: details.join("\n"), }, ], }; } - src/tools/glif-info.ts:9-11 (schema)Zod schema for the 'workflow_info' tool: expects a single 'id' string parameter.
export const schema = z.object({ id: z.string(), }); - src/tools/registry.ts:18-26 (registration)Tool registration in the 'core' group: maps glifInfo.definition.name ('workflow_info') to the glifInfo module. Always enabled (returns true).
export const TOOL_REGISTRY: ToolGroupConfig[] = [ { name: "core", enabled: () => true, tools: { [glifInfo.definition.name]: glifInfo, [runGlif.definition.name]: runGlif, }, }, - src/tools/index.ts:113-124 (registration)General dispatch in setupToolHandlers: looks up tool by name in enabledTools and calls its handler. This is where 'workflow_info' gets invoked at runtime.
// Handle all registered tools const enabledTools = getEnabledTools(); const tool = enabledTools[request.params.name]; if (tool) { return tool.handler(request); } throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}` ); }); - src/api.ts:122-160 (helper)The getGlifDetails API function that fetches glif details and recent runs from the Glif API. Called by the workflow_info handler.
export async function getGlifDetails(id: string): Promise<{ glif: Glif; recentRuns: GlifRun[]; }> { logger.debug("getGlifDetails", { id }); try { const [glifData, runsData] = await Promise.all([ apiRequest<unknown>("/glifs", "get", { queryParams: { id }, context: "getGlifDetails - glifs", }), apiRequest<unknown>("/runs", "get", { queryParams: { glifId: id }, context: "getGlifDetails - runs", }), ]); const glifArray = validateWithSchema( z.array(GlifSchema), glifData, "getGlifDetails - glifs validation" ); const glif = glifArray[0]; if (!glif) { throw new Error("No glif found in response"); } const recentRuns = validateWithSchema( z.array(GlifRunSchema), runsData, "getGlifDetails - runs validation" ).slice(0, 3); return { glif, recentRuns }; } catch (error) { return handleApiError(error, "getGlifDetails"); } }