Skip to main content
Glama
hidenorigoto

Sakura Cloud MCP Server

by hidenorigoto

get_apprun_logs

Retrieve application logs from Sakura Cloud AppRun to monitor performance, troubleshoot issues, and analyze runtime behavior with configurable parameters for offset and limit.

Instructions

Get logs from an AppRun application

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appIdYesThe ID of the AppRun application to get logs from
offsetNoOffset to start fetching logs from (default: 0)
limitNoMaximum number of log entries to fetch (default: 100)
zoneNoThe zone to use (e.g., "tk1v", "is1a", "tk1a"). Defaults to "tk1v" if not specified.

Implementation Reference

  • Handler implementation for the 'get_apprun_logs' tool. Validates credentials, extracts parameters (appId required, offset/limit optional), constructs API path, calls fetchFromAppRunAPI to retrieve logs, and returns JSON-formatted logs.
    } else if (request.params.name === 'get_apprun_logs') {
      try {
        validateCredentials();
        
        const appId = request.params.arguments?.appId as string;
        if (!appId) {
          throw new Error('AppRun application ID is required');
        }
        
        const offset = request.params.arguments?.offset as number || 0;
        const limit = request.params.arguments?.limit as number || 100;
        
        const zone = request.params.arguments?.zone as string || DEFAULT_ZONE;
        const logsQuery = `/applications/${appId}/logs?offset=${offset}&limit=${limit}`;
        const logs = await fetchFromAppRunAPI(logsQuery);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(logs, null, 2)
            }
          ]
        };
      } catch (error) {
        console.error('Error calling tool:', error);
        throw error;
      }
    }
  • Registration of the 'get_apprun_logs' tool in ListToolsRequestSchema, including name, description, and input schema definition.
      name: 'get_apprun_logs',
      description: 'Get logs from an AppRun application',
      inputSchema: {
        type: 'object',
        properties: {
          appId: {
            type: 'string',
            description: 'The ID of the AppRun application to get logs from'
          },
          offset: {
            type: 'number',
            description: 'Offset to start fetching logs from (default: 0)'
          },
          limit: {
            type: 'number',
            description: 'Maximum number of log entries to fetch (default: 100)'
          },
          zone: {
            type: 'string',
            description: 'The zone to use (e.g., "tk1v", "is1a", "tk1a"). Defaults to "tk1v" if not specified.'
          }
        },
        required: ['appId']
      }
    }
  • Input schema definition for the 'get_apprun_logs' tool, specifying parameters and requirements.
    inputSchema: {
      type: 'object',
      properties: {
        appId: {
          type: 'string',
          description: 'The ID of the AppRun application to get logs from'
        },
        offset: {
          type: 'number',
          description: 'Offset to start fetching logs from (default: 0)'
        },
        limit: {
          type: 'number',
          description: 'Maximum number of log entries to fetch (default: 100)'
        },
        zone: {
          type: 'string',
          description: 'The zone to use (e.g., "tk1v", "is1a", "tk1a"). Defaults to "tk1v" if not specified.'
        }
      },
      required: ['appId']
    }
  • Helper function fetchFromAppRunAPI used by the get_apprun_logs handler to make authenticated HTTPS requests to the Sakura Cloud AppRun API.
    async function fetchFromAppRunAPI(path: string, method: string = 'GET', bodyData?: any): Promise<any> {
      return new Promise((resolve, reject) => {
        validateCredentials();
        
        const options = {
          hostname: 'secure.sakura.ad.jp',
          port: 443,
          path: `/cloud/api/apprun/1.0/apprun/api${path}`,
          method: method,
          headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'Authorization': `Basic ${Buffer.from(`${SACLOUD_API_TOKEN}:${SACLOUD_API_SECRET}`).toString('base64')}`
          }
        };
    
        const req = https.request(options, (res) => {
          let data = '';
          
          res.on('data', (chunk) => {
            data += chunk;
          });
          
          res.on('end', () => {
            try {
              if (data) {
                const parsedData = JSON.parse(data);
                resolve(parsedData);
              } else {
                resolve({});
              }
            } catch (err) {
              reject(new Error(`Failed to parse response: ${err}`));
            }
          });
        });
        
        req.on('error', (error) => {
          reject(error);
        });
        
        if (bodyData && (method === 'POST' || method === 'PUT')) {
          req.write(JSON.stringify(bodyData));
        }
        
        req.end();
      });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It doesn't disclose whether this is a read-only operation (implied by 'Get'), potential rate limits, authentication needs, or what happens if the app isn't running. For a tool with 4 parameters and no annotations, this leaves significant gaps in understanding its behavior.

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 a single, efficient sentence with zero waste—it directly states the tool's purpose without redundancy. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 complexity (4 parameters, no annotations, no output schema), the description is incomplete. It doesn't cover return values (e.g., log format, structure), error conditions, or behavioral traits like pagination (implied by offset/limit but not explained). For a logging tool with multiple parameters, this leaves too much unspecified.

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 description coverage is 100%, so parameters are well-documented in the schema itself. The description adds no additional meaning beyond implying 'appId' is required (which the schema already states). It doesn't explain parameter interactions or provide context beyond what's in the schema, meeting the baseline for high coverage.

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 verb ('Get logs') and resource ('from an AppRun application'), making the purpose unambiguous. It distinguishes from siblings like get_apprun_info (which likely returns metadata) and get_apprun_list (which lists applications). However, it doesn't specify the exact scope or format of logs (e.g., application vs. system logs), keeping it from a perfect score.

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 explicit guidance on when to use this tool versus alternatives is provided. While the name implies it's for logs (distinguishing from get_apprun_info for metadata), the description doesn't mention prerequisites (e.g., the app must be running), exclusions, or comparisons to other logging tools. Usage is implied by context but not stated.

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/hidenorigoto/sacloud-mcp'

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