complered tools 2 and guide

This commit is contained in:
southseact-3d
2026-02-08 20:15:38 +00:00
parent bd6817f697
commit b95efaebea
5 changed files with 1599 additions and 84 deletions

View File

@@ -153,19 +153,26 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
const args = (req.params.arguments ?? {})
// Lazy-load to avoid paying cost unless tool is actually invoked.
// Note: external-wp-testing.js is CommonJS; import default gives module.exports.
const externalTesting = await import("../../../chat/external-wp-testing.js")
const mod = externalTesting.default ?? externalTesting
const createExternalWpTester = mod?.createExternalWpTester
const getExternalTestingConfig = mod?.getExternalTestingConfig
// Note: external-wp-testing.js is CommonJS; when imported from ESM,
// exports are on .default for Node.js CommonJS modules
let createExternalWpTester
let getExternalTestingConfig
try {
const externalTesting = await import("../../../chat/external-wp-testing.js")
const mod = externalTesting.default ?? externalTesting
createExternalWpTester = mod?.createExternalWpTester
getExternalTestingConfig = mod?.getExternalTestingConfig
if (typeof createExternalWpTester !== "function" || typeof getExternalTestingConfig !== "function") {
if (typeof createExternalWpTester !== "function" || typeof getExternalTestingConfig !== "function") {
throw new Error("Required exports not found on module")
}
} catch (error) {
return {
content: [
{
type: "text",
text:
"wp-cli-testing MCP server misconfigured: could not load chat/external-wp-testing.js exports.",
text: `wp-cli-testing MCP server error: Failed to load chat/external-wp-testing.js - ${error.message}`,
},
],
isError: true,