Skip to main content
Glama
carloshpdoc

memorydetective

List physical devices and simulators

listTraceDevices

Discover iOS devices and simulators along with their UDIDs for performance tracing. Run before recording time profiles to automatically select the correct device.

Instructions

[mg.discover] Run xcrun xctrace list devices and return parsed devices/simulators with their UDIDs. The LLM should call this before recordTimeProfile to discover the right UDID without asking the user. Set includeOffline: true to include disconnected devices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeOfflineNoInclude devices listed under "Devices Offline" (default false).

Implementation Reference

  • Main handler: runs `xcrun xctrace list devices`, parses output, optionally filters offline devices, returns list of devices with UDIDs.
    export async function listTraceDevices(
      input: ListTraceDevicesInput,
    ): Promise<ListTraceDevicesResult> {
      const result = await runCommand("xcrun", ["xctrace", "list", "devices"], {
        timeoutMs: 30_000,
      });
      if (result.code !== 0) {
        throw new Error(
          `xctrace list devices failed (code ${result.code}): ${result.stderr || result.stdout}`,
        );
      }
      let devices = parseDeviceListing(result.stdout);
      if (!input.includeOffline) {
        devices = devices.filter((d) => d.kind !== "device-offline");
      }
      return { ok: true, devices };
    }
  • Input schema: accepts optional `includeOffline` boolean (default false).
    export const listTraceDevicesSchema = z.object({
      includeOffline: z
        .boolean()
        .default(false)
        .describe("Include devices listed under \"Devices Offline\" (default false)."),
    });
  • Output types: DeviceKind, TraceDevice interface, and ListTraceDevicesResult interface.
    export type DeviceKind = "device" | "device-offline" | "simulator";
    
    export interface TraceDevice {
      kind: DeviceKind;
      name: string;
      /** OS version when the listing carries one (e.g. "26.3.1"). */
      osVersion?: string;
      udid: string;
    }
    
    export interface ListTraceDevicesResult {
      ok: boolean;
      devices: TraceDevice[];
    }
  • Pure parser function: parses the raw text output of `xctrace list devices` into structured TraceDevice objects.
    export function parseDeviceListing(text: string): TraceDevice[] {
      const lines = text.split(/\r?\n/);
      let kind: DeviceKind | null = null;
      const devices: TraceDevice[] = [];
      for (const raw of lines) {
        const line = raw.trim();
        if (!line) continue;
        if (line in SECTION_TO_KIND) {
          kind = SECTION_TO_KIND[line];
          continue;
        }
        if (!kind) continue;
        const m = line.match(LINE_RE);
        if (!m) continue;
        devices.push({
          kind,
          name: m[1].trim(),
          osVersion: m[2],
          udid: m[3],
        });
      }
      return devices;
    }
  • src/index.ts:249-263 (registration)
    Registration of the tool 'listTraceDevices' in the MCP server with title, description, input schema, and handler wrapper.
    server.registerTool(
      "listTraceDevices",
      {
        title: "List physical devices and simulators",
        description:
          "[mg.discover] Run `xcrun xctrace list devices` and return parsed devices/simulators with their UDIDs. The LLM should call this before `recordTimeProfile` to discover the right UDID without asking the user. Set `includeOffline: true` to include disconnected devices.",
        inputSchema: listTraceDevicesSchema.shape,
      },
      async (input) => {
        const result = await listTraceDevices(input);
        return {
          content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
        };
      },
    );
Behavior4/5

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

No annotations provided, so the description carries full burden. It discloses that it runs a command and returns parsed data, and explains the parameter effect. However, it doesn't mention idempotency or potential side effects (though likely none).

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?

Three sentences with no wasted words: it states the action, the purpose, and the parameter usage. Very efficient.

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 list tool with no output schema, the description covers functionality and usage context. It could detail the return structure (e.g., 'returns array of objects with name and UDID'), but the current level is sufficient for an agent.

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% and already describes includeOffline. The description restates the parameter usage without adding new semantic information beyond the schema.

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 explicitly states the tool runs a shell command to list devices/simulators with UDIDs, and ties it to a specific use case (before recordTimeProfile). This clearly distinguishes it from all sibling tools.

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

Usage Guidelines5/5

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

The description gives direct instruction: 'The LLM should call this before recordTimeProfile to discover the right UDID without asking the user.' It also explains when to set includeOffline=true.

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