listKnowledgeBases
Access and retrieve a list of available knowledge bases using MCP-Smallest.ai's standardized interface, enabling efficient knowledge base management and integration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.ts:16-41 (handler)Handler function that executes the logic for listing knowledge bases by fetching from the configured API endpoint and returning the JSON response or error.async () => { try { const response = await fetch(`${config.BASE_URL}/knowledgebase`, { method: 'GET', headers: { 'Authorization': `Bearer ${config.API_KEY}` } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; console.error('Error fetching knowledge bases:', error); return { content: [{ type: "text", text: `Error: ${errorMessage}` }], isError: true }; } }
- index.ts:14-42 (registration)Registration of the 'listKnowledgeBases' tool on the MCP server with no input parameters and the inline handler function."listKnowledgeBases", {}, // Empty object for no parameters async () => { try { const response = await fetch(`${config.BASE_URL}/knowledgebase`, { method: 'GET', headers: { 'Authorization': `Bearer ${config.API_KEY}` } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; console.error('Error fetching knowledge bases:', error); return { content: [{ type: "text", text: `Error: ${errorMessage}` }], isError: true }; } } );
- index.ts:15-15 (schema)Empty schema indicating the tool takes no input parameters.{}, // Empty object for no parameters