get_collections
Retrieve a list of all collections accessible with your configured API key.
Instructions
Liste toutes les collections accessibles avec la clé API configurée
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:8-17 (schema)Schema/definition of the 'get_collections' tool in the tools array, with name, description, and inputSchema (no required params).
export const tools: Tool[] = [ { name: "get_collections", description: "Liste toutes les collections accessibles avec la clé API configurée", inputSchema: { type: "object", properties: {}, required: [], }, }, - src/index.ts:42-46 (handler)Handler case in the switch statement that routes 'get_collections' to skema.getCollections() and returns the result.
// Collections case "get_collections": { result = await skema.getCollections(); break; } - src/index.ts:29-32 (registration)Tool registration via ListToolsRequestSchema handler that returns the tools array including 'get_collections'.
// Liste des outils disponibles server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools, })); - src/skema-client.ts:68-71 (helper)Helper function getCollections() that calls mcpCall('get_collections') to execute the remote API call.
/** * Recupere la liste des collections */ export const getCollections = () => mcpCall("get_collections"); - src/skema-client.ts:25-66 (helper)Generic mcpCall function that sends JSON-RPC request to the Skema API, used by getCollections().
export const mcpCall = async <T = unknown>( toolName: string, args: Record<string, unknown> = {} ): Promise<T> => { requestId++; const response = await fetch(`${BASE_URL}/mcp`, { method: "POST", headers: { "X-API-Key": API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ jsonrpc: "2.0", id: requestId, method: "tools/call", params: { name: toolName, arguments: args, }, }), }); if (!response.ok) { const error = await response .json() .catch(() => ({ message: "Erreur inconnue" })); throw new Error(error.message || `Erreur HTTP ${response.status}`); } const jsonRpc: JsonRpcResponse<T> = await response.json(); if (jsonRpc.error) { throw new Error(jsonRpc.error.message); } if (!jsonRpc.result?.content?.[0]?.text) { throw new Error("Reponse MCP invalide"); } return JSON.parse(jsonRpc.result.content[0].text); };