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(); }); }

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