Skip to main content
Glama

get_server_logs

Retrieve recent activity logs for a specific server by providing its ID, enabling monitoring and troubleshooting.

Instructions

Get recent server activity logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_idYesThe ID of the server

Implementation Reference

  • Registration of the 'get_server_logs' tool on the MCP server, using Zod schema for input validation and delegating to the PloiClient.
    server.tool(
      "get_server_logs",
      "Get recent server activity logs",
      {
        server_id: z.coerce.number().describe("The ID of the server"),
      },
      async ({ server_id }) => {
        try {
          const logs = await client.getServerLogs(server_id);
          return {
            content: [
              {
                type: "text" as const,
                text: String(logs || "No logs available"),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error fetching server logs: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Handler function for get_server_logs: calls client.getServerLogs(server_id) and returns formatted text content, with error handling.
      async ({ server_id }) => {
        try {
          const logs = await client.getServerLogs(server_id);
          return {
            content: [
              {
                type: "text" as const,
                text: String(logs || "No logs available"),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error fetching server logs: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Zod schema for the get_server_logs tool: expects 'server_id' as a number.
    {
      server_id: z.coerce.number().describe("The ID of the server"),
    },
  • PloiClient.getServerLogs() method that calls GET /servers/{id}/logs, parses paginated log entries, and formats them as a string.
    async getServerLogs(id: number): Promise<string> {
      const response = await this.request<PaginatedResponse<{ description: string; content: string; site_id: number | null; server_id: number; created_at: string }>>(
        "GET",
        `/servers/${id}/logs`
      );
      if (!response.data || response.data.length === 0) return "No logs available";
      return response.data
        .map((entry) => `[${entry.created_at}] ${entry.description}\n${entry.content || ""}`)
        .join("\n---\n");
    }
Behavior2/5

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

No annotations exist, so the description must fully convey behavior. It only mentions 'recent' without clarifying time window, log format, or whether the operation is read-only. Critical traits like rate limits or data volume are omitted.

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

Conciseness4/5

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

The description is a single, concise sentence with no unnecessary words. It could be slightly more informative without becoming verbose, but it avoids fluff.

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

Completeness2/5

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

Given the lack of output schema and the simplicity of inputs, the description is too minimal. It doesn't specify what the logs contain (e.g., timestamps, event types) or any limitations, leaving the agent without critical context for correct invocation.

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 has 100% coverage for its single parameter, which includes a description. The tool description adds no additional meaning or context beyond what the schema already provides.

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 tool retrieves server activity logs, using a specific verb and resource. It distinguishes from siblings like 'get_server' (returns server info) and 'get_site_logs' (site-specific). However, the term 'recent' is vague and could benefit from specificity.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. For instance, there is no explanation differentiating it from 'get_site_logs' or when to prefer it over other log retrieval methods.

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/sudanese/ploi-mcp'

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