@xiedada/nodemw-mcp-server 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2137 -5
- package/package.json +1 -1
- package/dist/index.js.map +0 -7
package/package.json
CHANGED
package/dist/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../src/server.ts", "../src/tools/ro/get-article.ts", "../src/common/nodemwBot.ts", "../src/tools/ro/search.ts", "../src/common/utils.ts", "../src/tools/ro/get-pages-in-category.ts", "../src/tools/ro/get-categories.ts", "../src/tools/ro/get-users.ts", "../src/tools/ro/get-all-pages.ts", "../src/tools/ro/get-pages-in-namespace.ts", "../src/tools/ro/get-pages-by-prefix.ts", "../src/tools/ro/get-pages-transcluding.ts", "../src/tools/ro/get-article-revisions.ts", "../src/tools/ro/get-article-categories.ts", "../src/tools/ro/get-article-properties.ts", "../src/tools/ro/get-article-info.ts", "../src/tools/ro/get-user-contribs.ts", "../src/tools/ro/whoami.ts", "../src/tools/ro/whois.ts", "../src/tools/ro/whoare.ts", "../src/tools/ro/get-images.ts", "../src/tools/ro/get-images-from-article.ts", "../src/tools/ro/get-image-usage.ts", "../src/tools/ro/get-image-info.ts", "../src/tools/ro/get-log.ts", "../src/tools/ro/expand-templates.ts", "../src/tools/ro/parse.ts", "../src/tools/ro/get-recent-changes.ts", "../src/tools/ro/get-site-info.ts", "../src/tools/ro/get-site-stats.ts", "../src/tools/ro/get-mediawiki-version.ts", "../src/tools/ro/get-query-page.ts", "../src/tools/ro/get-external-links.ts", "../src/tools/ro/get-backlinks.ts", "../src/tools/editing/edit.ts", "../src/tools/editing/append.ts", "../src/tools/editing/prepend.ts", "../src/tools/editing/move.ts", "../src/tools/editing/delete.ts", "../src/tools/editing/protect.ts", "../src/tools/editing/purge.ts", "../src/tools/editing/send-email.ts", "../src/tools/editing/upload.ts", "../src/tools/editing/upload-by-url.ts", "../src/tools/editing/add-flow-topic.ts", "../src/tools/editing/create-account.ts", "../src/tools/index.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { parseArgs } from 'util';\nimport { createServer } from './server.js';\nimport { registerAllTools } from './tools/index.js';\nimport {\n initServerConfig,\n getBot,\n initBot,\n autoDetectPath,\n promisifyBotMethod,\n isAuthenticated,\n type ServerConfig\n} from './common/nodemwBot.js';\n\nfunction parseCliArgs(): { config: ServerConfig; pathExplicit: boolean } {\n const { values, positionals } = parseArgs({\n options: {\n server: { type: 'string', short: 's' },\n path: { type: 'string' },\n endpoint: { type: 'string' },\n user: { type: 'string', short: 'u' },\n pass: { type: 'string', short: 'p' },\n token: { type: 'string' },\n 'dry-run': { type: 'boolean' },\n },\n strict: false,\n allowPositionals: true,\n });\n\n // Server can be specified via --server/-s or as the first positional argument\n const serverUrl = (values.server as string) ?? positionals[0] ?? process.env.NODEMW_MCP_SERVER;\n if (!serverUrl) {\n console.error('Error: target server is required (-s, positional arg, or NODEMW_MCP_SERVER env)');\n process.exit(1);\n }\n let server: string;\n let protocol: string | undefined;\n let port: number | undefined;\n\n try {\n if (serverUrl.startsWith('http://') || serverUrl.startsWith('https://')) {\n const url = new URL(serverUrl);\n server = url.hostname;\n protocol = url.protocol.replace(':', '');\n if (url.port) {\n port = parseInt(url.port, 10);\n }\n } else {\n server = serverUrl;\n }\n } catch {\n server = serverUrl;\n }\n\n const pathFromEnv = process.env.NODEMW_MCP_ENDPOINT_PATH;\n const pathExplicit = !!(values.path ?? values.endpoint ?? pathFromEnv);\n\n return {\n config: {\n server,\n protocol,\n port,\n path: (values.path as string) ?? (values.endpoint as string) ?? pathFromEnv ?? '/w',\n username: (values.user as string) ?? process.env.NODEMW_MCP_MW_USER,\n password: (values.pass as string) ?? process.env.NODEMW_MCP_MW_PASS,\n token: values.token as string | undefined,\n dryRun: values['dry-run'] as boolean | undefined,\n },\n pathExplicit,\n };\n}\n\nasync function main(): Promise<void> {\n const { config, pathExplicit } = parseCliArgs();\n\n // Step 1: Auto-detect API path if not explicitly specified\n if (!pathExplicit) {\n try {\n config.path = await autoDetectPath(config);\n console.error(`Auto-detected API path: ${config.path}`);\n } catch (err) {\n console.error('Error:', (err as Error).message);\n process.exit(1);\n }\n }\n\n initServerConfig(config);\n\n // Step 2: Initialize bot \u2014 creates connection and logs in if credentials provided\n try {\n await initBot(config);\n } catch (err) {\n console.error('Error:', (err as Error).message);\n process.exit(1);\n }\n\n // Step 3: Fetch site info to enrich the server description\n const bot = getBot();\n let siteInfo: { sitename: string; base: string; generator: string } | undefined;\n try {\n const info = await promisifyBotMethod<{ general?: { sitename?: string; base?: string; generator?: string } }>(bot, 'getSiteInfo', ['general']);\n const general = info?.general;\n if (general) {\n siteInfo = {\n sitename: general.sitename || 'Unknown',\n base: general.base || '',\n generator: general.generator || 'MediaWiki',\n };\n }\n } catch {\n console.error('Warning: Could not fetch site info for server description.');\n }\n\n // Step 4: Create server with site-aware description\n const auth = isAuthenticated();\n const server = createServer(siteInfo, auth);\n registerAllTools(server, auth);\n\n // Step 5: Connect stdio transport\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n const protocol = config.protocol ?? 'https';\n const endpoint = `${protocol}://${config.server}${config.path}/api.php`;\n const sitename = siteInfo?.sitename ?? config.server;\n console.error(`Ready to operate on \"${sitename}\" <${endpoint}>`);\n}\n\nmain().catch(console.error);\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nexport const USER_AGENT = 'nodemw-mcp-server/1.0';\n\nexport interface SiteInfoSummary {\n sitename: string;\n base: string;\n generator: string;\n}\n\nexport function createServer(siteInfo?: SiteInfoSummary, authenticated = false): McpServer {\n let description: string;\n const authSuffix = authenticated\n ? ' Write operations are available.'\n : ' Running in guest mode \u2014 only read operations are available.';\n if (siteInfo) {\n description = `Connected to ${siteInfo.sitename} (${siteInfo.base}). Running ${siteInfo.generator}.${authSuffix} When connecting for the first time, call the get-site-info tool for full site details.`;\n } else {\n description = `When connecting to this server for the first time, call the get-site-info tool to understand the target MediaWiki site (version, namespaces, extensions, etc.) before using other tools.${authSuffix}`;\n }\n\n return new McpServer(\n {\n name: 'nodemw-mcp-server',\n version: '1.0.0',\n description\n },\n { capabilities: { tools: {} } }\n );\n}\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\n\r\nexport function getArticleTool( server: McpServer ): RegisteredTool {\r\n return server.tool(\r\n 'get-article',\r\n 'Retrieve the content of a wiki article',\r\n {\r\n title: z.string().describe( 'Article title' ),\r\n followRedirect: z.boolean().optional().default( true ).describe( 'Follow redirects' ),\r\n redirectInfo: z.boolean().optional().default( false ).describe( 'Include information about redirects' )\r\n },\r\n {\r\n title: 'Get article',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title, followRedirect, redirectInfo } ) => handleGetArticleTool( title, followRedirect, redirectInfo )\r\n );\r\n}\r\n\r\nasync function handleGetArticleTool(\r\n title: string,\r\n followRedirect: boolean,\r\n redirectInfo: boolean\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n if (redirectInfo) {\r\n // When redirectInfo is requested, get both content and redirect info\r\n const result = await new Promise<[string, unknown]>((resolve, reject) => {\r\n const callback = (err: Error | null, content: string, redirectInfo: unknown) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n resolve([content, redirectInfo]);\r\n }\r\n };\r\n\r\n // @ts-expect-error: any method call\r\n bot.getArticle(title, followRedirect, callback);\r\n });\r\n const [content, redirect] = result;\r\n if (content == null) {\r\n return {\r\n content: [{ type: 'text', text: `Page \"${title}\" not found or has no content.` }],\r\n isError: true\r\n };\r\n }\r\n const responseText = redirect\r\n ? `Content:\\n\\n${content}\\n\\nRedirect Information:\\n\\n${JSON.stringify(redirect, null, 2)}`\r\n : content;\r\n\r\n return {\r\n content: [ { type: 'text', text: responseText } ]\r\n };\r\n } else {\r\n // Original behavior: just return content\r\n const result = await promisifyBotMethod<string>(\r\n bot,\r\n 'getArticle',\r\n title,\r\n followRedirect\r\n );\r\n if (result == null) {\r\n return {\r\n content: [{ type: 'text', text: `Page \"${title}\" not found or has no content.` }],\r\n isError: true\r\n };\r\n }\r\n return {\r\n content: [ { type: 'text', text: result } ]\r\n };\r\n }\r\n } catch ( error ) {\r\n return {\r\n content: [ { type: 'text', text: `Error: ${ ( error as Error ).message }` } ],\r\n isError: true\r\n };\r\n }\r\n}\r\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport Bot from 'nodemw';\nimport { USER_AGENT } from '../server.js';\n\nexport interface ServerConfig {\n server: string;\n path: string;\n protocol?: string;\n port?: number;\n proxy?: string;\n userAgent?: string;\n concurrency?: number;\n debug?: boolean;\n username?: string;\n password?: string;\n token?: string;\n domain?: string;\n dryRun?: boolean;\n}\n\nlet botInstance: Bot | null = null;\nlet serverConfig: ServerConfig | null = null;\nlet authenticated = false;\n\nexport function initServerConfig(config: ServerConfig): void {\n serverConfig = config;\n}\n\nfunction createBotFromConfig(config: ServerConfig): Bot {\n const {\n server,\n path,\n protocol,\n port,\n proxy,\n userAgent,\n concurrency,\n debug,\n username,\n password,\n domain,\n dryRun\n } = config;\n\n return new Bot({\n server,\n protocol: protocol || 'https',\n port,\n path,\n proxy,\n userAgent: userAgent || USER_AGENT,\n concurrency,\n debug,\n username: username || undefined,\n password: password || undefined,\n domain,\n // @ts-expect-error: dryRun is supported by nodemw at runtime but missing from BotOptions types\n dryRun\n });\n}\n\nasync function testApiConnection(bot: Bot): Promise<boolean> {\n try {\n await promisifyBotMethod(bot, 'getSiteInfo', ['general']);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function autoDetectPath(baseConfig: ServerConfig): Promise<string> {\n // nodemw constructs URL as ${server}${path}/api.php \u2014 so /w means /w/api.php, '' means /api.php\n const pathsToTry = ['/w', ''];\n for (const path of pathsToTry) {\n const testConfig = { ...baseConfig, path };\n const bot = createBotFromConfig(testConfig);\n if (await testApiConnection(bot)) {\n return path;\n }\n }\n throw new Error(\n 'Could not auto-detect MediaWiki API path. ' +\n 'Tried /w/api.php and /api.php. ' +\n 'Please specify --path explicitly (e.g., --path /w or --path \"\" for root).'\n );\n}\n\nexport async function initBot(config: ServerConfig): Promise<Bot> {\n botInstance = createBotFromConfig(config);\n\n const { username, password } = config;\n if (username && password) {\n await new Promise<void>((resolve, reject) => {\n botInstance!.logIn((err: Error | null) => {\n if (err) {\n reject(new Error(`Login failed for user '${username}': ${err.message}`));\n } else {\n authenticated = true;\n resolve();\n }\n });\n });\n }\n\n return botInstance;\n}\n\nexport function getBot(): Bot {\n if (!botInstance) {\n throw new Error('Bot not initialized. Server must be started first.');\n }\n return botInstance;\n}\n\nexport function clearBotCache(): void {\n botInstance = null;\n authenticated = false;\n}\n\nexport function isAuthenticated(): boolean {\n return authenticated;\n}\n\nexport function promisifyBotMethod<T>(\n bot: Bot,\n method: string,\n ...args: unknown[]\n): Promise<T> {\n return new Promise((resolve, reject) => {\n const callback = (err: Error | null, result: T) => {\n if (err) {\n reject(err);\n } else {\n resolve(result);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (bot as any)[method](...args, callback);\n });\n}\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface SearchResult extends Record<string, any> {\r\n title: string;\r\n snippet?: string;\r\n url?: string;\r\n pageId?: number;\r\n}\r\n\r\nexport function searchTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'search',\r\n 'Search for wiki pages by keyword',\r\n {\r\n keyword: z.string().describe( 'Search keyword' ),\r\n limit: z.number().optional().default( 10 ).describe( 'Maximum number of results' )\r\n },\r\n {\r\n title: 'Search',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { keyword, limit } ) => handleSearchTool( keyword, limit )\r\n );\n tool.update({ outputSchema: { total: z.number(), limit: z.number(), keyword: z.string(), results: z.array(z.record(z.unknown())) } });\n return tool;\r\n}\r\n\r\nasync function handleSearchTool(\r\n keyword: string,\r\n limit: number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n\r\n // nodemw search returns array of results directly\r\n const results = await promisifyBotMethod<SearchResult[]>(\r\n bot,\r\n 'search',\r\n keyword\r\n );\r\n\r\n // Limit results\r\n const limitedResults = results.slice( 0, limit );\r\n\r\n return jsonResult({\r\n total: results.length,\r\n limit,\r\n keyword,\r\n results: limitedResults\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to search', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport type Bot from 'nodemw';\r\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';\r\n\r\nexport function promisifyBotMethod<T>(\r\n bot: Bot,\r\n method: string,\r\n ...args: unknown[]\r\n): Promise<T> {\r\n return new Promise( ( resolve, reject ) => {\r\n const callback = ( err: Error | null, result: T ) => {\r\n if ( err ) {\r\n reject( err );\r\n } else {\r\n resolve( result );\r\n }\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n ( bot as any )[ method ]( ...args, callback );\r\n } );\r\n}\r\n\r\nexport function isNonNullish<T>(\r\n value: T | null | undefined\r\n): value is T {\r\n return value !== null && value !== undefined;\r\n}\r\n\r\nexport function jsonResult(data: unknown): CallToolResult {\r\n return {\r\n content: [{\r\n type: 'text',\r\n text: JSON.stringify(data, null, 2)\r\n }],\r\n structuredContent: data as Record<string, unknown>\r\n };\r\n}\r\n\r\nexport function errorResult(message: string, error?: Error): CallToolResult {\r\n return {\r\n content: [{\r\n type: 'text',\r\n text: JSON.stringify({\r\n error: message,\r\n details: error?.message\r\n }, null, 2)\r\n }],\r\n isError: true\r\n };\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageInCategory extends Record<string, any> {\r\n title: string;\r\n pageid?: number;\r\n ns?: number;\r\n}\r\n\r\nexport function getPagesInCategoryTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-pages-in-category',\r\n 'Get all pages in a category',\r\n {\r\n category: z.string().describe( 'Category name (with or without Category: prefix)' )\r\n },\r\n {\r\n title: 'Get pages in category',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { category } ) => handleGetPagesInCategoryTool( category )\r\n );\n tool.update({ outputSchema: { category: z.string(), pages: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetPagesInCategoryTool(\r\n category: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n\r\n // Remove \"Category:\" prefix if present\r\n const cleanCategory = category.replace( /^Category:/i, '' );\r\n\r\n const results = await promisifyBotMethod<PageInCategory[]>(\r\n bot,\r\n 'getPagesInCategory',\r\n cleanCategory\r\n );\r\n\r\n return jsonResult({\r\n category: cleanCategory,\r\n pages: results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get pages in category', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function getCategoriesTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-categories',\r\n 'Get all categories matching a prefix',\r\n {\r\n prefix: z.string().optional().default('').describe('Prefix to filter categories')\r\n },\r\n {\r\n title: 'Get categories',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { prefix } ) => handleGetCategoriesTool( prefix )\r\n );\n tool.update({ outputSchema: { prefix: z.string(), categories: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetCategoriesTool(\r\n prefix: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const results = await promisifyBotMethod<string[]>(\r\n bot,\r\n 'getCategories',\r\n prefix\r\n );\r\n\r\n return jsonResult({\r\n prefix,\r\n categories: results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get categories', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface UserInfo extends Record<string, any> {\r\n name: string;\r\n userid: number;\r\n}\r\n\r\nexport function getUsersTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-users',\r\n 'Get all users matching a prefix',\r\n {\r\n prefix: z.string().optional().default('').describe('Prefix to filter usernames'),\r\n onlyWithEdits: z.boolean().optional().default(false).describe('Only include users with at least one edit')\r\n },\r\n {\r\n title: 'Get users',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { prefix, onlyWithEdits } ) => handleGetUsersTool( prefix, onlyWithEdits )\r\n );\n tool.update({ outputSchema: { prefix: z.string(), onlyWithEdits: z.boolean(), users: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetUsersTool(\r\n prefix: string,\r\n onlyWithEdits: boolean\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const results = await promisifyBotMethod<UserInfo[]>(\r\n bot,\r\n 'getUsers',\r\n { prefix, witheditsonly: onlyWithEdits }\r\n );\r\n\r\n return jsonResult({\r\n prefix,\r\n onlyWithEdits,\r\n users: results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get users', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface AllPage extends Record<string, any> {\r\n title: string;\r\n pageid: number;\r\n ns: number;\r\n}\r\n\r\nexport function getAllPagesTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-all-pages',\r\n 'Get all non-redirect pages from the wiki',\r\n {\r\n limit: z.number().optional().default(500).describe('Maximum number of pages to return')\r\n },\r\n {\r\n title: 'Get all pages',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { limit } ) => handleGetAllPagesTool( limit )\r\n );\n tool.update({ outputSchema: { total: z.number(), displayed: z.number(), pages: z.array(z.record(z.unknown())), limit: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetAllPagesTool(\r\n limit: number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const allResults = await promisifyBotMethod<AllPage[]>(\r\n bot,\r\n 'getAllPages'\r\n );\r\n\r\n // Limit results\r\n const results = allResults.slice(0, limit);\r\n\r\n return jsonResult({\r\n total: allResults.length,\r\n displayed: results.length,\r\n pages: results,\r\n limit\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get all pages', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageInNamespace extends Record<string, any> {\r\n title: string;\r\n pageid: number;\r\n ns: number;\r\n}\r\n\r\nexport function getPagesInNamespaceTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-pages-in-namespace',\r\n 'Get all non-redirect pages in a specific namespace',\r\n {\r\n namespace: z.number().describe('Namespace number to filter pages')\r\n },\r\n {\r\n title: 'Get pages in namespace',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { namespace } ) => handleGetPagesInNamespaceTool( namespace )\r\n );\n tool.update({ outputSchema: { namespace: z.number(), pages: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetPagesInNamespaceTool(\r\n namespace: number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const results = await promisifyBotMethod<PageInNamespace[]>(\r\n bot,\r\n 'getPagesInNamespace',\r\n namespace\r\n );\r\n\r\n return jsonResult({\r\n namespace,\r\n pages: results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get pages in namespace', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageByPrefix extends Record<string, any> {\r\n title: string;\r\n pageid: number;\r\n ns: number;\r\n}\r\n\r\nexport function getPagesByPrefixTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-pages-by-prefix',\r\n 'Get pages starting with a specific prefix',\r\n {\r\n prefix: z.string().describe('Prefix to match page titles')\r\n },\r\n {\r\n title: 'Get pages by prefix',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { prefix } ) => handleGetPagesByPrefixTool( prefix )\r\n );\n tool.update({ outputSchema: { prefix: z.string(), pages: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetPagesByPrefixTool(\r\n prefix: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const results = await promisifyBotMethod<PageByPrefix[]>(\r\n bot,\r\n 'getPagesByPrefix',\r\n prefix\r\n );\r\n\r\n return jsonResult({\r\n prefix,\r\n pages: results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get pages by prefix', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface TranscludingPage extends Record<string, any> {\r\n title: string;\r\n pageid: number;\r\n ns: number;\r\n}\r\n\r\nexport function getPagesTranscludingTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-pages-transcluding',\r\n 'Get all pages that transclude (include) a specific template',\r\n {\r\n template: z.string().describe('Template title to find transclusions')\r\n },\r\n {\r\n title: 'Get pages transcluding template',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { template } ) => handleGetPagesTranscludingTool( template )\r\n );\n tool.update({ outputSchema: { template: z.string(), pages: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetPagesTranscludingTool(\r\n template: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const callbackArgs = await promisifyBotMethod<[Error | null, TranscludingPage[] | [undefined]]>(\r\n bot,\r\n 'getPagesTranscluding',\r\n template\r\n );\r\n\r\n // Extract results from callback args (ignore first arg if it's error, which promisifyBotMethod already handles)\r\n const rawResults = callbackArgs[1];\r\n const results = Array.isArray(rawResults) \r\n ? rawResults.filter((page): page is TranscludingPage => page != null && typeof page === 'object' && 'title' in page)\r\n : [];\r\n\r\n return jsonResult({\r\n template,\r\n pages: results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get pages transcluding template', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface Revision extends Record<string, any> {\r\n revid: number;\r\n timestamp: string;\r\n user: string;\r\n comment: string;\r\n size: number;\r\n}\r\n\r\nexport function getArticleRevisionsTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-article-revisions',\r\n 'Get all revisions of a wiki article',\r\n {\r\n title: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n },\r\n {\r\n title: 'Get article revisions',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title } ) => handleGetArticleRevisionsTool( title )\r\n );\n tool.update({ outputSchema: { title: z.string(), revisions: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetArticleRevisionsTool(\r\n title: string | number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const allRevisions = await promisifyBotMethod<Revision[][]>(\r\n bot,\r\n 'getArticleRevisions',\r\n title\r\n );\r\n\r\n // Flatten the results\r\n const revisions = allRevisions.flat();\r\n\r\n return jsonResult({\r\n title,\r\n revisions,\r\n count: revisions.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get article revisions', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function getArticleCategoriesTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-article-categories',\r\n 'Get all categories that an article belongs to',\r\n {\r\n title: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n },\r\n {\r\n title: 'Get article categories',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title } ) => handleGetArticleCategoriesTool( title )\r\n );\n tool.update({ outputSchema: { title: z.string(), categories: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetArticleCategoriesTool(\r\n title: string | number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const categories = await promisifyBotMethod<string[]>(\r\n bot,\r\n 'getArticleCategories',\r\n title\r\n );\r\n\r\n return jsonResult({\r\n title,\r\n categories,\r\n count: categories.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get article categories', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface PageProperties extends Record<string, any> {\r\n [key: string]: string | undefined;\r\n}\r\n\r\nexport function getArticlePropertiesTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-article-properties',\r\n 'Get page properties for a wiki article',\r\n {\r\n title: z.string().describe('Article title')\r\n },\r\n {\r\n title: 'Get article properties',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title } ) => handleGetArticlePropertiesTool( title )\r\n );\n tool.update({ outputSchema: { title: z.string(), properties: z.record(z.unknown()) } });\n return tool;\r\n}\r\n\r\nasync function handleGetArticlePropertiesTool(\r\n title: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const properties = await promisifyBotMethod<PageProperties>(\r\n bot,\r\n 'getArticleProperties',\r\n title\r\n );\r\n\r\n return jsonResult({\r\n title,\r\n properties\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get article properties', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ArticleInfo extends Record<string, any> {\r\n title: string;\r\n pageid: number;\r\n ns: number;\r\n}\r\n\r\nexport function getArticleInfoTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-article-info',\r\n 'Get detailed information about one or more articles',\r\n {\r\n title: z.union([\r\n z.string(),\r\n z.number(),\r\n z.array(z.union([z.string(), z.number()]))\r\n ]).describe('Article title, page ID, or array of titles/IDs'),\r\n properties: z.array(z.string()).optional().describe('Specific properties to retrieve')\r\n },\r\n {\r\n title: 'Get article info',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title, properties } ) => handleGetArticleInfoTool( title, properties )\r\n );\n tool.update({ outputSchema: { title: z.string(), results: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetArticleInfoTool(\r\n title: string | number | (string | number)[],\r\n properties?: string[]\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const options = properties ? { inprop: properties } : {};\r\n const info = await promisifyBotMethod<ArticleInfo>(\r\n bot,\r\n 'getArticleInfo',\r\n title,\r\n options\r\n );\r\n\r\n // Handle array of results vs single result\r\n const results = Array.isArray(info) ? info : [info];\r\n\r\n return jsonResult({\r\n title,\r\n results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get article info', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface UserContrib extends Record<string, any> {\r\n title: string;\r\n revid: number;\r\n timestamp: string;\r\n comment: string;\r\n}\r\n\r\nexport function getUserContribsTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-user-contribs',\r\n 'Get contributions made by a specific user',\r\n {\r\n username: z.string().describe('Username to get contributions for'),\r\n namespace: z.number().optional().describe('Filter contributions by namespace'),\r\n limit: z.number().optional().default(50).describe('Maximum number of contributions to return')\r\n },\r\n {\r\n title: 'Get user contributions',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { username, namespace, limit } ) => handleGetUserContribsTool( username, namespace, limit )\r\n );\n tool.update({ outputSchema: { username: z.string(), namespace: z.number(), limit: z.number(), total: z.number(), displayed: z.number(), contributions: z.array(z.record(z.unknown())) } });\n return tool;\r\n}\r\n\r\nasync function handleGetUserContribsTool(\r\n username: string,\r\n namespace?: number,\r\n limit: number = 50\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const options = {\r\n user: username,\r\n ...(namespace !== undefined && { namespace })\r\n };\r\n\r\n const callbackArgs = await promisifyBotMethod<[Error | null, UserContrib[], string | boolean]>(\r\n bot,\r\n 'getUserContribs',\r\n options\r\n );\r\n\r\n const contribs = Array.isArray(callbackArgs[1]) ? callbackArgs[1] : [];\r\n\r\n // Limit results\r\n const limitedContribs = contribs.slice(0, limit);\r\n\r\n return jsonResult({\r\n username,\r\n namespace,\r\n limit,\r\n total: contribs.length,\r\n displayed: limitedContribs.length,\r\n contributions: limitedContribs\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get user contributions', error as Error);\r\n }\r\n}\r\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface UserInfo extends Record<string, any> {\n name: string;\n id: number;\n groups: string[];\n rights: string[];\n}\n\nexport function whoamiTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'whoami',\n 'Get information about the currently logged in user',\n {},\n {\n title: 'Who am I',\n readOnlyHint: true,\n destructiveHint: false\n } as ToolAnnotations,\n async () => handleWhoamiTool()\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleWhoamiTool(): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const userInfo = await promisifyBotMethod<UserInfo>(\n bot,\n 'whoami'\n );\n\n return jsonResult(userInfo);\n } catch ( error ) {\n return errorResult('Failed to get current user info', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface WhoisUserInfo extends Record<string, any> {\n name: string;\n userid: number;\n groups: string[];\n rights: string[];\n}\n\nexport function whoisTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'whois',\n 'Get information about a specific user',\n {\n username: z.string().describe('Username to look up')\n },\n {\n title: 'Whois',\n readOnlyHint: true,\n destructiveHint: false\n } as ToolAnnotations,\n async ( { username } ) => handleWhoisTool( username )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleWhoisTool(\n username: string\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const userInfo = await promisifyBotMethod<WhoisUserInfo & { missing?: string }>(\n bot,\n 'whois',\n username\n );\n\n if (userInfo.missing) {\n return errorResult(`User \"${username}\" not found.`);\n }\n\n return jsonResult(userInfo);\n } catch ( error ) {\n return errorResult('Failed to get user info', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function whoareTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'whoare',\n 'Get information about multiple wiki users',\n {\n usernames: z.array( z.string() ).describe( 'Array of usernames to query' ),\n },\n {\n title: 'Who are',\n readOnlyHint: true,\n destructiveHint: false\n } as ToolAnnotations,\n async ( params ) => handleWhoareTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleWhoareTool(\n params: {\n usernames: string[];\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n\n const users = await promisifyBotMethod<any[]>(\n bot,\n 'whoare',\n params.usernames\n );\n\n return jsonResult(users);\n } catch ( error ) {\n return errorResult('Failed to get user information', error as Error);\n }\n}\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface Image extends Record<string, any> {\r\n name: string;\r\n img_timestamp: string;\r\n user: string;\r\n}\r\n\r\nexport function getImagesTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-images',\r\n 'Get list of images starting from a specific name',\r\n {\r\n startFrom: z.string().optional().default('').describe('Start from this image name'),\r\n limit: z.number().optional().default(50).describe('Maximum number of images to return')\r\n },\r\n {\r\n title: 'Get images',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { startFrom, limit } ) => handleGetImagesTool( startFrom, limit )\r\n );\n tool.update({ outputSchema: { total: z.number(), limit: z.number(), startFrom: z.string(), images: z.array(z.record(z.unknown())) } });\n return tool;\r\n}\r\n\r\nasync function handleGetImagesTool(\r\n startFrom: string,\r\n limit: number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n // getImages has a different callback signature - let's handle it manually\r\n const images = await new Promise<Image[]>((resolve, reject) => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (bot as any).getImages(startFrom, (err: Error | null, ...args: any[]) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n const imgs = args[0];\r\n resolve(Array.isArray(imgs) ? imgs : []);\r\n }\r\n });\r\n });\r\n\r\n // Limit results\r\n const limitedImages = images.slice(0, limit);\r\n\r\n return jsonResult({\r\n total: images.length,\r\n limit,\r\n startFrom,\r\n images: limitedImages\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get images', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ArticleImage extends Record<string, any> {\r\n title: string;\r\n ns: number;\r\n}\r\n\r\nexport function getImagesFromArticleTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-images-from-article',\r\n 'Get all images embedded in a specific article',\r\n {\r\n title: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n },\r\n {\r\n title: 'Get images from article',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title } ) => handleGetImagesFromArticleTool( title )\r\n );\n tool.update({ outputSchema: { title: z.string(), images: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetImagesFromArticleTool(\r\n title: string | number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const images = await promisifyBotMethod<ArticleImage[]>(\r\n bot,\r\n 'getImagesFromArticle',\r\n title\r\n );\r\n\r\n return jsonResult({\r\n title,\r\n images,\r\n count: images.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get images from article', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type {CallToolResult, ToolAnnotations} from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ImageUsage extends Record<string, any> {\r\n title: string;\r\n pageid: number;\r\n ns: number;\r\n}\r\n\r\nexport function getImageUsageTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-image-usage',\r\n 'Get all pages that use a specific image',\r\n {\r\n filename: z.string().describe('Image filename with File: prefix')\r\n },\r\n {\r\n title: 'Get image usage',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { filename } ) => handleGetImageUsageTool( filename )\r\n );\n tool.update({ outputSchema: { filename: z.string(), pages: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetImageUsageTool(\r\n filename: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const pages = await promisifyBotMethod<ImageUsage[]>(\r\n bot,\r\n 'getImageUsage',\r\n filename\r\n );\r\n\r\n return jsonResult({\r\n filename,\r\n pages,\r\n count: pages.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get image usage', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ImageInfo extends Record<string, any> {\r\n timestamp: string;\r\n user: string;\r\n width: number;\r\n height: number;\r\n size: number;\r\n url: string;\r\n descriptionurl: string;\r\n exif?: Record<string, string>;\r\n}\r\n\r\nexport function getImageInfoTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-image-info',\r\n 'Get detailed information about an image file',\r\n {\r\n filename: z.string().describe('Image filename with File: prefix')\r\n },\r\n {\r\n title: 'Get image info',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { filename } ) => handleGetImageInfoTool( filename )\r\n );\n tool.update({ outputSchema: { filename: z.string(), info: z.record(z.unknown()) } });\n return tool;\r\n}\r\n\r\nasync function handleGetImageInfoTool(\r\n filename: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const info = await promisifyBotMethod<ImageInfo | undefined>(\r\n bot,\r\n 'getImageInfo',\r\n filename\r\n );\r\n\r\n if (!info) {\r\n return errorResult(`Image \"${filename}\" not found.`);\r\n }\r\n\r\n return jsonResult({\r\n filename,\r\n info\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get image info', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface LogEntry extends Record<string, any> {\r\n title: string;\r\n timestamp: string;\r\n user: string;\r\n action: string;\r\n comment: string;\r\n}\r\n\r\nexport function getLogTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-log',\r\n 'Get log entries of a specific type',\r\n {\r\n type: z.string().describe('Log type (e.g. delete, block, move)'),\r\n start: z.string().optional().default('').describe('Start timestamp (YYYYMMDDHHMMSS format)'),\r\n limit: z.number().optional().default(50).describe('Maximum number of entries to return')\r\n },\r\n {\r\n title: 'Get log entries',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { type, start, limit } ) => handleGetLogTool( type, start, limit )\r\n );\n tool.update({ outputSchema: { type: z.string(), start: z.string(), limit: z.number(), total: z.number(), displayed: z.number(), entries: z.array(z.record(z.unknown())) } });\n return tool;\r\n}\r\n\r\nasync function handleGetLogTool(\r\n type: string,\r\n start: string,\r\n limit: number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n // Handle getLog's callback signature manually\r\n const entries = await new Promise<LogEntry[]>((resolve, reject) => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (bot as any).getLog(type, start, (err: Error | null, ...args: any[]) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n const ents = args[0];\r\n resolve(Array.isArray(ents) ? ents : []);\r\n }\r\n });\r\n });\r\n\r\n // Limit results\r\n const limitedEntries = entries.slice(0, limit);\r\n\r\n return jsonResult({\r\n type,\r\n start,\r\n limit,\r\n total: entries.length,\r\n displayed: limitedEntries.length,\r\n entries: limitedEntries\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get log entries', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\n\r\nexport function expandTemplatesTool( server: McpServer ): RegisteredTool {\r\n return server.tool(\r\n 'expand-templates',\r\n 'Expand templates in wikitext',\r\n {\r\n text: z.string().describe('Wikitext with templates to expand'),\r\n title: z.string().optional().describe('Context page title'),\r\n },\r\n {\r\n title: 'Expand templates',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { text, title } ) => handleExpandTemplatesTool( text, title )\r\n );\r\n}\r\n\r\nasync function handleExpandTemplatesTool(\r\n text: string,\r\n title?: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const expandedXml = await promisifyBotMethod<string>(\r\n bot,\r\n 'expandTemplates',\r\n text,\r\n title || ''\r\n );\r\n\r\n if (expandedXml == null) {\r\n return {\r\n content: [{ type: 'text', text: `Failed to expand templates for \"${text}\".` }],\r\n isError: true\r\n };\r\n }\r\n\r\n return {\r\n content: [ { type: 'text', text: expandedXml } ]\r\n };\r\n } catch ( error ) {\r\n return {\r\n content: [ { type: 'text', text: `Error: ${ ( error as Error ).message }` } ],\r\n isError: true\r\n };\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\n\r\nexport function parseTool( server: McpServer ): RegisteredTool {\r\n return server.tool(\r\n 'parse',\r\n 'Parse wikitext to HTML',\r\n {\r\n text: z.string().describe('Wikitext to parse'),\r\n title: z.string().optional().describe('Context page title')\r\n },\r\n {\r\n title: 'Parse wikitext',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { text, title } ) => handleParseTool( text, title )\r\n );\r\n}\r\n\r\nasync function handleParseTool(\r\n text: string,\r\n title?: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const callbackArgs = await promisifyBotMethod<[Error | null, string, string[]]>(\r\n bot,\r\n 'parse',\r\n text,\r\n title || ''\r\n );\r\n\r\n const xml = callbackArgs[1] || '';\r\n const images = Array.isArray(callbackArgs[2]) ? callbackArgs[2] : [];\r\n\r\n const output = [\r\n 'Parsed XML structure:',\r\n '',\r\n xml,\r\n '',\r\n `Images found: ${images.length > 0 ? images.join(', ') : 'none'}`\r\n ].join( '\\n' );\r\n\r\n return {\r\n content: [ { type: 'text', text: output } ]\r\n };\r\n } catch ( error ) {\r\n return {\r\n content: [ { type: 'text', text: `Error: ${ ( error as Error ).message }` } ],\r\n isError: true\r\n };\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface RecentChange extends Record<string, any> {\r\n title: string;\r\n timestamp: string;\r\n user: string;\r\n comment: string;\r\n}\r\n\r\nexport function getRecentChangesTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-recent-changes',\r\n 'Get recent changes on the wiki',\r\n {\r\n start: z.string().optional().describe('Start timestamp'),\r\n limit: z.number().optional().default(50).describe('Maximum number of changes to return')\r\n },\r\n {\r\n title: 'Get recent changes',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { start, limit } ) => handleGetRecentChangesTool( start, limit )\r\n );\n tool.update({ outputSchema: { total: z.number(), limit: z.number(), start: z.string(), changes: z.array(z.record(z.unknown())) } });\n return tool;\r\n}\r\n\r\nasync function handleGetRecentChangesTool(\r\n start?: string,\r\n limit: number = 50\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n // Handle getRecentChanges's callback signature manually\r\n const changes = await new Promise<RecentChange[]>((resolve, reject) => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (bot as any).getRecentChanges(start, (err: Error | null, ...args: any[]) => {\r\n if (err) {\r\n reject(err);\r\n } else {\r\n const chgs = args[0];\r\n resolve(Array.isArray(chgs) ? chgs : []);\r\n }\r\n });\r\n });\r\n\r\n // Limit results\r\n const limitedChanges = changes.slice(0, limit);\r\n\r\n return jsonResult({\r\n total: changes.length,\r\n limit,\r\n start,\r\n changes: limitedChanges\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get recent changes', error as Error);\r\n }\r\n}\r\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function getSiteInfoTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'get-site-info',\n 'Get site information from MediaWiki',\n {\n properties: z.array(z.string()).describe('List of site information properties to retrieve')\n },\n {\n title: 'Get site info',\n readOnlyHint: true,\n destructiveHint: false\n } as ToolAnnotations,\n async ( { properties } ) => handleGetSiteInfoTool( properties )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleGetSiteInfoTool(\n properties: string[]\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const info = await promisifyBotMethod<Record<string, unknown>>(\n bot,\n 'getSiteInfo',\n properties\n );\n\n return jsonResult(info || {});\n } catch ( error ) {\n return errorResult('Failed to get site info', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ninterface SiteStats extends Record<string, any> {\n pages: number;\n articles: number;\n edits: number;\n images: number;\n users: number;\n activeusers: number;\n admins: number;\n jobs: number;\n}\n\nexport function getSiteStatsTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'get-site-stats',\n 'Get site statistics',\n {},\n {\n title: 'Get site stats',\n readOnlyHint: true,\n destructiveHint: false\n } as ToolAnnotations,\n async () => handleGetSiteStatsTool()\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleGetSiteStatsTool(): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const stats = await promisifyBotMethod<SiteStats>(\n bot,\n 'getSiteStats'\n );\n\n return jsonResult(stats);\n } catch ( error ) {\n return errorResult('Failed to get site stats', error as Error);\n }\n}\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\nexport function getMediaWikiVersionTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-mediawiki-version',\r\n 'Get MediaWiki version running on the server',\r\n {},\r\n {\r\n title: 'Get MediaWiki version',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async () => handleGetMediaWikiVersionTool()\r\n );\r\n tool.update({ outputSchema: { version: z.string() } });\r\n return tool;\r\n}\r\n\r\nasync function handleGetMediaWikiVersionTool(): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const version = await promisifyBotMethod<string>(\r\n bot,\r\n 'getMediaWikiVersion'\r\n );\r\n\r\n return jsonResult({ version });\r\n } catch ( error ) {\r\n return errorResult('Failed to get MediaWiki version', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface QueryPageResult extends Record<string, any> {\r\n title: string;\r\n value: number;\r\n}\r\n\r\nexport function getQueryPageTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-query-page',\r\n 'Get results from a query page (special page)',\r\n {\r\n name: z.string().describe('Name of the query page')\r\n },\r\n {\r\n title: 'Get query page results',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { name } ) => handleGetQueryPageTool( name )\r\n );\n tool.update({ outputSchema: { name: z.string(), results: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetQueryPageTool(\r\n name: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const results = await promisifyBotMethod<QueryPageResult[]>(\r\n bot,\r\n 'getQueryPage',\r\n name\r\n );\r\n\r\n return jsonResult({\r\n name,\r\n results,\r\n count: results.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get query page results', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface ExternalLink extends Record<string, any> {\r\n '*': string;\r\n}\r\n\r\nexport function getExternalLinksTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-external-links',\r\n 'Get all external links from an article',\r\n {\r\n title: z.union([z.string(), z.number()]).describe('Article title or page ID')\r\n },\r\n {\r\n title: 'Get external links',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title } ) => handleGetExternalLinksTool( title )\r\n );\n tool.update({ outputSchema: { title: z.string(), links: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetExternalLinksTool(\r\n title: string | number\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const links = await promisifyBotMethod<ExternalLink[]>(\r\n bot,\r\n 'getExternalLinks',\r\n title\r\n );\r\n\r\n return jsonResult({\r\n title,\r\n links: links.map(link => link['*']),\r\n count: links.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get external links', error as Error);\r\n }\r\n}\r\n", "/*\r\n * SPDX-License-Identifier: BSD-2-Clause\r\n *\r\n * Copyright (c) 2026 Xie Youtian\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nimport { z } from 'zod';\r\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\r\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\r\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\r\nimport { jsonResult, errorResult } from '../../common/utils.js';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ninterface Backlink extends Record<string, any> {\r\n title: string;\r\n pageid: number;\r\n}\r\n\r\nexport function getBacklinksTool( server: McpServer ): RegisteredTool {\r\n const tool = server.tool(\r\n 'get-backlinks',\r\n 'Get all backlinks to a specific page',\r\n {\r\n title: z.string().describe('Target page title to find backlinks for')\r\n },\r\n {\r\n title: 'Get backlinks',\r\n readOnlyHint: true,\r\n destructiveHint: false\r\n } as ToolAnnotations,\r\n async ( { title } ) => handleGetBacklinksTool( title )\r\n );\n tool.update({ outputSchema: { target: z.string(), backlinks: z.array(z.record(z.unknown())), count: z.number() } });\n return tool;\r\n}\r\n\r\nasync function handleGetBacklinksTool(\r\n title: string\r\n): Promise<CallToolResult> {\r\n try {\r\n const bot = await getBot();\r\n const backlinks = await promisifyBotMethod<Backlink[]>(\r\n bot,\r\n 'getBacklinks',\r\n title\r\n );\r\n\r\n return jsonResult({\r\n target: title,\r\n backlinks,\r\n count: backlinks.length\r\n });\r\n } catch ( error ) {\r\n return errorResult('Failed to get backlinks', error as Error);\r\n }\r\n}\r\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function editTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'edit',\n 'Edit a wiki page (requires authentication)',\n {\n title: z.string().describe( 'Page title to edit' ),\n content: z.string().describe( 'New content for the page' ),\n summary: z.string().describe( 'Edit summary' ),\n minor: z.boolean().optional().default( false ).describe( 'Mark as minor edit' )\n },\n {\n title: 'Edit page',\n readOnlyHint: false,\n destructiveHint: true\n } as ToolAnnotations,\n async ( params ) => handleEditTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleEditTool(\n params: {\n title: string;\n content: string;\n summary: string;\n minor?: boolean;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const prefixedSummary = `[nodemw-mcp] ${params.summary}`;\n\n const result = await promisifyBotMethod<{\n title: string;\n pageid?: number;\n oldrevid?: number;\n newrevid?: number;\n }>(\n bot,\n 'edit',\n params.title,\n params.content,\n prefixedSummary,\n params.minor || false\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to edit page', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function appendTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'append',\n 'Append content to a wiki page (requires authentication)',\n {\n title: z.string().describe( 'Page title' ),\n content: z.string().describe( 'Content to append' ),\n summary: z.string().describe( 'Edit summary' )\n },\n {\n title: 'Append to page',\n readOnlyHint: false,\n destructiveHint: true\n } as ToolAnnotations,\n async ( params ) => handleAppendTool( params )\n );\n tool.update({ outputSchema: { success: z.boolean(), title: z.string() } });\n return tool;\n}\n\nasync function handleAppendTool(\n params: {\n title: string;\n content: string;\n summary: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const prefixedSummary = `[nodemw-mcp] ${params.summary}`;\n\n await promisifyBotMethod<void>(\n bot,\n 'append',\n params.title,\n params.content,\n prefixedSummary\n );\n\n return jsonResult({ success: true, title: params.title });\n } catch ( error ) {\n return errorResult('Failed to append to page', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function prependTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'prepend',\n 'Prepend content to a wiki page (requires authentication)',\n {\n title: z.string().describe( 'Page title to prepend to' ),\n content: z.string().describe( 'Content to prepend' ),\n summary: z.string().describe( 'Edit summary' ),\n },\n {\n title: 'Prepend to page',\n readOnlyHint: false,\n destructiveHint: true\n } as ToolAnnotations,\n async ( params ) => handlePrependTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handlePrependTool(\n params: {\n title: string;\n content: string;\n summary: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const prefixedSummary = `[nodemw-mcp] ${params.summary}`;\n\n const result = await promisifyBotMethod<{\n title: string;\n pageid?: number;\n oldrevid?: number;\n newrevid?: number;\n }>(\n bot,\n 'prepend',\n params.title,\n params.content,\n prefixedSummary\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to prepend to page', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function moveTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'move',\n 'Move (rename) a wiki page (requires authentication)',\n {\n from: z.string().describe( 'Current page title' ),\n to: z.string().describe( 'New page title' ),\n summary: z.string().describe( 'Move summary' ),\n },\n {\n title: 'Move page',\n readOnlyHint: false,\n destructiveHint: true\n } as ToolAnnotations,\n async ( params ) => handleMoveTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleMoveTool(\n params: {\n from: string;\n to: string;\n summary: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const prefixedSummary = `[nodemw-mcp] ${params.summary}`;\n\n const result = await promisifyBotMethod<{\n from: string;\n to: string;\n reason: string;\n }>(\n bot,\n 'move',\n params.from,\n params.to,\n prefixedSummary\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to move page', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function deleteTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'delete',\n 'Delete a wiki page (requires authentication)',\n {\n title: z.string().describe( 'Page title to delete' ),\n reason: z.string().describe( 'Reason for deletion' ),\n },\n {\n title: 'Delete page',\n readOnlyHint: false,\n destructiveHint: true\n } as ToolAnnotations,\n async ( params ) => handleDeleteTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleDeleteTool(\n params: {\n title: string;\n reason: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const prefixedReason = `[nodemw-mcp] ${params.reason}`;\n\n const result = await promisifyBotMethod<{\n title: string;\n reason: string;\n }>(\n bot,\n 'delete',\n params.title,\n prefixedReason\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to delete page', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function protectTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'protect',\n 'Protect a wiki page (requires authentication)',\n {\n title: z.string().describe( 'Page title to protect' ),\n protections: z.array(\n z.object({\n type: z.string().describe( 'Action type (e.g., edit, move)' ),\n level: z.string().optional().default('all').describe( 'Protection level (e.g., sysop, autoconfirmed)' ),\n expiry: z.string().optional().describe( 'Expiry time (e.g., 1 week, never)' )\n })\n ).describe( 'Protection settings' ),\n reason: z.string().optional().describe( 'Reason for protection' ),\n cascade: z.boolean().optional().default(false).describe( 'Apply cascade protection' )\n },\n {\n title: 'Protect page',\n readOnlyHint: false,\n destructiveHint: true\n } as ToolAnnotations,\n async ( params ) => handleProtectTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleProtectTool(\n params: {\n title: string;\n protections: Array<{ type: string; level?: string; expiry?: string }>;\n reason?: string;\n cascade?: boolean;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const options: any = {};\n if (params.reason) {\n options.reason = `[nodemw-mcp] ${params.reason}`;\n }\n if (params.cascade) {\n options.cascade = params.cascade;\n }\n\n const result = await promisifyBotMethod<{\n title: string;\n protections: any[];\n }>(\n bot,\n 'protect',\n params.title,\n params.protections,\n options\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to protect page', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function purgeTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'purge',\n 'Purge cache for wiki pages',\n {\n titles: z.union([z.string(), z.array(z.string())]).describe( 'Page title(s) or category to purge' ),\n },\n {\n title: 'Purge pages',\n readOnlyHint: false,\n destructiveHint: false\n } as ToolAnnotations,\n async ( params ) => handlePurgeTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handlePurgeTool(\n params: {\n titles: string | string[];\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n\n const result = await promisifyBotMethod<any[]>(\n bot,\n 'purge',\n params.titles\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to purge pages', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function sendEmailTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'send-email',\n 'Send email to a wiki user (requires authentication)',\n {\n username: z.string().describe( 'Username to email' ),\n subject: z.string().describe( 'Email subject' ),\n text: z.string().describe( 'Email content' ),\n },\n {\n title: 'Send email',\n readOnlyHint: false,\n destructiveHint: false\n } as ToolAnnotations,\n async ( params ) => handleSendEmailTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleSendEmailTool(\n params: {\n username: string;\n subject: string;\n text: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n\n const result = await promisifyBotMethod<{\n result: string;\n }>(\n bot,\n 'sendEmail',\n params.username,\n params.subject,\n params.text\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to send email', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function uploadTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'upload',\n 'Upload a file to wiki (requires authentication)',\n {\n filename: z.string().describe( 'Destination filename on wiki' ),\n content: z.string().describe( 'File content as base64 string' ),\n comment: z.string().optional().describe( 'Upload comment' ),\n },\n {\n title: 'Upload file',\n readOnlyHint: false,\n destructiveHint: false\n } as ToolAnnotations,\n async ( params ) => handleUploadTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleUploadTool(\n params: {\n filename: string;\n content: string;\n comment?: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const fileContent = Buffer.from(params.content, 'base64');\n const comment = params.comment ? `[nodemw-mcp] ${params.comment}` : '[nodemw-mcp] File upload';\n\n const result = await promisifyBotMethod<{\n result: string;\n filename: string;\n imageinfo?: any;\n }>(\n bot,\n 'upload',\n params.filename,\n fileContent,\n comment\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to upload file', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function uploadByUrlTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'upload-by-url',\n 'Upload a file to wiki from URL (requires authentication)',\n {\n filename: z.string().describe( 'Destination filename on wiki' ),\n url: z.string().url().describe( 'Source URL to download file from' ),\n summary: z.string().optional().describe( 'Upload summary' ),\n },\n {\n title: 'Upload file by URL',\n readOnlyHint: false,\n destructiveHint: false\n } as ToolAnnotations,\n async ( params ) => handleUploadByUrlTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleUploadByUrlTool(\n params: {\n filename: string;\n url: string;\n summary?: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n const prefixedSummary = params.summary ? `[nodemw-mcp] ${params.summary}` : '[nodemw-mcp] File upload from URL';\n\n const result = await promisifyBotMethod<{\n result: string;\n filename: string;\n imageinfo?: any;\n }>(\n bot,\n 'uploadByUrl',\n params.filename,\n params.url,\n prefixedSummary\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to upload file by URL', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function addFlowTopicTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'add-flow-topic',\n 'Add a new Flow topic to a wiki page (requires authentication)',\n {\n title: z.string().describe( 'Page title to add topic to' ),\n subject: z.string().describe( 'Topic subject' ),\n content: z.string().describe( 'Topic content in wikitext' ),\n },\n {\n title: 'Add Flow topic',\n readOnlyHint: false,\n destructiveHint: false\n } as ToolAnnotations,\n async ( params ) => handleAddFlowTopicTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleAddFlowTopicTool(\n params: {\n title: string;\n subject: string;\n content: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n\n const result = await promisifyBotMethod<{\n 'new-topic': {\n status: string;\n workflow: string;\n };\n }>(\n bot,\n 'addFlowTopic',\n params.title,\n params.subject,\n params.content\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to add Flow topic', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { z } from 'zod';\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';\nimport { getBot, promisifyBotMethod } from '../../common/nodemwBot.js';\nimport { jsonResult, errorResult } from '../../common/utils.js';\n\nexport function createAccountTool( server: McpServer ): RegisteredTool {\n const tool = server.tool(\n 'create-account',\n 'Create a new MediaWiki user account (requires authentication)',\n {\n username: z.string().describe( 'New account username' ),\n password: z.string().describe( 'New account password' ),\n },\n {\n title: 'Create user account',\n readOnlyHint: false,\n destructiveHint: false\n } as ToolAnnotations,\n async ( params ) => handleCreateAccountTool( params )\n );\n tool.update({ outputSchema: {} });\n return tool;\n}\n\nasync function handleCreateAccountTool(\n params: {\n username: string;\n password: string;\n }\n): Promise<CallToolResult> {\n try {\n const bot = await getBot();\n\n const result = await promisifyBotMethod<any>(\n bot,\n 'createAccount',\n params.username,\n params.password\n );\n\n return jsonResult(result);\n } catch ( error ) {\n return errorResult('Failed to create account', error as Error);\n }\n}\n", "/*\n * SPDX-License-Identifier: BSD-2-Clause\n *\n * Copyright (c) 2026 Xie Youtian\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';\n\n// Read tools\nimport { getArticleTool } from './ro/get-article.js';\nimport { searchTool } from './ro/search.js';\nimport { getPagesInCategoryTool } from './ro/get-pages-in-category.js';\nimport { getCategoriesTool } from './ro/get-categories.js';\nimport { getUsersTool } from './ro/get-users.js';\nimport { getAllPagesTool } from './ro/get-all-pages.js';\nimport { getPagesInNamespaceTool } from './ro/get-pages-in-namespace.js';\nimport { getPagesByPrefixTool } from './ro/get-pages-by-prefix.js';\nimport { getPagesTranscludingTool } from './ro/get-pages-transcluding.js';\nimport { getArticleRevisionsTool } from './ro/get-article-revisions.js';\nimport { getArticleCategoriesTool } from './ro/get-article-categories.js';\nimport { getArticlePropertiesTool } from './ro/get-article-properties.js';\nimport { getArticleInfoTool } from './ro/get-article-info.js';\nimport { getUserContribsTool } from './ro/get-user-contribs.js';\nimport { whoamiTool } from './ro/whoami.js';\nimport { whoisTool } from './ro/whois.js';\nimport { whoareTool } from './ro/whoare.js';\nimport { getImagesTool } from './ro/get-images.js';\nimport { getImagesFromArticleTool } from './ro/get-images-from-article.js';\nimport { getImageUsageTool } from './ro/get-image-usage.js';\nimport { getImageInfoTool } from './ro/get-image-info.js';\nimport { getLogTool } from './ro/get-log.js';\nimport { expandTemplatesTool } from './ro/expand-templates.js';\nimport { parseTool } from './ro/parse.js';\nimport { getRecentChangesTool } from './ro/get-recent-changes.js';\nimport { getSiteInfoTool } from './ro/get-site-info.js';\nimport { getSiteStatsTool } from './ro/get-site-stats.js';\nimport { getMediaWikiVersionTool } from './ro/get-mediawiki-version.js';\nimport { getQueryPageTool } from './ro/get-query-page.js';\nimport { getExternalLinksTool } from './ro/get-external-links.js';\nimport { getBacklinksTool } from './ro/get-backlinks.js';\n\n// Write tools\nimport { editTool } from './editing/edit.js';\nimport { appendTool } from './editing/append.js';\nimport { prependTool } from './editing/prepend.js';\nimport { moveTool } from './editing/move.js';\nimport { deleteTool } from './editing/delete.js';\nimport { protectTool } from './editing/protect.js';\nimport { purgeTool } from './editing/purge.js';\nimport { sendEmailTool } from './editing/send-email.js';\nimport { uploadTool } from './editing/upload.js';\nimport { uploadByUrlTool } from './editing/upload-by-url.js';\nimport { addFlowTopicTool } from './editing/add-flow-topic.js';\nimport { createAccountTool } from './editing/create-account.js';\n\nconst readToolRegistrars = [\n getArticleTool,\n searchTool,\n getPagesInCategoryTool,\n getCategoriesTool,\n getUsersTool,\n getAllPagesTool,\n getPagesInNamespaceTool,\n getPagesByPrefixTool,\n getPagesTranscludingTool,\n getArticleRevisionsTool,\n getArticleCategoriesTool,\n getArticlePropertiesTool,\n getArticleInfoTool,\n getUserContribsTool,\n whoamiTool,\n whoisTool,\n whoareTool,\n getImagesTool,\n getImagesFromArticleTool,\n getImageUsageTool,\n getImageInfoTool,\n getLogTool,\n expandTemplatesTool,\n parseTool,\n getRecentChangesTool,\n getSiteInfoTool,\n getSiteStatsTool,\n getMediaWikiVersionTool,\n getQueryPageTool,\n getExternalLinksTool,\n getBacklinksTool,\n];\n\nconst writeToolRegistrars = [\n editTool,\n appendTool,\n prependTool,\n moveTool,\n deleteTool,\n protectTool,\n purgeTool,\n sendEmailTool,\n uploadTool,\n uploadByUrlTool,\n addFlowTopicTool,\n createAccountTool,\n];\n\nexport function registerAllTools(server: McpServer, includeWriteTools = true): RegisteredTool[] {\n const registrars = includeWriteTools\n ? [...readToolRegistrars, ...writeToolRegistrars]\n : readToolRegistrars;\n\n const registeredTools: RegisteredTool[] = [];\n for (const registrar of registrars) {\n try {\n registeredTools.push(registrar(server));\n } catch (error) {\n console.error(`Error registering tool: ${(error as Error).message}`);\n }\n }\n return registeredTools;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,OAAS,wBAAAA,OAA4B,4CACrC,OAAS,aAAAC,OAAiB,OCD1B,OAAS,aAAAC,OAAiB,0CAEnB,IAAMC,EAAa,wBAQnB,SAASC,EAAaC,EAA4BC,EAAgB,GAAkB,CACvF,IAAIC,EACEC,EAAaF,EACb,mCACA,oEACN,OAAID,EACAE,EAAc,gBAAgBF,EAAS,QAAQ,KAAKA,EAAS,IAAI,cAAcA,EAAS,SAAS,IAAIG,CAAU,0FAE/GD,EAAc,2LAA2LC,CAAU,GAGhN,IAAIN,GACP,CACI,KAAM,oBACN,QAAS,QACT,YAAAK,CACJ,EACA,CAAE,aAAc,CAAE,MAAO,CAAC,CAAE,CAAE,CAClC,CACJ,CC7BA,OAAS,KAAAE,MAAS,MCAlB,OAAOC,OAAS,SAmBhB,IAAIC,EAA0B,KAC1BC,GAAoC,KACpCC,EAAgB,GAEb,SAASC,GAAiBC,EAA4B,CACzDH,GAAeG,CACnB,CAEA,SAASC,GAAoBD,EAA2B,CACpD,GAAM,CACF,OAAAE,EACA,KAAAC,EACA,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,UAAAC,EACA,YAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,CACJ,EAAIb,EAEJ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AAgB,EACvBlB,EAASmB,EAAaL,EAAUG,CAAI,EAC1CG,GAAiBpB,EAAQiB,CAAI,EAG7B,IAAMI,EAAY,IAAIC,GACtB,MAAMtB,EAAO,QAAQqB,CAAS,EAG9B,IAAME,EAAW,GADAhB,EAAO,UAAY,OACR,MAAMA,EAAO,MAAM,GAAGA,EAAO,IAAI,WACvDiB,EAAWV,GAAU,UAAYP,EAAO,OAC9C,QAAQ,MAAM,wBAAwBiB,CAAQ,MAAMD,CAAQ,GAAG,CACnE,CAEAjB,GAAK,EAAE,MAAM,QAAQ,KAAK",
|
|
6
|
-
"names": ["StdioServerTransport", "parseArgs", "McpServer", "USER_AGENT", "createServer", "siteInfo", "authenticated", "description", "authSuffix", "z", "Bot", "botInstance", "serverConfig", "authenticated", "initServerConfig", "config", "createBotFromConfig", "server", "path", "protocol", "port", "proxy", "userAgent", "concurrency", "debug", "username", "password", "domain", "dryRun", "Bot", "USER_AGENT", "testApiConnection", "bot", "promisifyBotMethod", "autoDetectPath", "baseConfig", "pathsToTry", "testConfig", "initBot", "resolve", "reject", "err", "getBot", "isAuthenticated", "authenticated", "promisifyBotMethod", "bot", "method", "args", "resolve", "reject", "callback", "err", "result", "getArticleTool", "server", "z", "title", "followRedirect", "redirectInfo", "handleGetArticleTool", "bot", "getBot", "result", "resolve", "reject", "callback", "err", "content", "redirect", "promisifyBotMethod", "error", "z", "jsonResult", "data", "errorResult", "message", "error", "searchTool", "server", "tool", "z", "keyword", "limit", "handleSearchTool", "bot", "getBot", "results", "promisifyBotMethod", "limitedResults", "jsonResult", "error", "errorResult", "z", "getPagesInCategoryTool", "server", "tool", "z", "category", "handleGetPagesInCategoryTool", "bot", "getBot", "cleanCategory", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getCategoriesTool", "server", "tool", "z", "prefix", "handleGetCategoriesTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getUsersTool", "server", "tool", "z", "prefix", "onlyWithEdits", "handleGetUsersTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getAllPagesTool", "server", "tool", "z", "limit", "handleGetAllPagesTool", "bot", "getBot", "allResults", "promisifyBotMethod", "results", "jsonResult", "error", "errorResult", "z", "getPagesInNamespaceTool", "server", "tool", "z", "namespace", "handleGetPagesInNamespaceTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getPagesByPrefixTool", "server", "tool", "z", "prefix", "handleGetPagesByPrefixTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getPagesTranscludingTool", "server", "tool", "z", "template", "handleGetPagesTranscludingTool", "bot", "getBot", "rawResults", "promisifyBotMethod", "results", "page", "jsonResult", "error", "errorResult", "z", "getArticleRevisionsTool", "server", "tool", "z", "title", "handleGetArticleRevisionsTool", "bot", "getBot", "revisions", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getArticleCategoriesTool", "server", "tool", "z", "title", "handleGetArticleCategoriesTool", "bot", "getBot", "categories", "promisifyBotMethod", "jsonResult", "error", "errorResult", "getArticlePropertiesTool", "server", "tool", "title", "handleGetArticlePropertiesTool", "bot", "getBot", "properties", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getArticleInfoTool", "server", "tool", "z", "title", "properties", "handleGetArticleInfoTool", "bot", "getBot", "info", "promisifyBotMethod", "results", "jsonResult", "error", "errorResult", "z", "getUserContribsTool", "server", "tool", "z", "username", "namespace", "limit", "handleGetUserContribsTool", "bot", "getBot", "options", "callbackArgs", "promisifyBotMethod", "contribs", "limitedContribs", "jsonResult", "error", "errorResult", "whoamiTool", "server", "tool", "handleWhoamiTool", "bot", "getBot", "userInfo", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "whoisTool", "server", "tool", "z", "username", "handleWhoisTool", "bot", "getBot", "userInfo", "promisifyBotMethod", "errorResult", "jsonResult", "error", "z", "whoareTool", "server", "tool", "z", "params", "handleWhoareTool", "bot", "getBot", "users", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getImagesTool", "server", "tool", "z", "startFrom", "limit", "handleGetImagesTool", "bot", "getBot", "images", "resolve", "reject", "err", "args", "imgs", "limitedImages", "jsonResult", "error", "errorResult", "z", "getImagesFromArticleTool", "server", "tool", "z", "title", "handleGetImagesFromArticleTool", "bot", "getBot", "images", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getImageUsageTool", "server", "tool", "z", "filename", "handleGetImageUsageTool", "bot", "getBot", "pages", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getImageInfoTool", "server", "tool", "z", "filename", "handleGetImageInfoTool", "bot", "getBot", "info", "promisifyBotMethod", "jsonResult", "errorResult", "error", "z", "getLogTool", "server", "tool", "z", "type", "start", "limit", "handleGetLogTool", "bot", "getBot", "entries", "resolve", "reject", "err", "args", "ents", "limitedEntries", "jsonResult", "error", "errorResult", "z", "expandTemplatesTool", "server", "z", "text", "title", "handleExpandTemplatesTool", "bot", "getBot", "expandedXml", "promisifyBotMethod", "error", "z", "parseTool", "server", "z", "text", "title", "handleParseTool", "bot", "getBot", "callbackArgs", "promisifyBotMethod", "xml", "images", "error", "z", "getRecentChangesTool", "server", "tool", "z", "start", "limit", "handleGetRecentChangesTool", "bot", "getBot", "changes", "resolve", "reject", "err", "args", "chgs", "limitedChanges", "jsonResult", "error", "errorResult", "z", "getSiteInfoTool", "server", "tool", "z", "properties", "handleGetSiteInfoTool", "bot", "getBot", "info", "promisifyBotMethod", "jsonResult", "error", "errorResult", "getSiteStatsTool", "server", "tool", "handleGetSiteStatsTool", "bot", "getBot", "stats", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getMediaWikiVersionTool", "server", "tool", "handleGetMediaWikiVersionTool", "z", "bot", "getBot", "version", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getQueryPageTool", "server", "tool", "z", "name", "handleGetQueryPageTool", "bot", "getBot", "results", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "getExternalLinksTool", "server", "tool", "z", "title", "handleGetExternalLinksTool", "bot", "getBot", "links", "promisifyBotMethod", "jsonResult", "link", "error", "errorResult", "z", "getBacklinksTool", "server", "tool", "z", "title", "handleGetBacklinksTool", "bot", "getBot", "backlinks", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "editTool", "server", "tool", "z", "params", "handleEditTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "appendTool", "server", "tool", "z", "params", "handleAppendTool", "bot", "getBot", "prefixedSummary", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "prependTool", "server", "tool", "z", "params", "handlePrependTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "moveTool", "server", "tool", "z", "params", "handleMoveTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "deleteTool", "server", "tool", "z", "params", "handleDeleteTool", "bot", "getBot", "prefixedReason", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "protectTool", "server", "tool", "z", "params", "handleProtectTool", "bot", "getBot", "options", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "purgeTool", "server", "tool", "z", "params", "handlePurgeTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "sendEmailTool", "server", "tool", "z", "params", "handleSendEmailTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "uploadTool", "server", "tool", "z", "params", "handleUploadTool", "bot", "getBot", "fileContent", "comment", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "uploadByUrlTool", "server", "tool", "z", "params", "handleUploadByUrlTool", "bot", "getBot", "prefixedSummary", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "addFlowTopicTool", "server", "tool", "z", "params", "handleAddFlowTopicTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "z", "createAccountTool", "server", "tool", "z", "params", "handleCreateAccountTool", "bot", "getBot", "result", "promisifyBotMethod", "jsonResult", "error", "errorResult", "readToolRegistrars", "getArticleTool", "searchTool", "getPagesInCategoryTool", "getCategoriesTool", "getUsersTool", "getAllPagesTool", "getPagesInNamespaceTool", "getPagesByPrefixTool", "getPagesTranscludingTool", "getArticleRevisionsTool", "getArticleCategoriesTool", "getArticlePropertiesTool", "getArticleInfoTool", "getUserContribsTool", "whoamiTool", "whoisTool", "whoareTool", "getImagesTool", "getImagesFromArticleTool", "getImageUsageTool", "getImageInfoTool", "getLogTool", "expandTemplatesTool", "parseTool", "getRecentChangesTool", "getSiteInfoTool", "getSiteStatsTool", "getMediaWikiVersionTool", "getQueryPageTool", "getExternalLinksTool", "getBacklinksTool", "writeToolRegistrars", "editTool", "appendTool", "prependTool", "moveTool", "deleteTool", "protectTool", "purgeTool", "sendEmailTool", "uploadTool", "uploadByUrlTool", "addFlowTopicTool", "createAccountTool", "registerAllTools", "server", "includeWriteTools", "registrars", "registeredTools", "registrar", "error", "parseCliArgs", "values", "positionals", "parseArgs", "serverUrl", "server", "protocol", "port", "url", "pathFromEnv", "pathExplicit", "main", "config", "autoDetectPath", "err", "initServerConfig", "initBot", "bot", "getBot", "siteInfo", "general", "promisifyBotMethod", "auth", "isAuthenticated", "createServer", "registerAllTools", "transport", "StdioServerTransport", "endpoint", "sitename"]
|
|
7
|
-
}
|