Skip to main content
Glama
hichana

Goal Story MCP Server

by hichana

goalstory_read_self_user

Retrieve user profile data, including preferences, beliefs, and goal history, to enable personalized goal narratives and context-aware discussions on the Goal Story MCP Server.

Instructions

Get the user's profile data including their preferences, belief systems, and past goal history to enable personalized goal storying and context-aware discussions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that executes the tool logic: makes a GET request to the /users API endpoint using the shared doRequest helper and returns the formatted user profile data.
    async (args) => { const url = `${GOALSTORY_API_BASE_URL}/users`; const result = await doRequest(url, "GET"); return { content: [ { type: "text", text: `User data:\n${JSON.stringify(result, null, 2)}`, }, ], isError: false, }; },
  • src/index.ts:169-186 (registration)
    MCP server registration of the tool using server.tool(), providing name, description, input schema shape, and the handler function.
    server.tool( READ_SELF_USER_TOOL.name, READ_SELF_USER_TOOL.description, READ_SELF_USER_TOOL.inputSchema.shape, async (args) => { const url = `${GOALSTORY_API_BASE_URL}/users`; const result = await doRequest(url, "GET"); return { content: [ { type: "text", text: `User data:\n${JSON.stringify(result, null, 2)}`, }, ], isError: false, }; }, );
  • Tool schema definition: exports the tool metadata object with name, description, and Zod inputSchema (empty object since no input params required).
    export const READ_SELF_USER_TOOL = { name: "goalstory_read_self_user", description: "Get the user's profile data including their preferences, belief systems, and past goal history to enable personalized goal storying and context-aware discussions.", inputSchema: z.object({}), };
  • Shared utility function doRequest used by all tool handlers to make authenticated HTTP requests to the GoalStory API backend with axios, logging, timeout, and comprehensive error handling.
    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