Skip to main content
Glama
nickgnd
by nickgnd

find-session

Locate a specific tmux session by its name to enable interaction and control within the Tmux MCP Server, facilitating terminal session management.

Instructions

Find a tmux session by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the tmux session to find

Implementation Reference

  • src/index.ts:53-78 (registration)
    Registration of the find-session tool, including description, Zod input schema, and inline handler function that delegates to tmux.findSessionByName.
    server.tool( "find-session", "Find a tmux session by name", { name: z.string().describe("Name of the tmux session to find") }, async ({ name }) => { try { const session = await tmux.findSessionByName(name); return { content: [{ type: "text", text: session ? JSON.stringify(session, null, 2) : `Session not found: ${name}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error finding tmux session: ${error}` }], isError: true }; } } );
  • Zod schema defining the 'name' parameter for the find-session tool.
    { name: z.string().describe("Name of the tmux session to find") },
  • The tool handler logic: calls tmux helper, formats response as JSON or error message.
    async ({ name }) => { try { const session = await tmux.findSessionByName(name); return { content: [{ type: "text", text: session ? JSON.stringify(session, null, 2) : `Session not found: ${name}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error finding tmux session: ${error}` }], isError: true }; } }
  • Core helper implementation: lists all sessions and finds the one matching the name.
    export async function findSessionByName(name: string): Promise<TmuxSession | null> { try { const sessions = await listSessions(); return sessions.find(session => session.name === name) || null; } catch (error) { return null; } }
  • TypeScript interface defining the structure of a TmuxSession object returned by the tool.
    export interface TmuxSession { id: string; name: string; attached: boolean; windows: number; }

Other Tools

Related 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/nickgnd/tmux-mcp'

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