Skip to main content
Glama
shimizu

ModelsLab Text2Image MCP Server

by shimizu
test_connection.js1.91 kB
// test_connection.js // 汎用接続テストツール import { ToolBase } from '../core/ToolBase.js'; class TestConnectionTool extends ToolBase { constructor() { super(); this.name = 'test_connection'; } getSchema() { return { name: 'test_connection', title: 'Test Connection', description: 'サーバー/API接続をテストします(汎用版)', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'テスト対象のURL(オプション、設定されている場合はそのURLをテスト)' } } } }; } async execute(args) { try { const testUrl = args.url || 'https://httpbin.org/get'; // シンプルなHTTP接続テスト const response = await fetch(testUrl, { method: 'GET', timeout: 10000 }); const status = response.ok ? 'success' : 'failed'; const result = { url: testUrl, status: status, http_status: response.status, response_time: 'N/A' }; return this.formatResponse(result, { test_type: 'http_connection', description: 'Basic HTTP connection test' }); } catch (error) { const result = { url: args.url || 'default', status: 'failed', error: error.message }; return this.formatResponse(result, { test_type: 'http_connection', description: 'Connection test failed' }); } } } // ツールのインスタンスを作成 const testConnectionTool = new TestConnectionTool(); // スキーマとハンドラーをエクスポート export const testConnectionToolSchema = testConnectionTool.getSchema(); export const testConnection = async (args) => { return await testConnectionTool.execute(args); };

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/shimizu/modelslab-text2img-mcp-server'

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