Skip to main content
Glama

input_scroll

Simulate scrolling on Android devices for automation and testing. Specify direction (up, down, left, right) to navigate app interfaces.

Instructions

Perform scroll action

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionYesDirection to scroll

Implementation Reference

  • The handler function for the 'input_scroll' tool. It destructures the direction from args, maps it to an ADB swipe command, executes the command, captures the updated UI content, and returns a response with a confirmation message and the UI dump.
    input_scroll: async (args: any) => { const { direction } = args as { direction: string }; const scrollCommands = { up: 'adb shell input swipe 500 800 500 400', down: 'adb shell input swipe 500 400 500 800', left: 'adb shell input swipe 800 500 400 500', right: 'adb shell input swipe 400 500 800 500', }; const command = scrollCommands[direction as keyof typeof scrollCommands]; if (!command) { throw new McpError(ErrorCode.InvalidParams, `Invalid direction: ${direction}`); } await executeCommand(command); const uiContent = await captureUIContent(false); return { content: [ { type: 'text', text: `Scroll executed: ${direction}`, }, ...uiContent, ], }; },
  • The schema definition for the 'input_scroll' tool, including name, description, and inputSchema specifying the required 'direction' parameter with allowed values.
    name: 'input_scroll', description: 'Perform scroll action', inputSchema: { type: 'object', properties: { direction: { type: 'string', enum: ['up', 'down', 'left', 'right'], description: 'Direction to scroll', }, }, required: ['direction'], }, },
  • src/index.ts:32-46 (registration)
    The MCP server request handler for CallToolRequestSchema that dynamically dispatches to the appropriate tool handler (including input_scroll) from the toolHandlers object based on the tool name.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const handler = toolHandlers[name as keyof typeof toolHandlers]; if (!handler) { throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); } return await handler(args); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${errorMessage}`); } });
  • src/index.ts:26-30 (registration)
    The MCP server request handler for ListToolsRequestSchema that returns the list of tool definitions, including the schema for input_scroll.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions, }; });

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/TiagoDanin/Android-Debug-Bridge-MCP'

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