Skip to main content
Glama
hichana

Goal Story MCP Server

by hichana

goalstory_create_story

Create and save a personalized story visualizing goal or step achievement. Uses user beliefs, motivations, and context to craft engaging narratives, enhancing motivation and focus.

Instructions

Generate and save a highly personalized story that visualizes achievement of the current goal/step. Uses understanding of the user's beliefs, motivations, and context to create engaging mental imagery. If context is needed, gathers it through user discussion and profile data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goal_idYesUnique identifier of the goal this story supports.
step_idYesUnique identifier of the specific step this story visualizes.
story_textYesDetailed narrative that vividly illustrates goal/step achievement.
titleYesEngaging headline that captures the essence of the story.

Implementation Reference

  • MCP server.tool registration and handler implementation for the 'goalstory_create_story' tool. It constructs a POST request to the /stories API endpoint using the provided goal_id, step_id, title, and story_text, then returns the API response formatted as MCP content.
    server.tool( CREATE_STORY_TOOL.name, CREATE_STORY_TOOL.description, CREATE_STORY_TOOL.inputSchema.shape, async (args) => { const url = `${GOALSTORY_API_BASE_URL}/stories`; const body = { goal_id: args.goal_id, step_id: args.step_id, title: args.title, story_text: args.story_text, }; const result = await doRequest(url, "POST", body); return { content: [ { type: "text", text: `Story created:\n${JSON.stringify(result, null, 2)}`, }, ], isError: false, }; }, );
  • Zod input schema and tool metadata (name, description) for the 'goalstory_create_story' tool, exported as CREATE_STORY_TOOL and imported for use in server.tool registration.
    export const CREATE_STORY_TOOL = { name: "goalstory_create_story", description: `Generate and save a highly personalized story that visualizes achievement of the current goal/step. Uses understanding of the user's beliefs, motivations, and context to create engaging mental imagery. If context is needed, gathers it through user discussion and profile data.`, inputSchema: z.object({ goal_id: z .string() .describe("Unique identifier of the goal this story supports."), step_id: z .string() .describe( "Unique identifier of the specific step this story visualizes.", ), title: z .string() .describe("Engaging headline that captures the essence of the story."), story_text: z .string() .describe( "Detailed narrative that vividly illustrates goal/step achievement.", ), }), };
  • TypeScript interface defining the expected input shape for the GoalstoryCreateStoryInput, matching the Zod schema.
    export interface GoalstoryCreateStoryInput { goal_id: string; step_id: string; title?: string; story_text: string; }
  • Shared utility function for making authenticated HTTP requests to the GoalStory API, used by the tool handler.
    async function doRequest<T = any>( url: string, method: string, body?: unknown, ): Promise<T> { console.error("Making request to:", url); console.error("Method:", method); console.error("Body:", body ? JSON.stringify(body) : "none"); try { const response = await axios({ url, method, headers: { "Content-Type": "application/json", Authorization: `Bearer ${GOALSTORY_API_TOKEN}`, }, data: body, timeout: 10000, // 10 second timeout validateStatus: function (status) { return status >= 200 && status < 500; // Accept all status codes less than 500 }, }); console.error("Response received:", response.status); return response.data as T; } catch (err) { console.error("Request failed with error:", err); if (axios.isAxiosError(err)) { if (err.code === "ECONNABORTED") { throw new Error( `Request timed out after 10 seconds. URL: ${url}, Method: ${method}`, ); } if (err.response) { // The request was made and the server responded with a status code // that falls out of the range of 2xx throw new Error( `HTTP Error ${ err.response.status }. URL: ${url}, Method: ${method}, Body: ${JSON.stringify( body, )}. Error text: ${JSON.stringify(err.response.data)}`, ); } else if (err.request) { // The request was made but no response was received throw new Error( `No response received from server. URL: ${url}, Method: ${method}`, ); } else { // Something happened in setting up the request that triggered an Error throw new Error(`Request setup failed: ${err.message}`); } } else { // Something else happened throw new Error( `Unexpected error: ${err instanceof Error ? err.message : String(err)}`, ); } } }

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/hichana/goalstory-mcp'

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