Skip to main content
Glama

stop_sim_log_cap

Stop an active simulator log capture session and retrieve the collected logs for analysis.

Instructions

Stops an active simulator log capture session and returns the captured logs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
logSessionIdYesThe session ID returned by start_sim_log_cap.

Implementation Reference

  • Handler function for the 'stop_sim_log_cap' tool. Validates input, calls stopLogCapture utility, and formats the response with captured logs or error.
    async function handler(params: { logSessionId: string }): Promise<ToolResponse> {
      const validationResult = validateRequiredParam('logSessionId', params.logSessionId);
      if (!validationResult.isValid) {
        return validationResult.errorResponse!;
      }
      const { logContent, error } = await stopLogCapture(params.logSessionId);
      if (error) {
        return {
          content: [
            createTextContent(`Error stopping log capture session ${params.logSessionId}: ${error}`),
          ],
          isError: true,
        };
      }
      return {
        content: [
          createTextContent(
            `Log capture session ${params.logSessionId} stopped successfully. Log content follows:\n\n${logContent}`,
          ),
        ],
      };
    }
  • Input schema for the 'stop_sim_log_cap' tool using Zod, requiring logSessionId.
    const schema = {
      logSessionId: z.string().describe('The session ID returned by start_sim_log_cap.'),
    };
  • Registration of the 'stop_sim_log_cap' tool using registerTool on the MCP server.
    registerTool(
      server,
      'stop_sim_log_cap',
      'Stops an active simulator log capture session and returns the captured logs.',
      schema,
      handler,
    );
  • Core utility function stopLogCapture that terminates log capture processes, reads the log file content, and cleans up the session from activeLogSessions map.
    export async function stopLogCapture(
      logSessionId: string,
    ): Promise<{ logContent: string; error?: string }> {
      const session = activeLogSessions.get(logSessionId);
      if (!session) {
        log('warning', `Log session not found: ${logSessionId}`);
        return { logContent: '', error: `Log capture session not found: ${logSessionId}` };
      }
    
      try {
        log('info', `Attempting to stop log capture session: ${logSessionId}`);
        const logFilePath = session.logFilePath;
        for (const process of session.processes) {
          if (!process.killed && process.exitCode === null) {
            process.kill('SIGTERM');
          }
        }
        activeLogSessions.delete(logSessionId);
        log(
          'info',
          `Log capture session ${logSessionId} stopped. Log file retained at: ${logFilePath}`,
        );
        await fs.promises.access(logFilePath, fs.constants.R_OK);
        const fileContent = await fs.promises.readFile(logFilePath, 'utf-8');
        log('info', `Successfully read log content from ${logFilePath}`);
        return { logContent: fileContent };
      } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        log('error', `Failed to stop log capture session ${logSessionId}: ${message}`);
        return { logContent: '', error: message };
      }
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool stops an active session and returns logs, which covers basic behavior. However, it lacks details on error handling, side effects (e.g., whether logs are saved or deleted), or performance aspects like rate limits, leaving gaps 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, well-structured sentence that efficiently conveys the tool's action, resource, and outcome without any redundant information. It is front-loaded with the core purpose, making it highly concise and effective.

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?

Given the tool's moderate complexity (a mutation operation with no annotations and no output schema), the description is reasonably complete. It covers the purpose, usage hint, and outcome, but could improve by detailing return format or error cases, slightly reducing completeness.

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 single parameter 'logSessionId'. The description adds no additional semantic context beyond what the schema provides (e.g., format or validation rules), resulting in the baseline score of 3.

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 specific action ('stops') and resource ('an active simulator log capture session'), and distinguishes it from siblings by referencing 'start_sim_log_cap' as the initiating tool. It also mentions the outcome ('returns the captured logs'), making the purpose explicit and differentiated.

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 implies usage context by referencing 'start_sim_log_cap' as the source of the session ID, suggesting this tool should be used after starting a capture. However, it does not explicitly state when not to use it or name alternatives, which prevents a perfect score.

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/SampsonKY/XcodeBuildMCP'

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