Skip to main content
Glama
carloshpdoc

memorydetective

List xctrace recording templates

listTraceTemplates

Returns parsed standard and custom xctrace templates for selecting a profile template, such as 'Time Profiler' or 'Allocations'.

Instructions

[mg.discover] Run xcrun xctrace list templates and return parsed standard + custom templates. Useful when picking a template name for recordTimeProfile (e.g. "Time Profiler", "Animation Hitches", "Allocations").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that executes the tool. It runs `xcrun xctrace list templates` via runCommand, checks exit code, and returns parsed templates.
    export async function listTraceTemplates(
      _input: ListTraceTemplatesInput,
    ): Promise<ListTraceTemplatesResult> {
      const result = await runCommand("xcrun", ["xctrace", "list", "templates"], {
        timeoutMs: 15_000,
      });
      if (result.code !== 0) {
        throw new Error(
          `xctrace list templates failed (code ${result.code}): ${result.stderr || result.stdout}`,
        );
      }
      return { ok: true, templates: parseTemplateListing(result.stdout) };
    }
  • Pure helper function `parseTemplateListing` that parses the 'xctrace list templates' output, extracting standard and custom template names.
    export function parseTemplateListing(text: string): TraceTemplate[] {
      const lines = text.split(/\r?\n/);
      let category: TraceTemplate["category"] | null = null;
      const templates: TraceTemplate[] = [];
      for (const raw of lines) {
        const line = raw.trim();
        if (!line) continue;
        if (line === "== Standard Templates ==") {
          category = "standard";
          continue;
        }
        if (line === "== Custom Templates ==") {
          category = "custom";
          continue;
        }
        if (!category) continue;
        if (line.startsWith("==")) continue;
        templates.push({ name: line, category });
      }
      return templates;
    }
  • Zod schema (empty object), TypeScript types, and interfaces for the tool's input/output. Defines the TraceTemplate and ListTraceTemplatesResult interfaces.
    import { z } from "zod";
    import { runCommand } from "../runtime/exec.js";
    
    export const listTraceTemplatesSchema = z.object({});
    
    export type ListTraceTemplatesInput = z.infer<typeof listTraceTemplatesSchema>;
    
    export interface TraceTemplate {
      name: string;
      /** "standard" for built-in templates, "custom" for user templates. */
      category: "standard" | "custom";
    }
    
    export interface ListTraceTemplatesResult {
      ok: boolean;
      templates: TraceTemplate[];
    }
  • src/index.ts:265-279 (registration)
    Tool registration in the MCP server: registers 'listTraceTemplates' with title, description, inputSchema, and a handler that calls listTraceTemplates and returns JSON text content.
    server.registerTool(
      "listTraceTemplates",
      {
        title: "List xctrace recording templates",
        description:
          "[mg.discover] Run `xcrun xctrace list templates` and return parsed standard + custom templates. Useful when picking a template name for `recordTimeProfile` (e.g. \"Time Profiler\", \"Animation Hitches\", \"Allocations\").",
        inputSchema: listTraceTemplatesSchema.shape,
      },
      async (input) => {
        const result = await listTraceTemplates(input);
        return {
          content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
        };
      },
    );
Behavior3/5

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

Without annotations, the description carries the burden. It explains the tool runs a command and returns parsed output, but does not discuss side effects, permissions, or error conditions. Adequate for a simple list operation.

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 two sentences: one for action, one for use case. No redundancy, front-loaded information. Every sentence earn its place.

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?

For a zero-parameter tool without output schema, the description covers purpose and use case adequately. It mentions parsed output but could elaborate on return format. Still complete enough.

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?

There are no parameters, and schema coverage is 100%. The description adds context about the tool's purpose beyond the schema, fulfilling the baseline.

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 it runs a specific command and returns parsed templates, with explicit examples of template names. It stands out from sibling tools like recordTimeProfile.

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 indicates it is useful before using recordTimeProfile, providing example template names. It lacks explicit when-not-to-use or alternatives, but context from sibling tools makes it clear.

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/carloshpdoc/memorydetective'

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