Skip to main content
Glama
charlesmuchene

Android Preference Editor MCP Server

list_files

Lists preference files for an Android app to view and edit preferences during development. Specify device serial number and app package name.

Instructions

Lists preference files for an app

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesThe device's serial number.
appIdYesThe application's package name.

Implementation Reference

  • The handler function for the 'list_files' tool. It validates the input using AppSchema, calls the external listFiles function with the connection, maps the results to text content, and handles errors.
    async (connection: z.infer<typeof AppSchema>) => {
      try {
        validate(connection, AppSchema);
    
        return {
          content: (await listFiles(connection)).map((file) => ({
            type: "text",
            text: file.name,
          })),
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: error instanceof Error ? error.message : "Unknown error",
            },
          ],
        };
      }
    }
  • Zod schemas defining the input structure for the 'list_files' tool. AppSchema extends DeviceSchema and is used as AppSchema.shape in the tool registration.
    export const DeviceSchema = z.object({
      deviceId: z.string().describe("The device's serial number."),
    });
    
    export const AppSchema = DeviceSchema.extend({
      appId: z.string().describe("The application's package name."),
    });
  • Registration of the 'list_files' tool on the MCP server within the configureCommonTools function, specifying name, description, input schema, and handler.
    server.tool(
      "list_files",
      "Lists preference files for an app",
      AppSchema.shape,
      async (connection: z.infer<typeof AppSchema>) => {
        try {
          validate(connection, AppSchema);
    
          return {
            content: (await listFiles(connection)).map((file) => ({
              type: "text",
              text: file.name,
            })),
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: error instanceof Error ? error.message : "Unknown error",
              },
            ],
          };
        }
      }
    );
  • Helper function 'validate' used in the list_files handler to validate input against the AppSchema.
    export const validate = (input: unknown, type: ZodType) => {
      const validationResult = type.safeParse(input);
      if (!validationResult.success)
        throw new Error(
          `Invalid input: ${validationResult.error.errors
            .map((err) => err.message)
            .join(", ")}`
        );
Behavior2/5

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

With no annotations, the description carries the full burden but only states what the tool does without disclosing behavioral traits like whether it's read-only, if it requires specific permissions, rate limits, or what the output format looks like. This leaves significant gaps for a tool with two required parameters.

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 a single, efficient sentence with no wasted words, making it front-loaded and easy to parse. Every part of the sentence contributes directly to understanding the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a tool with two required parameters, no annotations, and no output schema, the description is incomplete. It lacks information on behavioral aspects, output format, and usage context, which are essential for effective tool invocation by an AI 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?

The input schema has 100% description coverage, providing clear details for both parameters (deviceId and appId). The description adds no additional meaning beyond the schema, so it meets the baseline for high schema coverage without compensating or adding value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Lists') and resource ('preference files for an app'), making the purpose understandable. It doesn't explicitly differentiate from sibling tools like 'list_apps' or 'read_preferences', which prevents a perfect score.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives such as 'list_apps' (which might list apps instead of files) or 'read_preferences' (which might read preference content). The description implies usage for listing files but lacks explicit context or exclusions.

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/charlesmuchene/pref-editor-mcp-server'

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