Skip to main content
Glama

get_workflow_preferences

Load user workflow preferences from past sessions to restore previous settings and streamline project management tasks.

Instructions

Load user workflow preferences from past sessions. No auth needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for get_workflow_preferences. Checks for .pm_preferences.json file, reads and parses it, tags observations with USER_DATA wrapper, and returns results. Handles errors via try-catch with error formatting.
    async () => { try { if (!existsSync(PREFS_PATH)) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult({ found: false, preferences: [] })), }, ], }; } const data = JSON.parse(readFileSync(PREFS_PATH, "utf-8")); const raw = data.observations ?? []; const prefs = raw.map((p: unknown) => (typeof p === "string" ? tagUserText(p) : p)); return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult({ found: true, preferences: prefs })), }, ], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } },
  • src/tools/pm.ts:45-86 (registration)
    Tool registration with MCP server. Defines tool name, title, description, input schema (empty object since no parameters needed), and associates the handler function. Called from registerPmTools().
    server.registerTool( "get_workflow_preferences", { title: "Get Workflow Preferences", description: "Load user workflow preferences from past sessions. No auth needed.", inputSchema: z.object({}), }, async () => { try { if (!existsSync(PREFS_PATH)) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult({ found: false, preferences: [] })), }, ], }; } const data = JSON.parse(readFileSync(PREFS_PATH, "utf-8")); const raw = data.observations ?? []; const prefs = raw.map((p: unknown) => (typeof p === "string" ? tagUserText(p) : p)); return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult({ found: true, preferences: prefs })), }, ], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } }, );
  • Input schema definition using Zod. Empty object schema indicates the tool takes no input parameters.
    inputSchema: z.object({}),
  • Local helper function to format errors. Converts CliError or unexpected errors into contract error format using contractError utility.
    function handleError(err: unknown): Record<string, unknown> { if (err instanceof CliError) return contractError(String(err), "error"); return contractError(`Unexpected error: ${err}`, "error"); }
  • Helper function that tags user-provided text with USER_DATA wrapper for security tracking. Used to wrap each observation preference before returning.
    export function tagUserText(text: string | null | undefined): string | null { if (text == null) return null; return `[USER_DATA]${text}[/USER_DATA]`; }

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/rangogamedev/codecks-mcp'

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