MCP Tool Guide

This guide helps you understand what the Deephaven MCP tools can do and how to use them effectively with AI assistants like GitHub Copilot.

Note: The AI assistant can see the full tool schemas automatically. This guide focuses on when and how to use each tool.

Quick Reference

CategoryToolsPurpose
Server ManagementconnectToServer, listServersConnect to and list configured servers
ConnectionslistConnectionsCheck active connections
Code ExecutionrunCode, runCodeFromUriExecute Python/Groovy code
LogginggetLogs, showOutputPanelAccess and view logs

Server Management

Listing and Connecting to Servers

Use listServers to see what Deephaven servers are configured in your VS Code settings. This is useful when you need to check server status or see what's available.

Use connectToServer to create a connection to a configured server. You need a connection before you can run code.

Common patterns:

Important notes:

  • Servers must be configured in VS Code settings first (see Configuration).
  • Community servers auto-start if they're pip-managed.
  • The AI can find servers by URL or label when connecting.
  • Connecting to Enterprise servers creates a new worker.

Running Code

Execute Code Snippets or Files

Use runCode when you want to execute code directly (like "run this Python snippet").

Use runCodeFromUri when working with files in your workspace (like "run this file" or "run lines 10-20").

Auto-connection: If you're not connected, runCode will try to connect automatically to a running server.

Common patterns:

Important notes:

  • Language is detected from the file extension or specified explicitly.
  • Variables created by the code are returned in the response.

Checking Connections

See What's Connected

Use listConnections to see active connections and their status.

Common patterns:

Useful for:

  • Debugging connection issues.
  • Checking if code is currently running.
  • Resolving connection names to URLs.

Accessing Logs

View Extension Output

Use getLogs to retrieve log history programmatically. Specify "server" for server logs or "debug" for detailed diagnostics.

Use showOutputPanel to open the VS Code Output panel in the UI.

Common patterns:

Useful for:

  • Debugging connection issues.
  • Investigating code execution errors.
  • Seeing what happened during operations.

Getting Help

If tools aren't working as expected:

  1. Use getLogs to see what errors occurred.
  2. Verify your server configuration in VS Code settings.
  3. Check that the MCP server is enabled (deephaven.mcp.enabled).
  4. Check the VS Code Output panel (View → Output → Deephaven) for error messages.