goalstory_about
Explore Goal Story's philosophy to understand how storytelling enhances goal achievement. Access insights on story-driven methods that motivate and guide users toward success.
Instructions
Retrieve information about Goal Story's philosophy and the power of story-driven goal achievement. Use this to help users understand the unique approach of Goal Storying.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:147-164 (handler)The core handler function registered with the MCP server for the 'goalstory_about' tool. It constructs the API URL for '/about', performs a GET request using the shared doRequest helper, and returns the formatted JSON response as text content.server.tool( ABOUT_GOALSTORYING_TOOL.name, ABOUT_GOALSTORYING_TOOL.description, ABOUT_GOALSTORYING_TOOL.inputSchema.shape, async (args) => { const url = `${GOALSTORY_API_BASE_URL}/about`; const result = await doRequest(url, "GET"); return { content: [ { type: "text", text: `About data:\n${JSON.stringify(result, null, 2)}`, }, ], isError: false, }; }, );
- src/tools.ts:9-14 (schema)Tool specification object defining the name, description, and Zod input schema (empty object since no input parameters required). This is imported and used in the server.tool registration.export const ABOUT_GOALSTORYING_TOOL = { name: "goalstory_about", description: "Retrieve information about Goal Story's philosophy and the power of story-driven goal achievement. Use this to help users understand the unique approach of Goal Storying.", inputSchema: z.object({}), };
- src/index.ts:147-164 (registration)Registration of the 'goalstory_about' tool with the MCP server using server.tool(), referencing the spec from tools.ts and providing the handler function.server.tool( ABOUT_GOALSTORYING_TOOL.name, ABOUT_GOALSTORYING_TOOL.description, ABOUT_GOALSTORYING_TOOL.inputSchema.shape, async (args) => { const url = `${GOALSTORY_API_BASE_URL}/about`; const result = await doRequest(url, "GET"); return { content: [ { type: "text", text: `About data:\n${JSON.stringify(result, null, 2)}`, }, ], isError: false, }; }, );
- src/types.ts:3-3 (schema)TypeScript interface defining the input shape for the tool (empty, matching the Zod schema).export interface GoalstoryAboutInput {}
- src/index.ts:62-122 (helper)Shared utility function used by all tools (including goalstory_about) to make authenticated HTTP requests to the GoalStory API backend with timeout, logging, 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)}`, ); } } }