list_profiles
Retrieve all configured identity profiles with their credentials and identify the currently active profile.
Instructions
[Plugin] List all available identity profiles (each profile has its own LARK_COOKIE / APP_ID / APP_SECRET / UAT). v1.3.9 SSOT: profiles live in ~/.feishu-user-plugin/credentials.json::profiles. Legacy fallback: LARK_PROFILES_JSON env var. Marks the currently active profile.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/profile.js:47-49 (handler)The actual handler function for the list_profiles tool. Calls ctx.getActiveProfile() and ctx.listProfiles() to return the current active profile name and all available profile names as JSON.
async list_profiles(_args, ctx) { return json({ active: ctx.getActiveProfile(), profiles: ctx.listProfiles() }); }, - src/tools/profile.js:15-19 (schema)The MCP tool schema definition for list_profiles. It has no required inputs (empty inputSchema) and describes that it lists available identity profiles and marks the active one.
{ name: 'list_profiles', description: '[Plugin] List all available identity profiles (each profile has its own LARK_COOKIE / APP_ID / APP_SECRET / UAT). v1.3.9 SSOT: profiles live in ~/.feishu-user-plugin/credentials.json::profiles. Legacy fallback: LARK_PROFILES_JSON env var. Marks the currently active profile.', inputSchema: { type: 'object', properties: {} }, }, - src/server.js:37-57 (registration)Tool module registration in server.js. The profile module (containing list_profiles) is loaded and its schemas/handlers are flattened into TOOLS and HANDLERS for MCP dispatch.
const TOOL_MODULES = [ require('./tools/bitable'), require('./tools/calendar'), require('./tools/contacts'), require('./tools/diagnostics'), require('./tools/docs'), require('./tools/drive'), require('./tools/events'), require('./tools/groups'), require('./tools/im-read'), require('./tools/messaging-bot'), require('./tools/messaging-user'), require('./tools/okr'), require('./tools/profile'), require('./tools/tasks'), require('./tools/uploads'), require('./tools/wiki'), ]; const TOOLS = TOOL_MODULES.flatMap((m) => m.schemas); const HANDLERS = Object.fromEntries(TOOL_MODULES.flatMap((m) => Object.entries(m.handlers))); - src/server.js:391-412 (registration)MCP CallTool request handler that dispatches to the registered handler by name. When list_profiles is called, it looks up HANDLERS['list_profiles'] and invokes it via profileRouter.
server.setRequestHandler(CallToolRequestSchema, async (request) => { // Cross-process active-profile sync (v1.3.9 A.2): if another MCP process // wrote a new `active` field to credentials.json, pick it up before dispatch. _syncActiveProfileFromDisk(); const { name, arguments: args } = request.params; const handler = HANDLERS[name]; if (!handler) { return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true }; } // Strip via_profile from args before passing to the handler — it's a // routing-layer concern, not a tool argument. Keep a copy for routing. const cleanArgs = (args && typeof args === 'object') ? { ...args } : {}; delete cleanArgs.via_profile; try { return await profileRouter.withProfileRouting(buildCtx(), name, args || {}, async () => { return handler(cleanArgs, buildCtx()); }); } catch (err) { return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true }; } }); - src/server.js:332-333 (helper)The ctx helper methods used by the list_profiles handler. listProfiles() delegates to credentials.listProfileNames(), and getActiveProfile() returns the current in-memory profile name.
listProfiles: () => credentials.listProfileNames(), getActiveProfile: () => currentProfile,