Skip to main content
Glama

m9k_sessions

List and filter indexed sessions by project, source type, or limit results for persistent memory management in Claude Code.

Instructions

List all indexed sessions, optionally filtered by project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoFilter by project path
limitNoMax sessions
sourceNoFilter by source type. Default: all sources.

Implementation Reference

  • The 'm9k_sessions' tool handler implementation, which queries the 'conv_sessions' table.
    server.registerTool(
      'm9k_sessions',
      {
        description: 'List all indexed sessions, optionally filtered by project.',
        inputSchema: {
          project: z.string().optional().describe('Filter by project path'),
          limit: z.number().int().min(1).max(100).default(20).describe('Max sessions'),
          source: z
            .enum(['conversations', 'git', 'files'])
            .optional()
            .describe('Filter by source type. Default: all sources.'),
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
      },
      async ({ project, limit }) => {
        let sql = 'SELECT * FROM conv_sessions WHERE deleted_at IS NULL';
        const params: unknown[] = [];
        if (project) {
          sql += ' AND project = ?';
          params.push(project);
        }
        sql += ' ORDER BY started_at DESC LIMIT ?';
        params.push(limit);
        const rows = ctx.db.prepare(sql).all(...params);
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(rows) }],
        };
      },
    );

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/louis49/melchizedek'

If you have feedback or need assistance with the MCP directory API, please join our Discord server