Skip to main content
Glama
charlesmuchene

Android Preference Editor MCP Server

read_preferences

Extract and view all user preferences stored in a specific file on an Android device using the device ID, app ID, and filename.

Instructions

Reads all user preferences in a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesThe application's package name.
deviceIdYesThe device's serial number.
filenameYesThe filename with or without the extension.

Implementation Reference

  • Registers the "read_preferences" tool with server.tool, providing description, FileSchema.shape for input, and inline async handler that validates input, reads preferences via readPreferences(connection), formats each as JSON text, handles errors.
    server.tool( "read_preferences", "Reads all user preferences in a file", FileSchema.shape, async (connection: z.infer<typeof FileSchema>) => { try { validate(connection, FileSchema); return { content: (await readPreferences(connection)).map((pref) => ({ type: "text", mimeType: "application/json", text: JSON.stringify(pref, null, 2), })), }; } catch (error) { return { isError: true, content: [ { type: "text", text: error instanceof Error ? error.message : "Unknown error", }, ], }; } } );
  • FileSchema definition used for read_preferences tool input validation (requires deviceId, appId, filename).
    export const FileSchema = AppSchema.extend({ filename: z.string().describe("The filename with or without the extension."), });
  • AppSchema extended by FileSchema (requires deviceId, appId).
    export const AppSchema = DeviceSchema.extend({ appId: z.string().describe("The application's package name."), });
  • DeviceSchema base schema for tool inputs (deviceId).
    export const DeviceSchema = z.object({ deviceId: z.string().describe("The device's serial number."), });
  • validate helper function used in read_preferences handler to validate input against FileSchema.
    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(", ")}` ); };

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