Skip to main content
Glama
NigelThorne

Firebase MCP Server

by NigelThorne

get_function_logs

Retrieve and filter Cloud Function logs from Firebase Emulator using regex patterns, log levels, function names, and timestamps to debug and monitor execution.

Instructions

Get Firebase function logs. Returns 20 lines by default - use filters (pattern, level, functionName) to narrow results before increasing limit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternNoRegex pattern to filter log messages
levelNoFilter by log level
functionNameNoFilter by function name
limitNoMax log entries to return (default: 20)
sinceNoISO timestamp - only logs after this time

Implementation Reference

  • The handler function `handleGetFunctionLogs` processes the log buffer based on the provided filters and returns the requested number of log entries.
    async function handleGetFunctionLogs(
      pattern?: string,
      level?: string,
      functionName?: string,
      limit = 20,
      since?: string
    ) {
      let filtered = [...logBuffer];
      if (since) {
        const sinceTime = new Date(since).getTime();
        filtered = filtered.filter((log) => new Date(log.timestamp).getTime() >= sinceTime);
      }
      if (level) {
        filtered = filtered.filter((log) => log.level.toUpperCase() === level.toUpperCase());
      }
      if (functionName) {
        filtered = filtered.filter((log) => log.function?.includes(functionName));
      }
      if (pattern) {
        const regex = new RegExp(pattern, "i");
        filtered = filtered.filter((log) => regex.test(log.message));
      }
      return filtered.slice(-limit);
    }
  • src/index.ts:230-242 (registration)
    Tool registration for `get_function_logs` including its input schema.
      name: "get_function_logs",
      description: "Get Firebase function logs. Returns 20 lines by default - use filters (pattern, level, functionName) to narrow results before increasing limit.",
      inputSchema: {
        type: "object" as const,
        properties: {
          pattern: { type: "string", description: "Regex pattern to filter log messages" },
          level: { type: "string", enum: ["DEBUG", "INFO", "WARN", "ERROR"], description: "Filter by log level" },
          functionName: { type: "string", description: "Filter by function name" },
          limit: { type: "number", description: "Max log entries to return (default: 20)" },
          since: { type: "string", description: "ISO timestamp - only logs after this time" },
        },
      },
    },
  • Request handler switch-case integration for `get_function_logs`.
    case "get_function_logs":
      result = await handleGetFunctionLogs(
        args?.pattern as string,
        args?.level as string,
        args?.functionName as string,
        args?.limit as number,
        args?.since as string
      );
      break;
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses default return size (20 lines) which is crucial for log retrieval. With no annotations provided, the description misses opportunity to clarify if logs are streaming, rate-limited, consumable, or their format (JSON vs. text). Carries partial burden adequately but not fully.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero waste. Front-loaded with purpose ('Get Firebase function logs'), followed immediately by behavioral constraints and usage guidance. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

5 parameters with 100% schema coverage and no output schema. Description omits mention of 'since' parameter (critical for log time-windowing) and return format. Adequate but gaps remain for a tool with optional time-based filtering.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. Mentions filter parameters (pattern, level, functionName) by name to reinforce their purpose, and implies 'limit' default behavior, adding minimal semantic value beyond schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb ('Get') and resource ('Firebase function logs'). Implicitly distinguishes from sibling 'list_functions' (metadata vs. logs) and other Firestore tools. Lacks explicit scope restrictions that would earn a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides implicit usage guidance ('use filters... to narrow results before increasing limit') advising efficient query patterns. However, lacks explicit when-to-use vs. alternatives (e.g., when to use 'since' vs. large limits) or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/NigelThorne/firebase_mcp_server'

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