search_spryker_package_code
Search code in Spryker GitHub repositories using natural language queries. Filter results by specific organisations to quickly locate modules and documentation.
Instructions
To search code in Spryker GitHub repositories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organisations | No | Optional array of organisations to filter by [`spryker`, `spryker-eco`, `spryker-sdk`, `spryker-shop` | |
| query | Yes | The natural language query to search in code of Spryker packages |
Implementation Reference
- src/index.js:55-70 (registration)Registration of the 'search_spryker_package_code' tool, including name, description, schema, and handler reference.server.tool( `search_spryker_package_code`, `To search code in Spryker GitHub repositories`, { query: z .string() .max(120) .min(5) .describe(`The natural language query to search in code of Spryker packages`), organisations: z .array(z.string()) .optional() .describe(`Optional array of organisations to filter by [\`spryker\`, \`spryker-eco\`, \`spryker-sdk\`, \`spryker-shop\``) }, searchSprykerCode );
- src/index.js:58-68 (schema)Input schema using Zod for the tool parameters: query (string) and optional organisations (array of strings).{ query: z .string() .max(120) .min(5) .describe(`The natural language query to search in code of Spryker packages`), organisations: z .array(z.string()) .optional() .describe(`Optional array of organisations to filter by [\`spryker\`, \`spryker-eco\`, \`spryker-sdk\`, \`spryker-shop\``) },
- src/tools.js:58-100 (handler)The main handler function that normalizes the query, builds a GitHub code search query filtered by PHP files in Spryker orgs, calls searchGitHubCode, formats results with formatCodeResults, and returns markdown text content.export const searchSprykerCode = async ({query, organisations}) => { logger.info(`Received searchSprykerCode request`, { query, organisations }); try { const normalizedQuery = normalizeQuery(query); const validatedOrgs = validateOrganisations(organisations); logger.info(`Using organizations for code search`, { organisations: validatedOrgs }); const githubQuery = buildGitHubQuery(normalizedQuery, validatedOrgs) + ` in:file` + ` language:php`; logger.info(`Performing GitHub code search`, { query: githubQuery }); const searchResults = await searchGitHubCode(githubQuery); logger.info(`GitHub code search completed`, { resultCount: searchResults.items ? searchResults.items.length : 0, totalCount: searchResults.total_count }); const formattedText = formatCodeResults(searchResults.items, validatedOrgs); logger.debug(`Code search results formatted for display`); return { content: [{ type: `text`, text: formattedText }] }; } catch (error) { logger.error(`Error in code search: ${error.message}`, { error, stack: error.stack }); return { content: [{ type: `text`, text: `Error performing code search: ${error.message}` }] }; } }