Skip to main content
Glama
charlesmuchene

Android Preference Editor MCP Server

change_preference

Modify Android app preference values during development by specifying device, app, and preference details.

Instructions

Changes the value of an existing preference

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name/key of the user preference
valueYesThe value of user preference
deviceIdYesThe device's serial number.
appIdYesThe application's package name.
filenameYesThe filename with or without the extension.

Implementation Reference

  • Handler function executing the tool logic: validates input with EditPrefSchema, constructs PartialPreference from name and value, calls external changePreference, returns success or error message.
    async (input: z.infer<typeof EditPrefSchema>) => {
      try {
        validate(input, EditPrefSchema);
    
        const { name, value, ...connection } = input;
    
        const pref: PartialPreference = {
          value,
          key: name,
        };
    
        await changePreference(pref, connection);
    
        return {
          content: [
            {
              type: "text",
              text: `Preference changed`,
            },
          ],
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: error instanceof Error ? error.message : "Unknown error",
            },
          ],
        };
      }
    }
  • Schema definitions culminating in EditPrefSchema = PrefSchema.merge(FileSchema), providing input validation for name, value, filename, appId, deviceId.
    export const FileSchema = AppSchema.extend({
      filename: z.string().describe("The filename with or without the extension."),
    });
    
    export const NameSchema = z.object({
      name: z.string().describe("The name/key of the user preference"),
    });
    
    export const PrefSchema = NameSchema.extend({
      value: z.string().describe("The value of user preference"),
    });
    
    export const TypedPrefSchema = PrefSchema.extend({
      type: z
        .string()
        .describe(
          "The type of the preference value: integer, boolean, float, double, long or string"
        ),
    });
    
    export const AddPrefSchema = TypedPrefSchema.merge(FileSchema);
    
    export const EditPrefSchema = PrefSchema.merge(FileSchema);
  • Registration of the change_preference tool using server.tool with name, description, EditPrefSchema.shape, and handler function.
      "change_preference",
      "Changes the value of an existing preference",
      EditPrefSchema.shape,
      async (input: z.infer<typeof EditPrefSchema>) => {
        try {
          validate(input, EditPrefSchema);
    
          const { name, value, ...connection } = input;
    
          const pref: PartialPreference = {
            value,
            key: name,
          };
    
          await changePreference(pref, connection);
    
          return {
            content: [
              {
                type: "text",
                text: `Preference changed`,
              },
            ],
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: error instanceof Error ? error.message : "Unknown error",
              },
            ],
          };
        }
      }
    );
  • src/index.ts:21-21 (registration)
    Top-level call to configurePreferenceTools(server), which registers the change_preference tool among others.
    configurePreferenceTools(server);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Changes' implies a mutation operation, it doesn't describe what happens on success/failure, whether changes are persistent, if authentication is required, or any side effects. The description is minimal and lacks important behavioral context for a mutation tool.

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 that states the core purpose without unnecessary words. It's appropriately sized for a straightforward tool and front-loads the essential information.

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?

For a mutation tool with 5 required parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens after the change, what format the value should be in, how to verify success, or any constraints on the parameters beyond what's minimally implied by 'existing preference'.

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?

With 100% schema description coverage, all 5 parameters are documented in the schema. The description adds no additional parameter information beyond what's in the schema descriptions. The baseline is 3 when schema coverage is high and description doesn't add parameter semantics.

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 ('Changes') and target resource ('value of an existing preference'), making the purpose immediately understandable. It distinguishes from 'add_preference' by specifying 'existing preference' rather than creating new, but doesn't explicitly differentiate from 'delete_preference' or other siblings beyond the verb choice.

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 'add_preference' or 'delete_preference'. It mentions 'existing preference' which implies the preference must already exist, but doesn't clarify prerequisites, error conditions, or when other tools might be more appropriate.

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