Skip to main content
Glama
InsForge

Insforge MCP Server

get-container-logs

Retrieve container logs to debug application issues by fetching recent entries from specified sources like insforge.logs or postgres.logs.

Instructions

Get latest logs from a specific container/service. Use this to help debug problems with your app.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiKeyNoAPI key for authentication (optional if provided via --api_key)
sourceYesLog source to retrieve
limitNoNumber of logs to return (default: 20)

Implementation Reference

  • The handler function wrapped in withUsageTracking that fetches logs from the primary API endpoint `/api/logs/{source}` with a fallback to the legacy `/api/logs/analytics/{source}` endpoint if 404. Formats the response and adds background context.
    withUsageTracking('get-container-logs', async ({ apiKey, source, limit }) => {
      try {
        const actualApiKey = getApiKey(apiKey);
    
        const queryParams = new URLSearchParams();
        if (limit) queryParams.append('limit', limit.toString());
    
        let response = await fetch(`${API_BASE_URL}/api/logs/${source}?${queryParams}`, {
          method: 'GET',
          headers: {
            'x-api-key': actualApiKey,
          },
        });
    
        // Fallback to legacy endpoint if 404
        if (response.status === 404) {
          response = await fetch(`${API_BASE_URL}/api/logs/analytics/${source}?${queryParams}`, {
            method: 'GET',
            headers: {
              'x-api-key': actualApiKey,
            },
          });
        }
    
        const result = await handleApiResponse(response);
    
        return await addBackgroundContext({
          content: [
            {
              type: 'text',
              text: formatSuccessMessage(`Latest logs from ${source}`, result),
            },
          ],
        });
      } catch (error) {
        const errMsg = error instanceof Error ? error.message : 'Unknown error occurred';
        return {
          content: [
            {
              type: 'text',
              text: `Error retrieving container logs: ${errMsg}`,
            },
          ],
          isError: true,
        };
      }
    })
  • Zod schema defining the input parameters: optional apiKey, required source (enum of log types), optional limit (default 20).
    {
      apiKey: z
        .string()
        .optional()
        .describe('API key for authentication (optional if provided via --api_key)'),
      source: z.enum(['insforge.logs', 'postgREST.logs', 'postgres.logs', 'function.logs']).describe('Log source to retrieve'),
      limit: z.number().optional().default(20).describe('Number of logs to return (default: 20)'),
    },
  • The MCP server.tool registration that defines the tool name 'get-container-logs', description, input schema, and references the handler function.
    server.tool(
      'get-container-logs',
      'Get latest logs from a specific container/service. Use this to help debug problems with your app.',
      {
        apiKey: z
          .string()
          .optional()
          .describe('API key for authentication (optional if provided via --api_key)'),
        source: z.enum(['insforge.logs', 'postgREST.logs', 'postgres.logs', 'function.logs']).describe('Log source to retrieve'),
        limit: z.number().optional().default(20).describe('Number of logs to return (default: 20)'),
      },
      withUsageTracking('get-container-logs', async ({ apiKey, source, limit }) => {
        try {
          const actualApiKey = getApiKey(apiKey);
    
          const queryParams = new URLSearchParams();
          if (limit) queryParams.append('limit', limit.toString());
    
          let response = await fetch(`${API_BASE_URL}/api/logs/${source}?${queryParams}`, {
            method: 'GET',
            headers: {
              'x-api-key': actualApiKey,
            },
          });
    
          // Fallback to legacy endpoint if 404
          if (response.status === 404) {
            response = await fetch(`${API_BASE_URL}/api/logs/analytics/${source}?${queryParams}`, {
              method: 'GET',
              headers: {
                'x-api-key': actualApiKey,
              },
            });
          }
    
          const result = await handleApiResponse(response);
    
          return await addBackgroundContext({
            content: [
              {
                type: 'text',
                text: formatSuccessMessage(`Latest logs from ${source}`, result),
              },
            ],
          });
        } catch (error) {
          const errMsg = error instanceof Error ? error.message : 'Unknown error occurred';
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving container logs: ${errMsg}`,
              },
            ],
            isError: true,
          };
        }
      })
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool is for debugging, implying read-only behavior, but fails to specify critical details like authentication requirements (though hinted in schema), rate limits, or what 'latest' means (e.g., time-based or count-based). This leaves gaps in understanding the tool's operational traits.

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?

The description is concise and front-loaded, consisting of two sentences that directly state the tool's purpose and usage. Every sentence contributes essential information without redundancy, making it efficient and easy to parse.

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?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and usage but lacks details on behavioral aspects like authentication, error handling, or return format, which are important for a debugging tool. The schema compensates somewhat, but more context would improve completeness.

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?

The schema description coverage is 100%, providing clear details for all parameters (apiKey, source, limit). The description adds minimal value beyond the schema, only implying the tool's purpose without elaborating on parameter meanings or interactions. This meets the baseline for high schema coverage but doesn't enhance parameter understanding.

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?

The description clearly states the action ('Get latest logs') and resource ('from a specific container/service'), making the purpose evident. It distinguishes itself from siblings by focusing on log retrieval rather than operations like create, delete, or update. However, it doesn't explicitly differentiate from potential log-related siblings that might not exist in the current list.

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?

The description provides implied usage context ('to help debug problems with your app'), suggesting when to use this tool. However, it lacks explicit guidance on when not to use it or alternatives among the sibling tools, such as whether other tools might provide similar functionality 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/InsForge/insforge-mcp'

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