Skip to main content
Glama
aflsolutions

ShadowGit MCP Server

by aflsolutions

start_session

Initialize a work session before making changes to prevent fragmented auto-commits. Always call this first to enable organized commit tracking.

Instructions

Start a work session. MUST be called BEFORE making any changes. Without this, ShadowGit will create fragmented auto-commits during your work!

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoYesRepository name
descriptionYesWhat you plan to do in this session

Implementation Reference

  • The main handler function for the 'start_session' tool. Validates args (repo and description), resolves the repo path, calls sessionClient.startSession(), and returns a success response with the session ID or an error.
      async startSession(args: unknown): Promise<MCPToolResponse> {
        // Validate args
        if (!this.isStartSessionArgs(args)) {
          return createErrorResponse(
            'Error: Both "repo" and "description" are required for start_session.'
          );
        }
    
        // Resolve repository
        const repoPath = this.repositoryManager.resolveRepoPath(args.repo);
        if (!repoPath) {
          return createErrorResponse(
            `Error: Repository '${args.repo}' not found. Use list_repos() to see available repositories.`
          );
        }
    
        // Start session
        const sessionId = await this.sessionClient.startSession({
          repoPath,
          aiTool: 'MCP Client',
          description: args.description
        });
    
        if (sessionId) {
          log('info', `Session started: ${sessionId}`);
          return {
            content: [{
              type: 'text',
              text: `Session started successfully.
    Session ID: ${sessionId}
    
    📋 **Your Workflow Checklist:**
    1. Make your changes
    2. Call checkpoint() to commit
    3. Call end_session() with this session ID`
            }]
          };
        }
    
        // Fallback if Session API is offline
        return createErrorResponse(
          'Session API is offline. Proceeding without session tracking.'
        );
      }
  • The StartSessionArgs interface defining required input fields: repo (string) and description (string).
    interface StartSessionArgs {
      repo: string;
      description: string;
    }
  • The SessionStartRequest type sent to the Session API containing repoPath, aiTool, and description.
    export interface SessionStartRequest {
      repoPath: string;
      aiTool: string;
      description: string;
    }
    
    export interface SessionStartResponse {
      success: boolean;
      sessionId?: string;
      error?: string;
    }
  • Tool registration in the MCP server's ListToolsRequestSchema handler, defining the name 'start_session', description, and inputSchema (repo and description as required strings).
    {
      name: 'start_session',
      description: 'Start a work session. MUST be called BEFORE making any changes. Without this, ShadowGit will create fragmented auto-commits during your work!',
      inputSchema: {
        type: 'object',
        properties: {
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          description: {
            type: 'string',
            description: 'What you plan to do in this session',
          },
        },
        required: ['repo', 'description'],
      },
    },
  • Routing in the CallToolRequestSchema handler: the 'start_session' case delegates to sessionHandler.startSession(args).
    case 'start_session':
      return await this.sessionHandler.startSession(args);
  • The HTTP client method that POSTs to the Session API's /session/start endpoint with SessionStartRequest data and returns the sessionId string or null on failure.
    async startSession(data: SessionStartRequest): Promise<string | null> {
      try {
        const controller = new AbortController();
        const timeoutId = setTimeout(() => controller.abort(), this.timeout);
    
        const response = await fetch(`${this.baseUrl}/session/start`, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify(data),
          signal: controller.signal,
        });
    
        clearTimeout(timeoutId);
    
        if (response.ok) {
          const result = await response.json() as SessionStartResponse;
          if (result.success && result.sessionId) {
            log('info', `Session started: ${result.sessionId} for ${data.repoPath}`);
            return result.sessionId;
          }
        }
        
        log('warn', `Failed to start session: ${response.status} ${response.statusText}`);
      } catch (error) {
        // Silently fail - don't break MCP if Session API is down
        if (error instanceof Error && error.name !== 'AbortError') {
          log('debug', `Session API unavailable: ${error.message}`);
        }
      }
      return null;
    }
  • Type guard isStartSessionArgs that validates the incoming args object has 'repo' and 'description' string properties.
    private isStartSessionArgs(args: unknown): args is StartSessionArgs {
      return (
        typeof args === 'object' &&
        args !== null &&
        'repo' in args &&
        'description' in args &&
        typeof (args as StartSessionArgs).repo === 'string' &&
        typeof (args as StartSessionArgs).description === 'string'
      );
    }
Behavior4/5

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

With no annotations, the description carries full burden. It discloses that the tool is a setup action required before changes, and lack thereof leads to fragmented auto-commits. It does not detail session behavior or side effects, but is sufficient for a start session tool.

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?

Two efficient sentences front-loaded with purpose, no redundant information.

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?

The description covers purpose and necessity, but lacks mention of return value and does not connect to sibling end_session for ending the session. Still fairly complete for a startup tool with no output schema.

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 coverage is 100% with descriptions for both repo and description. The description adds no extra meaning beyond 'what you plan to do' aligning with description parameter. Baseline 3 is appropriate.

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: 'Start a work session.' It also distinguishes this tool from siblings by emphasizing its prerequisite nature before making changes, which separates it from checkpoint, end_session, git_command, and list_repos.

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

Usage Guidelines4/5

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

The description provides explicit when-to-use guidance: 'MUST be called BEFORE making any changes.' It warns of consequences (fragmented auto-commits) if not used, but does not explicitly mention alternatives or when not to use.

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/aflsolutions/shadowgit-mcp'

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