Skip to main content
Glama

adb_file_replace

Find and replace literal text in Android device files using ADB. Supports global or first-only replacement, line-targeted edits, and backup creation.

Instructions

Find and replace text in a file on the device. Uses sed internally with proper escaping — exposes a safe interface without requiring sed syntax knowledge. Supports global replacement, line-targeted edits, and optional backup creation. Reports match count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path on device
findYesText to find (literal string, not regex)
replaceYesReplacement text
globalNoReplace all occurrences (default: true). Set false for first-only.
lineNumberNoRestrict replacement to a specific line number
backupNoCreate a .bak backup before modifying
rootNoUse root shell for protected paths
deviceNoDevice serial
Behavior4/5

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

No annotations provided, so description must carry behavioral info. It discloses internal mechanism (sed with escaping), reports match count, and mentions root flag for protected paths. Could add that file modification is destructive without backup, but sufficient.

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. Front-loaded with the tool's purpose. No redundant information. Every sentence adds value.

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?

With 8 parameters, no output schema, and no annotations, the description covers major behaviors (find/replace, global, line-targeted, backup, root). Could mention that it works on text files only. Overall, fairly complete for a focused tool.

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?

Schema covers all parameters with descriptions. Description adds context: 'Supports global replacement, line-targeted edits, and optional backup creation' mapping to global, lineNumber, backup. Also mentions match count reporting, a behavior not in schema. Credit for adding beyond 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 clearly states 'Find and replace text in a file on the device.' It specifies the verb (find and replace) and resource (file on device). It distinguishes from siblings like adb_grep (search only) and adb_file_write (overwrite entire file).

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?

It mentions using sed internally with proper escaping, providing a safe interface without requiring sed syntax knowledge. It describes options: global replacement, line-targeted edits, backup creation. Could explicitly state when not to use it (e.g., binary files) and alternatives, but overall 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/fullread/DeepADB'

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