Skip to main content
Glama
charlesmuchene

Android Preference Editor MCP Server

add_preference

Add a new preference to an Android app's configuration by specifying name, value, and type during development.

Instructions

Adds a new preference given the name, value and type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name/key of the user preference
valueYesThe value of user preference
typeYesThe type of the preference value: integer, boolean, float, double, long or string
deviceIdYesThe device's serial number.
appIdYesThe application's package name.
filenameYesThe filename with or without the extension.

Implementation Reference

  • The handler function that executes the 'add_preference' tool logic: validates input, constructs Preference object using parseDataType, calls imported addPreference, returns success/error text response.
    async (input: z.infer<typeof AddPrefSchema>) => {
      try {
        validate(input, AddPrefSchema);
    
        const { name, value, type, ...connection } = input;
    
        const pref: Preference = {
          key: name,
          value,
          type: parseDataType(type),
        };
    
        await addPreference(pref, connection);
    
        return {
          content: [
            {
              type: "text",
              text: `Preference added`,
            },
          ],
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: error instanceof Error ? error.message : "Unknown error",
            },
          ],
        };
      }
    }
  • Registration of the 'add_preference' MCP tool using server.tool() with name, description, AddPrefSchema.shape, and inline handler.
    server.tool(
      "add_preference",
      "Adds a new preference given the name, value and type.",
      AddPrefSchema.shape,
      async (input: z.infer<typeof AddPrefSchema>) => {
        try {
          validate(input, AddPrefSchema);
    
          const { name, value, type, ...connection } = input;
    
          const pref: Preference = {
            key: name,
            value,
            type: parseDataType(type),
          };
    
          await addPreference(pref, connection);
    
          return {
            content: [
              {
                type: "text",
                text: `Preference added`,
              },
            ],
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: error instanceof Error ? error.message : "Unknown error",
              },
            ],
          };
        }
      }
    );
  • Zod schema definitions for preference tools, including AddPrefSchema = TypedPrefSchema.merge(FileSchema) used for input validation of 'add_preference'.
    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);
    
    export const DeletePrefSchema = NameSchema.merge(FileSchema);
  • src/index.ts:21-22 (registration)
    Invocation of configurePreferenceTools which registers the 'add_preference' tool (and others) on the MCP server.
    configurePreferenceTools(server);
    configureCommonTools(server);
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It states the tool 'adds' a preference, implying a write operation, but doesn't cover permissions, side effects, error handling, or response format. This is inadequate for a mutation tool with zero 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, efficient sentence with zero waste. It's front-loaded with the core action and parameters, making it easy to parse quickly.

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 6 required parameters, no annotations, and no output schema, the description is insufficient. It lacks details on behavior, usage context, and return values, leaving significant gaps for an AI agent to operate effectively.

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?

Schema description coverage is 100%, so the schema fully documents all 6 parameters. The description mentions 'name, value and type', which aligns with the schema but adds no extra meaning beyond it. Baseline 3 is appropriate as the schema handles the heavy lifting.

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 ('adds') and resource ('preference'), specifying it creates a new preference. However, it doesn't differentiate from sibling tools like 'change_preference' or 'delete_preference' beyond the basic verb, missing explicit scope or uniqueness details.

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 'change_preference' or 'delete_preference'. The description lacks context about prerequisites, scenarios, or exclusions, leaving usage ambiguous.

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