Skip to main content
Glama
search-plan-wrapper.js1.02 kB
/** * Wrapper module for the search_plan functionality * * This wrapper extracts the results array from the API response format * which is an object with { query, results, count } structure */ const apiClient = require('./api-client'); /** * Search a plan and return the results array directly * @param {string} planId - The ID of the plan to search * @param {string} query - The search query * @returns {Promise<Array>} - Array of search results */ async function searchPlan(planId, query) { try { // Call the API through the client const response = await apiClient.search.searchPlan(planId, query); // Extract just the results array if (response && response.results && Array.isArray(response.results)) { return response.results; } else { console.error('Unexpected search response format:', response); return []; } } catch (error) { console.error('Error in search_plan wrapper:', error.message); return []; } } module.exports = { searchPlan };

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/TAgents/agent-planner-mcp'

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