search_spryker_package_code
Search code in Spryker GitHub repositories using natural language queries to find specific modules and documentation across packages.
Instructions
To search code in Spryker GitHub repositories
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The natural language query to search in code of Spryker packages | |
| organisations | No | Optional array of organisations to filter by [`spryker`, `spryker-eco`, `spryker-sdk`, `spryker-shop` |
Implementation Reference
- src/tools.js:58-100 (handler)The main handler function `searchSprykerCode` that performs the tool's core logic: query normalization, organization validation, GitHub code search query construction (with PHP filter), API call, result formatting, and response generation with error handling.
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}` }] }; } } - src/index.js:55-70 (registration)Registration of the `search_spryker_package_code` tool on the MCP server, including tool name, description, Zod input schema, and reference to the `searchSprykerCode` handler.
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)Zod schema for tool inputs: `query` (required string 5-120 chars) and `organisations` (optional string array).
{ 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\``) },