Skip to main content
Glama

project_open

Open Visum project files to establish a dedicated TCP server for efficient communication and structured problem-solving workflows.

Instructions

๐Ÿš€ DEFAULT TOOL for opening Visum projects. Always use this tool when asked to open, load, or launch any Visum project. Creates dedicated TCP server for ultra-fast communication. โš ๏ธ If you encounter errors, run 'instance_diagnosis' first!

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesFull path to the Visum project file (.ver)

Implementation Reference

  • MCP tool registration for 'project_open', including schema {projectPath: string} and handler that delegates to ProjectServerManager.openProject
    server.tool(
      "project_open",
      "๐Ÿš€ DEFAULT TOOL for opening Visum projects. Always use this tool when asked to open, load, or launch any Visum project. Creates dedicated TCP server for ultra-fast communication.",
      {
        projectPath: z.string().describe("Full path to the Visum project file (.ver)")
      },
      async ({ projectPath }) => {
        console.error(`๐Ÿš€ PROJECT_OPEN CHIAMATO: ${projectPath}`);
        console.error(`โฐ Timestamp: ${new Date().toISOString()}`);
        
        try {
          console.error(`๐Ÿ”„ Avvio ProjectServerManager.openProject...`);
          const result = await serverManager.openProject(projectPath);
          console.error(`โœ… ProjectServerManager.openProject completato: ${result.success}`);
          
          if (result.success) {
            return {
              content: [
                {
                  type: "text",
                  text: `๐Ÿš€ **Progetto Aperto con Server TCP**\n\nโœ… ${result.message}\n\n๐Ÿ“Š **Dettagli Server:**\n- **ID Progetto:** ${result.projectId}\n- **Nome:** ${result.serverInfo.projectName}\n- **Porta TCP:** ${result.serverInfo.port}\n- **PID:** ${result.serverInfo.pid}\n- **Status:** ${result.serverInfo.status}\n\n๐Ÿ”— **Connessione Client:**\n- Host: localhost\n- Porta: ${result.serverInfo.port}\n\nโšก Server pronto per ricevere comandi ultra-veloci dai client TCP!`
                }
              ]
            };
          } else {
            console.error(`โŒ ProjectServerManager.openProject fallito: ${result.message}`);
            return {
              content: [
                {
                  type: "text",
                  text: `โŒ **Errore Apertura Progetto**\n\n${result.message}`
                }
              ]
            };
          }
        } catch (error) {
          console.error(`๐Ÿ’ฅ Eccezione in project_open: ${error instanceof Error ? error.message : String(error)}`);
          return {
            content: [
              {
                type: "text",
                text: `โŒ **Errore:** ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Core implementation: generates projectId, spawns dedicated TCP server process for the Visum project, waits for readiness, manages registry of active servers
    async openProject(projectPath: string): Promise<any> {
      const projectId = this.generateProjectId(projectPath);
      
      // Controlla se il progetto รจ giร  aperto
      if (this.activeServers.has(projectId)) {
        const serverInfo = this.activeServers.get(projectId);
        
        // Verifica se il server รจ ancora attivo
        if (await this.isServerAlive(serverInfo)) {
          return {
            success: true,
            message: 'Progetto giร  aperto',
            projectId,
            serverInfo: {
              ...serverInfo,
              alreadyOpen: true
            }
          };
        } else {
          // Server morto, rimuovi dal registry
          this.activeServers.delete(projectId);
          this.saveRegistry();
        }
      }
    
      // Avvia nuovo server per il progetto
      const port = this.nextPort++;
      const serverScript = join(__dirname, '..', 'project-tcp-server.mjs');
      
      console.error(`STARTING: server for project: ${basename(projectPath)}`);
      console.error(`TCP: Porta TCP: ${port}`);
      
      const serverProcess = spawn('node', [serverScript, projectPath, port.toString(), projectId], {
        detached: true,
        stdio: ['ignore', 'pipe', 'pipe']
      });
    
      const serverInfo = {
        projectId,
        projectPath,
        projectName: basename(projectPath, '.ver'),
        port,
        pid: serverProcess.pid,
        startTime: Date.now(),
        startTimeString: new Date().toLocaleString('it-IT'),
        status: 'starting'
      };
    
      // Salva nel registry
      this.activeServers.set(projectId, serverInfo);
      this.saveRegistry();
    
      // Aspetta inizializzazione del server
      return new Promise((resolve) => {
        let initialized = false;
        const timeout = setTimeout(() => {
          if (!initialized) {
            resolve({
              success: false,
              message: 'Timeout inizializzazione server',
              projectId
            });
          }
        }, 300000); // 5 minuti timeout per progetti grandi
    
        serverProcess.stdout.on('data', (data) => {
          const output = data.toString();
          console.error(`SERVER: ${projectId}:`, output.trim());
          
          if (output.includes('SERVER PRONTO PER CLIENT TCP') && !initialized) {
            initialized = true;
            clearTimeout(timeout);
            
            // Aggiorna status
            serverInfo.status = 'ready';
            this.activeServers.set(projectId, serverInfo);
            this.saveRegistry();
            
            resolve({
              success: true,
              message: `Server progetto avviato su porta ${port}`,
              projectId,
              serverInfo
            });
          }
        });
    
        serverProcess.stderr.on('data', (data) => {
          const message = data.toString().trim();
          // Distingui tra messaggi informativi e veri errori
          if (message.includes('INIT:') || message.includes('Creating') || message.includes('Starting') || message.includes('Python:')) {
            console.error(`INFO: Server ${projectId}:`, message);
          } else {
            console.error(`ERROR: Server ${projectId} error:`, message);
          }
        });
    
        serverProcess.on('exit', (code) => {
          console.error(`TERMINATED: Server ${projectId} terminato con codice ${code}`);
          this.activeServers.delete(projectId);
          this.saveRegistry();
        });
      });
    }
  • Zod input schema for project_open tool: requires projectPath string
    "๐Ÿš€ DEFAULT TOOL for opening Visum projects. Always use this tool when asked to open, load, or launch any Visum project. Creates dedicated TCP server for ultra-fast communication.",
    {
      projectPath: z.string().describe("Full path to the Visum project file (.ver)")
  • Helper to generate unique projectId from path
    generateProjectId(projectPath: string): string {
      // Genera ID unico basato sul path del progetto
      const projectName = basename(projectPath, '.ver');
      const hash = Math.abs(projectPath.split('').reduce((a: number, b: string) => {
        a = ((a << 5) - a) + b.charCodeAt(0);
        return a & a;
      }, 0));
      return `${projectName}_${hash}`;
    }
  • Registry persistence helpers for active project servers
    loadRegistry() {
      if (existsSync(this.registryFile)) {
        try {
          const data = JSON.parse(readFileSync(this.registryFile, 'utf8'));
          this.activeServers = new Map(Object.entries(data.servers || {}));
          this.nextPort = data.nextPort || 7900;
        } catch (error: any) {
          console.error('โš ๏ธ Errore caricamento registry:', error.message);
        }
      }
    }
    
    saveRegistry() {
      const registryData = {
        servers: Object.fromEntries(this.activeServers),
        nextPort: this.nextPort,
        lastUpdate: new Date().toISOString()
      };
      writeFileSync(this.registryFile, JSON.stringify(registryData, null, 2));
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and adds valuable behavioral context beyond the basic 'open' function. It discloses that the tool 'Creates dedicated TCP server for ultra-fast communication' and provides error-handling guidance. However, it doesn't mention potential side effects like resource consumption or whether multiple instances can be opened simultaneously.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with three sentences that each serve distinct purposes: declaring the tool's role, describing a key behavioral trait, and providing error-handling guidance. It uses emojis and formatting effectively without unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with 100% schema coverage but no annotations or output schema, the description provides good context about the tool's behavior and usage. It could be more complete by explaining what 'opening' entails (e.g., whether it loads into memory, starts a session) or describing potential return values, but it adequately covers the essential information for tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents the single 'projectPath' parameter. The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score of 3 for adequate coverage through structured data alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'opening Visum projects' with the specific action 'open, load, or launch' and resource 'Visum project'. It distinguishes from siblings by being the 'DEFAULT TOOL' for this function, differentiating from other project-related tools like 'project_close' or 'project_execute'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: 'Always use this tool when asked to open, load, or launch any Visum project' and 'If you encounter errors, run 'instance_diagnosis' first!'. It clearly states when to use it (for opening projects) and references an alternative diagnostic tool for error scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/multiluca2020/visum-thinker-mcp-server'

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