Skip to main content
Glama

shake

Simulate a shake gesture on iOS simulators and Android emulators for testing motion-sensitive app behavior.

Instructions

Simule un geste de shake sur le device. iOS : via raccourci Simulator (Ctrl+Cmd+Z). Android : swipes rapides.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:21-21 (registration)
    Import of registerShake from device-actions.ts
    import { registerShake, registerRotate } from "./tools/device-actions.js";
  • src/index.ts:58-58 (registration)
    Registration call: registerShake(server) invoked to register the shake tool with the MCP server
    registerShake(server);
  • Handler function registerShake: defines the 'shake' MCP tool. For iOS it simulates shake via AppleScript (Ctrl+Cmd+Z keystroke), for Android it calls androidShake() which does rapid swipes.
    export function registerShake(server: McpServer): void {
      server.tool(
        "shake",
        "Simule un geste de shake sur le device. iOS : via raccourci Simulator (Ctrl+Cmd+Z). Android : swipes rapides.",
        {},
        async () => {
          const result = await resolveDevice();
          if ("error" in result) return { content: [{ type: "text", text: result.error }], isError: true };
          const dev = result.device;
    
          try {
            if (dev.platform === "ios") {
              // Ctrl+Cmd+Z = Hardware > Shake Gesture in Simulator
              try {
                await execFileAsync("osascript", ["-e",
                  'tell application "Simulator" to activate',
                ]);
                await new Promise((r) => setTimeout(r, 300));
                await execFileAsync("osascript", ["-e",
                  'tell application "System Events" to keystroke "z" using {control down, command down}',
                ]);
              } catch (err) {
                console.error(`[phantom] Shake AppleScript failed: ${err instanceof Error ? err.message : err}`);
                return { content: [{ type: "text", text: "Shake envoyé. Note : le Simulator doit être au premier plan et les permissions Accessibility activées." }] };
              }
            } else {
              await androidShake();
            }
    
            logAction("shake", "Shake effectué", false, dev.platform, dev.id, dev.name);
            return { content: [{ type: "text", text: "Shake effectué." }] };
          } catch (err) {
            const msg = err instanceof Error ? err.message : String(err);
            return { content: [{ type: "text", text: `Erreur shake: ${msg}` }], isError: true };
          }
        }
      );
    }
  • Empty schema (no input parameters) for the shake tool
    {},
  • androidShake helper: simulates a shake on Android by performing 3 rapid side-to-side swipes on the center of the screen
    export async function androidShake(): Promise<void> {
      // Simulate sensor events for shake — rapid x-axis accelerometer changes
      // This uses `input swipe` as a workaround — real shake needs instrumentation
      const size = await androidGetScreenSize();
      const cx = size.width / 2, cy = size.height / 2;
      // Rapid side-to-side swipes simulate a shake visually
      await androidSwipe(cx - 100, cy, cx + 100, cy, 50);
      await androidSwipe(cx + 100, cy, cx - 100, cy, 50);
      await androidSwipe(cx - 100, cy, cx + 100, cy, 50);
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses the underlying mechanism (shortcut vs. swipes), adding value beyond 'shake'. However, it doesn't mention potential side effects, limitations (e.g., on iOS only in Simulator), or expected UI consequences.

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 concise sentences, no filler, front-loaded with action. Every sentence earns 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 parameterless tool with no output schema, the description is complete enough: it states purpose and platform-specific execution. Could mention environment requirements (e.g., iOS Simulator only) but overall sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 0 parameters, so baseline is 4. Description doesn't need to add parameter info; it correctly omits any param details.

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?

Description clearly states 'Simule un geste de shake' (simulates a shake gesture), which is a specific verb+resource. It is distinct from sibling tools like swipe, tap, etc.

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?

Provides platform-specific methods (iOS shortcut, Android swipes), giving clear instructions on how to trigger the shake. However, it does not explicitly state when to use it vs alternatives, though the niche gesture makes context obvious.

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/nthImpulse/phantom-mcp'

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