rsdoctor

v0.1.0
io.github.yifancong/rsdoctor Checked 3 hours ago Published 1 year ago

An MCP server that provides build analysis and optimization recommendations for Rspack projects.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_chunks

get all chunks

get_chunk_by_id

get chunk by id

ParameterTypeDescription
chunkId *number

get_module_by_id

get module detail by id (Rspack or Webpack module id): - id: the id of the module (corresponds to Rspack or Webpack's internal module id) - issuerPath: the referrer chain (array of module ids, from entry to this module) - dependencies: direct dependencies (array of module ids this module imports/requires) - allDependencies: all transitive dependencies (if user asks for detail) - chunks: array of chunk ids this module belongs to - imported: array of module ids that import this module - isEntry: whether this module is an entry point - size: { sourceSize, tr…

ParameterTypeDescription
moduleId *number

get_module_by_path

get module detail by module name or path (absolute or relative, as in Rspack or Webpack stats) - If multiple modules match, return all matched module paths and stop, let user select. - Otherwise, return the same fields as getModuleById. - Always include bailoutReason if present. - If user asks for "why is this module in the bundle", show the full issuerPath chain. - If user asks for "why not tree-shaken", show bailoutReason and explain.

ParameterTypeDescription
modulePath *string

get_module_issuer_path

get module issuer path (who imported this module, recursively) - Return as a dependency chain (array of module ids from entry to this module) - If possible, render as a tree or graph for clarity. - For each module in the chain, show its path and (if present) bailoutReason.

ParameterTypeDescription
moduleId *string

get_package_info

get package info

get_package_dependency

get package dependency

get_rule_info

get rules info, the rules info is a Record<{id: number, name: string, description: string, severity: string, category: string, module: string, path: string, line: number, column: number, message: string, fix: string}>, where: - id: an incremental sequence mark - name: the name of the rule - description: the description of the rule - severity: the severity of the rule - category: the category of the rule - E1001 Duplicate Packages: #### Description there is a same name package which bundled more than one version in your application. it is not good to the bundle s…

get_similar_packages

get similar packages. Similar packages are categorized as follows, with each line representing a category of similar packages. The presence of packages below does not necessarily mean there are similar packages - replacement should only be considered when packages from the same category exist: 1. cannot exist simultaneously: lodash、lodash-es、string_decode:Consider migrating to lodash-es for better Tree Shaking support. /n 2. cannot exist simultaneously: dayjs, moment, date-fns, js-joda. Consider using dayjs to replace moment for smaller bundle size. /n 3. cannot exist simulta…

get_packages_by_package_name

get similar packages. Similar packages are categorized as follows, with each line representing a category of similar packages. The presence of packages below does not necessarily mean there are similar packages - replacement should only be considered when packages from the same category exist: 1. cannot exist simultaneously: lodash、lodash-es、string_decode:Consider migrating to lodash-es for better Tree Shaking support. /n 2. cannot exist simultaneously: dayjs, moment, date-fns, js-joda. Consider using dayjs to replace moment for smaller bundle size. /n 3. cannot exist simulta…

ParameterTypeDescription
packageName *string

get_duplicate_packages

get_bundle_optimize

getBundleOptimize calls multiple functions to provide conclusions to users: - getRuleInfo for duplicate packages - GetSimilarPackages to check if there are similar packages that need optimization - getMediaAssetPrompt to check if media assets need optimization - GetAllChunks to check if there are oversized resources and provide splitChunk suggestions

get_loader_time_all_files

Get compilation time spent by each loader on individual files

get_loader_times

Get compiled directories loader times

get_port

Get the port of the MCP server