goalstory_get_story_context
Gather user context including goals, motivations, and beliefs to create personalized stories that enhance goal achievement through meaningful narratives.
Instructions
Gather rich context about the user, their current goal/step, beliefs, and motivations to create deeply personalized and meaningful stories. Combines user profile data with conversation insights.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goalId | Yes | Unique identifier of the goal for context gathering. | |
| stepId | Yes | Unique identifier of the specific step for context gathering. | |
| feedback | No | Additional user input to enhance context understanding. |
Implementation Reference
- src/index.ts:423-438 (handler)The core handler function for the 'goalstory_get_story_context' tool. It takes input arguments (goalId, stepId, optional feedback), builds a query URL for the backend API endpoint '/context', fetches the story context data, and returns it formatted as a text content block.async (args) => { const params = new URLSearchParams(); params.set("goalId", args.goalId); params.set("stepId", args.stepId); if (args.feedback) params.set("feedback", args.feedback); const url = `${GOALSTORY_API_BASE_URL}/context?${params.toString()}`; const result = await doRequest(url, "GET"); return { content: [ { type: "text", text: `Story context:\n${JSON.stringify(result, null, 2)}`, }, ], isError: false, };
- src/index.ts:419-440 (registration)MCP server registration of the tool using server.tool(), specifying the name, description, input schema shape from tools.ts, and the inline handler function.server.tool( GET_STORY_CONTEXT_TOOL.name, GET_STORY_CONTEXT_TOOL.description, GET_STORY_CONTEXT_TOOL.inputSchema.shape, async (args) => { const params = new URLSearchParams(); params.set("goalId", args.goalId); params.set("stepId", args.stepId); if (args.feedback) params.set("feedback", args.feedback); const url = `${GOALSTORY_API_BASE_URL}/context?${params.toString()}`; const result = await doRequest(url, "GET"); return { content: [ { type: "text", text: `Story context:\n${JSON.stringify(result, null, 2)}`, }, ], isError: false, }; }, );
- src/tools.ts:199-216 (schema)Tool specification object exported from tools.ts, including the exact name 'goalstory_get_story_context', description, and Zod inputSchema used for validation in the MCP tool registration.export const GET_STORY_CONTEXT_TOOL = { name: "goalstory_get_story_context", description: `Gather rich context about the user, their current goal/step, beliefs, and motivations to create deeply personalized and meaningful stories. Combines user profile data with conversation insights.`, inputSchema: z.object({ goalId: z .string() .describe("Unique identifier of the goal for context gathering."), stepId: z .string() .describe( "Unique identifier of the specific step for context gathering.", ), feedback: z .string() .optional() .describe("Additional user input to enhance context understanding."), }), };
- src/types.ts:56-60 (schema)TypeScript interface defining the input type for the tool, matching the Zod schema.export interface GoalstoryGetStoryContextInput { goalId: string; stepId: string; feedback?: string; }