Skip to main content
Glama
charlesmuchene

Android Preference Editor MCP Server

list_apps

Retrieve installed applications on an Android device by providing the device serial number. This tool supports app development by enabling access to app listings for preference management.

Instructions

Lists apps installed on device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesThe device's serial number.

Implementation Reference

  • The handler function for the list_apps tool. It validates the input connection (deviceId), calls listApps from the external library, and formats the app package names as text content. Handles errors by returning an error response.
    async (connection: z.infer<typeof DeviceSchema>) => {
      try {
        validate(connection, DeviceSchema);
    
        return {
          content: (await listApps(connection)).map((app) => ({
            type: "text",
            text: app.packageName,
          })),
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: error instanceof Error ? error.message : "Unknown error",
            },
          ],
        };
      }
    }
  • DeviceSchema defines the input schema for list_apps, requiring a deviceId string.
    export const DeviceSchema = z.object({
      deviceId: z.string().describe("The device's serial number."),
    });
  • Registers the list_apps tool on the MCP server within configureCommonTools, specifying name, description, input schema (DeviceSchema.shape), and the handler function.
    server.tool(
      "list_apps",
      "Lists apps installed on device",
      DeviceSchema.shape,
      async (connection: z.infer<typeof DeviceSchema>) => {
        try {
          validate(connection, DeviceSchema);
    
          return {
            content: (await listApps(connection)).map((app) => ({
              type: "text",
              text: app.packageName,
            })),
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: error instanceof Error ? error.message : "Unknown error",
              },
            ],
          };
        }
      }
    );
  • validate function used in the list_apps handler to validate the input against DeviceSchema.
    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 provided, the description carries the full burden of behavioral disclosure. It states it 'lists' apps, implying a read-only operation, but doesn't clarify permissions, rate limits, output format, or whether it's a complete list or filtered. This leaves significant behavioral gaps for a tool with no annotation coverage.

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, clear sentence with zero wasted words. It's front-loaded and efficiently communicates the core purpose without unnecessary elaboration, earning full marks for conciseness.

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 no annotations and no output schema, the description is incomplete for a tool that lists resources. It doesn't explain what the output looks like (e.g., list format, fields included), potential limitations, or error conditions, making it inadequate for full contextual understanding.

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 schema description coverage is 100%, with the single parameter 'deviceId' documented as 'The device's serial number.' The description adds no additional parameter semantics beyond this, so it meets the baseline score for high schema coverage without extra 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 the resource ('apps installed on device'), providing a specific purpose. However, it doesn't differentiate from sibling tools like 'list_files' or 'devices' which might also list device-related information, so it misses the top 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?

The description provides no guidance on when to use this tool versus alternatives like 'devices' or 'list_files'. There's no mention of prerequisites, context, or exclusions, leaving the agent with minimal usage direction.

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