visualreasoning
Create, manipulate, and interpret diagrams to generate insights and test hypotheses for problem-solving and communication.
Instructions
A tool for visual thinking, problem-solving, and communication. This tool enables models to create, manipulate, and interpret diagrams, graphs, and other visual representations. It supports various visual elements and operations to facilitate insight generation and hypothesis testing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | ||
| elements | No | ||
| transformationType | No | ||
| diagramId | Yes | ||
| diagramType | Yes | ||
| iteration | Yes | ||
| observation | No | ||
| insight | No | ||
| hypothesis | No | ||
| nextOperationNeeded | Yes |
Implementation Reference
- The main handler function that executes the visual reasoning process.
public processVisualReasoning(input: unknown): { content: Array<{ type: string; text: string }>; isError?: boolean } { try { const validatedData = this.validateInputData(input); const processedData: VisualOperationData = { ...validatedData, elements: validatedData.elements || [] }; const formattedOutput = this.formatOutput(processedData); console.error(formattedOutput); return { content: [{ type: "text", text: JSON.stringify({ operation: processedData.operation, diagramId: processedData.diagramId, diagramType: processedData.diagramType, iteration: processedData.iteration, nextOperationNeeded: processedData.nextOperationNeeded, elementCount: processedData.elements ? processedData.elements.length : 0, status: 'success' }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: error instanceof Error ? error.message : String(error), status: 'failed' }, null, 2) }], isError: true }; } } - Validation logic for the tool's input data.
private validateInputData(input: unknown): VisualOperationData { const data = input as VisualOperationData; if (!data.operation || !data.diagramId || !data.diagramType) { throw new Error("Invalid input for VisualReasoning: Missing required fields."); } if (typeof data.iteration !== 'number' || data.iteration < 0) { throw new Error("Invalid iteration value for VisualOperationData."); } if (typeof data.nextOperationNeeded !== 'boolean') { throw new Error("Invalid nextOperationNeeded value for VisualOperationData."); } return data; }