search_spryker_packages
Search Spryker packages and modules in GitHub repositories using natural language queries to find relevant code and documentation.
Instructions
To search the Spryker package repository in Github
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The natural language query to search in Github | |
| organisations | No | Optional array of organisations to filter by [`spryker`, `spryker-eco`, `spryker-sdk`, `spryker-shop` |
Implementation Reference
- src/tools.js:14-56 (handler)The handler function that executes the tool logic: normalizes query, validates organisations, builds GitHub search query, performs repository search, formats and returns results as text content.export const searchSprykerPackages = async ({query, organisations}) => { logger.info(`Received searchSprykerPackages request`, { query, organisations }); try { const normalizedQuery = normalizeQuery(query); const validatedOrgs = validateOrganisations(organisations); logger.info(`Using organizations for searchSprykerPackages`, { organisations: validatedOrgs }); const githubQuery = buildGitHubQuery(normalizedQuery, validatedOrgs); logger.info(`Performing GitHub repository searchSprykerPackages`, { query: githubQuery }); const searchResults = await searchGitHubRepositories(githubQuery); logger.info(`GitHub searchSprykerPackages completed`, { resultCount: searchResults.items ? searchResults.items.length : 0, totalCount: searchResults.total_count }); const formattedText = formatResults(searchResults.items, validatedOrgs); logger.debug(`Search results formatted for display`); return { content: [{ type: `text`, text: formattedText }] }; } catch (error) { logger.error(`Error in search: ${error.message}`, { error, stack: error.stack }); return { content: [{ type: `text`, text: `Error performing search: ${error.message}` }] }; } }
- src/index.js:38-53 (registration)Registers the 'search_spryker_packages' tool with the MCP server, specifying name, description, input parameters, and the handler function.server.tool( `search_spryker_packages`, `To search the Spryker package repository in Github`, { query: z .string() .max(120) .min(5) .describe(`The natural language query to search in Github`), organisations: z .array(z.string()) .optional() .describe(`Optional array of organisations to filter by [\`spryker\`, \`spryker-eco\`, \`spryker-sdk\`, \`spryker-shop\``) }, searchSprykerPackages );
- src/index.js:41-51 (schema)Input schema definition using Zod: 'query' as string (min 5, max 120 chars), optional 'organisations' as array of strings with predefined options.{ query: z .string() .max(120) .min(5) .describe(`The natural language query to search in Github`), organisations: z .array(z.string()) .optional() .describe(`Optional array of organisations to filter by [\`spryker\`, \`spryker-eco\`, \`spryker-sdk\`, \`spryker-shop\``) },
- src/utils.js:41-57 (helper)Helper function to format the GitHub repository search results into readable text, specific to searchSprykerPackages.export const formatResults = (repositories, organisations) => { if (!repositories || repositories.length === 0) { return `No repositories found matching your searchSprykerPackages criteria.`; } let formattedText = `Found ${repositories.length} repositories:\n\n`; repositories.forEach((repo, index) => { formattedText += `${index + 1}. ${repo.name}\n`; formattedText += ` Description: ${repo.description || `No description available`}\n`; formattedText += ` URL: ${repo.html_url}\n\n`; }); formattedText += `Search performed across organizations: ${organisations.join(`, `)}`; return formattedText; };
- src/utils.js:66-77 (helper)Helper function to construct the full GitHub search query by appending organization filters for searchSprykerPackages.export const buildGitHubQuery = (query, organisations) => { // Start with the base query let githubQuery = query; // Add organization filters if (organisations && organisations.length > 0) { const orgFilters = organisations.map(org => `org:${org}`).join(` `); githubQuery = `${githubQuery} ${orgFilters}`; } return githubQuery; };