Skip to main content
Glama

list_surfaces

Lists all terminal and browser panes across workspaces to manage parallel AI agent sessions and monitor their activities.

Instructions

List all surfaces (terminal/browser panes) across workspaces

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNoFilter by workspace ref
include_screen_previewNoInclude screen content preview
preview_linesNoNumber of preview lines

Implementation Reference

  • The 'list_surfaces' tool is defined and registered in src/server.ts, providing a handler that interacts with the CmuxClient to list workspaces, panes, and surfaces, with optional screen preview capabilities.
    // 1. list_surfaces
    server.tool(
      "list_surfaces",
      "List all surfaces (terminal/browser panes) across workspaces",
      {
        workspace: z.string().optional().describe("Filter by workspace ref"),
        include_screen_preview: z
          .boolean()
          .optional()
          .default(false)
          .describe("Include screen content preview"),
        preview_lines: z
          .number()
          .int()
          .min(1)
          .max(50)
          .optional()
          .default(8)
          .describe("Number of preview lines"),
      },
      async (args) => {
        try {
          const workspaces = await client.listWorkspaces();
          const targetWorkspaceRefs = args.workspace
            ? [args.workspace]
            : workspaces.workspaces.map((workspace) => workspace.ref);
          const panesByWorkspace = await Promise.all(
            targetWorkspaceRefs.map(async (workspaceRef) => ({
              workspaceRef,
              panes: await client.listPanes({ workspace: workspaceRef }),
            })),
          );
          const surfaceGroups = await Promise.all(
            panesByWorkspace.flatMap(({ workspaceRef, panes }) =>
              panes.panes.map((pane) =>
                client.listPaneSurfaces({
                  workspace: workspaceRef,
                  pane: pane.ref,
                }),
              ),
            ),
          );
          const surfaces = await Promise.all(
            surfaceGroups.flatMap((group) =>
              group.surfaces.map(async (surface) => {
                const enrichedSurface: Record<string, unknown> = {
                  ...surface,
                  workspace_ref: group.workspace_ref,
                  window_ref: group.window_ref,
                  pane_ref: group.pane_ref,
                };
    
                if (args.include_screen_preview && surface.type === "terminal") {
                  try {
                    const preview = await client.readScreen(surface.ref, {
                      workspace: group.workspace_ref,
                      lines: args.preview_lines,
                    });
                    enrichedSurface.screen_preview = preview.text;
                  } catch (error) {
                    enrichedSurface.screen_preview_error =
                      error instanceof Error ? error.message : String(error);
                  }
                }
    
                return enrichedSurface;
              }),
            ),
          );
          return ok({
            workspaces: workspaces.workspaces,
            surfaces,
            workspace_ref: args.workspace,
          });
        } catch (e) {
          return err(e);
        }
      },
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it 'List all surfaces' but doesn't disclose behavioral traits such as whether this is a read-only operation, potential rate limits, authentication needs, or how results are returned (e.g., pagination, format). For a tool with no annotations, this is a significant gap in transparency.

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 a single, efficient sentence with zero waste. It front-loads the core purpose ('List all surfaces') and adds clarifying details in parentheses and a phrase. Every word earns its place, making it highly concise and well-structured.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a tool with three parameters and potential complexity. It doesn't explain return values, error conditions, or behavioral context, leaving the agent under-informed. For a list operation with filtering options, more completeness is needed to guide effective use.

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 fully documents the three parameters. The description adds no additional meaning beyond implying filtering by workspace and preview options, which are already covered in the schema. This meets the baseline score of 3, as the schema handles parameter documentation adequately.

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

Purpose4/5

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

The description clearly states the verb 'List' and the resource 'surfaces (terminal/browser panes) across workspaces', making the purpose unambiguous. It distinguishes the scope as 'across workspaces', which is helpful. However, it doesn't explicitly differentiate from sibling tools like 'read_screen' or 'browser_surface', which might handle specific surface interactions, so it misses the top score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, exclusions, or compare to siblings like 'list_agents' or 'read_screen' for related data. This leaves the agent without context for tool selection, relying solely on the name and purpose.

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/EtanHey/cmuxlayer'

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