Skip to main content
Glama
chrbailey

promptspeak-mcp-server

ps_audit_get

Retrieve audit log entries to monitor and review AI agent actions, supporting filtering by time, action type, and result limits for governance oversight.

Instructions

Get audit log entries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sinceNo
actionNo
limitNo

Implementation Reference

  • Main handler function that retrieves and filters audit log entries. Accepts optional 'since' timestamp, 'action' filter, and 'limit' parameters. Returns filtered AuditLogEntry array.
    export function ps_audit_get(request: AuditGetRequest = {}): AuditLogEntry[] {
      let results = auditLog;
    
      if (request.since) {
        results = results.filter(e => e.timestamp >= request.since!);
      }
    
      if (request.action) {
        results = results.filter(e => e.action === request.action);
      }
    
      const limit = request.limit ?? 100;
      return results.slice(-limit);
    }
  • Type definitions for AuditLogEntry (timestamp, action, actor, details) and AuditGetRequest (since, action, limit) interfaces that define the input/output structure.
    export interface AuditLogEntry {
      timestamp: number;
      action: string;
      actor: string;
      details: Record<string, unknown>;
    }
    
    const auditLog: AuditLogEntry[] = [];
    
    export function recordAudit(action: string, actor: string, details: Record<string, unknown>): void {
      auditLog.push({
        timestamp: Date.now(),
        action,
        actor,
        details
      });
    
      // Keep last 1000 entries
      if (auditLog.length > 1000) {
        auditLog.shift();
      }
    }
    
    export interface AuditGetRequest {
      since?: number;
      action?: string;
      limit?: number;
    }
  • Tool registration in the registry mapping the tool name 'ps_audit_get' to its handler function with category 'audit' and description.
    ps_audit_get: {
      handler: (args) => ps_audit_get(args as any),
      category: 'audit',
      description: 'Get audit log entries',
    },
  • Tool metadata definition including name, description, and JSON Schema inputSchema specifying the parameters (since, action, limit) and their types.
    export const AUDIT_TOOLS: Tool[] = [
      {
        name: 'ps_audit_get',
        description: 'Get audit log entries.',
        inputSchema: {
          type: 'object' as const,
          properties: {
            since: { type: 'number' },
            action: { type: 'string' },
            limit: { type: 'number' }
          }
        }
      }
    ];
  • Helper code defining the auditLog array (in-memory storage) and recordAudit function that populates the log. The audit log stores up to 1000 entries.
    const auditLog: AuditLogEntry[] = [];
    
    export function recordAudit(action: string, actor: string, details: Record<string, unknown>): void {
      auditLog.push({
        timestamp: Date.now(),
        action,
        actor,
        details
      });
    
      // Keep last 1000 entries
      if (auditLog.length > 1000) {
        auditLog.shift();
      }
    }

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/chrbailey/promptspeak-mcp-server'

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