diff --git a/src/index.ts b/src/index.ts index e2961bd..777aa6c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -187,7 +187,7 @@ async function main() { // 註冊思維鏈工具 server.tool( "process_thought", - "你可以透過靈活的、可適應和發展的思考過程來分析問題,隨著理解的加深,每個想法都可以建立、質疑或修改先前的見解。你可以質疑想法、假設想法、驗證想法,並且可以建立新的想法。你將重複這個過程,直到你對問題有足夠的理解,並且能夠提出有效的解決方案。", + "你可以透過靈活的、可適應和發展的思考過程來分析問題,隨著理解的加深,每個想法都可以建立、質疑或修改先前的見解。你可以質疑想法、假設想法、驗證想法,並且可以建立新的想法。你將重複這個過程,直到你對問題有足夠的理解,並且能夠提出有效的解決方案。如果你覺得思考已經充分可以把 nextThoughtNeeded 設為 false 並且停止思考。", processThoughtSchema.shape, async (args) => { return await processThought(args); diff --git a/src/tools/thoughtChainTools.ts b/src/tools/thoughtChainTools.ts index f4b1557..99706cc 100644 --- a/src/tools/thoughtChainTools.ts +++ b/src/tools/thoughtChainTools.ts @@ -1,47 +1,6 @@ import { z } from "zod"; import { ThoughtData, ThoughtStage } from "../types/index.js"; -/** - * 思維資料驗證結構 - */ -const thoughtDataSchema = z.object({ - thought: z - .string() - .min(1, { - message: "思維內容不能為空,請提供有效的思考內容", - }) - .describe("思維內容"), - thoughtNumber: z - .number() - .int() - .positive({ - message: "思維編號必須是正整數", - }) - .describe("思維編號"), - totalThoughts: z - .number() - .int() - .positive({ - message: "總思維數必須是正整數", - }) - .describe("總思維數"), - nextThoughtNeeded: z.boolean().describe("是否需要更多思維"), - stage: z - .nativeEnum(ThoughtStage, { - message: "思維階段不能為空,請提供有效的思考階段", - }) - .describe("思維階段"), - tags: z.array(z.string()).optional().describe("思維標籤,是一個陣列字串"), - axioms_used: z - .array(z.string()) - .optional() - .describe("使用的公理,是一個陣列字串"), - assumptions_challenged: z - .array(z.string()) - .optional() - .describe("挑戰的假設,是一個陣列字串"), -}); - /** * 格式化思維內容,返回美觀的格式化輸出 * @param thoughtData 思維資料 @@ -97,14 +56,41 @@ function formatThought(thoughtData: ThoughtData): string { * processThought工具的參數結構 */ export const processThoughtSchema = z.object({ - thought: z.string().describe("思維內容"), - thought_number: z.number().int().positive().describe("當前思維編號"), - total_thoughts: z.number().int().positive().describe("預計總思維數量"), + thought: z + .string() + .min(1, { + message: "思維內容不能為空,請提供有效的思考內容", + }) + .describe("思維內容"), + thought_number: z + .number() + .int() + .positive({ + message: "思維編號必須是正整數", + }) + .describe("當前思維編號"), + total_thoughts: z + .number() + .int() + .positive({ + message: "總思維數必須是正整數", + }) + .describe("預計總思維數量"), next_thought_needed: z.boolean().describe("是否需要下一步思維"), - stage: z.string().describe("思考階段"), - tags: z.array(z.string()).optional().describe("思維標籤"), - axioms_used: z.array(z.string()).optional().describe("使用的公理"), - assumptions_challenged: z.array(z.string()).optional().describe("挑戰的假設"), + stage: z + .nativeEnum(ThoughtStage, { + message: "思維階段不能為空,請提供有效的思考階段", + }) + .describe("思考階段"), + tags: z.array(z.string()).optional().describe("思維標籤,是一個陣列字串"), + axioms_used: z + .array(z.string()) + .optional() + .describe("使用的公理,是一個陣列字串"), + assumptions_challenged: z + .array(z.string()) + .optional() + .describe("挑戰的假設,是一個陣列字串"), }); /**