Skip to main content
Glama

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
NameRequiredDescriptionDefault
operationYes
elementsNo
transformationTypeNo
diagramIdYes
diagramTypeYes
iterationYes
observationNo
insightNo
hypothesisNo
nextOperationNeededYes

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;
    }

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/chirag127/Clear-Thought-MCP-server'

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