Skip to main content
Glama
charlesmuchene

Android Preference Editor MCP Server

delete_preference

Remove specific user preferences in Android apps by specifying the preference name, device ID, app package name, and filename. Streamlines app development and testing workflows.

Instructions

Delete an existing preference

Input Schema

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

Implementation Reference

  • The handler function for the 'delete_preference' MCP tool. It validates the input, destructures the name and connection parameters, calls the external deletePreference function, and returns a success or error response.
    async (input: z.infer<typeof DeletePrefSchema>) => { try { validate(input, DeletePrefSchema); const { name, ...connection } = input; await deletePreference({ key: name }, connection); return { content: [ { type: "text", text: `Preference deleted`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: error instanceof Error ? error.message : "Unknown error", }, ], }; } }
  • Zod schema for 'delete_preference' tool input: merges NameSchema (name field) and FileSchema (deviceId, appId, filename for connection).
    export const DeletePrefSchema = NameSchema.merge(FileSchema);
  • Registration of the 'delete_preference' tool in configurePreferenceTools using McpServer.tool() with name, description, schema.shape, and handler function.
    server.tool( "delete_preference", "Delete an existing preference", DeletePrefSchema.shape, async (input: z.infer<typeof DeletePrefSchema>) => { try { validate(input, DeletePrefSchema); const { name, ...connection } = input; await deletePreference({ key: name }, connection); return { content: [ { type: "text", text: `Preference deleted`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: error instanceof Error ? error.message : "Unknown error", }, ], }; } } );
  • Supporting schemas: FileSchema, NameSchema, and DeletePrefSchema = NameSchema.merge(FileSchema) used for delete_preference input validation.
    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); export const DeletePrefSchema = NameSchema.merge(FileSchema);
  • src/index.ts:21-21 (registration)
    Invocation of configurePreferenceTools which registers the delete_preference tool (among others).
    configurePreferenceTools(server);

Other Tools

Related 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