Skip to main content
Glama
ProfessionalWiki

mediawiki-mcp-server

search-page

Read-only

Search MediaWiki page titles and contents using specific terms to find relevant pages. This tool helps locate information by querying wiki databases and returning matching results.

Instructions

Search wiki page titles and contents for the provided search terms, and returns matching pages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch terms
limitNoMaximum number of search results to return

Implementation Reference

  • Registers the "search-page" tool on the MCP server, including name, description, input schema with query and optional limit, annotations, and delegates to handler.
    export function searchPageTool( server: McpServer ): RegisteredTool {
    	// TODO: Not having named parameters is a pain,
    	// but using low-level Server type or using a wrapper function are addedd complexity
    	return server.tool(
    		'search-page',
    		'Search wiki page titles and contents for the provided search terms, and returns matching pages.',
    		{
    			query: z.string().describe( 'Search terms' ),
    			limit: z.number().int().min( 1 ).max( 100 ).optional().describe( 'Maximum number of search results to return' )
    		},
    		{
    			title: 'Search page',
    			readOnlyHint: true,
    			destructiveHint: false
    		} as ToolAnnotations,
    		async ( { query, limit } ) => handleSearchPageTool( query, limit )
    	);
    }
  • Executes the tool: sends REST GET to /v1/search/page with query and optional limit, handles errors, formats and returns search results or error/no results messages.
    async function handleSearchPageTool( query: string, limit?: number ): Promise< CallToolResult > {
    	let data: MwRestApiSearchPageResponse;
    	try {
    		data = await makeRestGetRequest<MwRestApiSearchPageResponse>(
    			'/v1/search/page',
    			{ q: query, ...( limit ? { limit: limit.toString() } : {} ) }
    		);
    	} catch ( error ) {
    		return {
    			content: [
    				{ type: 'text', text: `Failed to retrieve search data: ${ ( error as Error ).message }` } as TextContent
    			],
    			isError: true
    		};
    	}
    
    	const pages = data.pages || [];
    	if ( pages.length === 0 ) {
    		return {
    			content: [
    				{ type: 'text', text: `No pages found for ${ query }` } as TextContent
    			]
    		};
    	}
    
    	return {
    		content: pages.map( getSearchResultToolResult )
    	};
    }
  • Helper function to format a single search result into a TextContent block with title, description, ID, URL, and thumbnail.
    function getSearchResultToolResult( result: MwRestApiSearchResultObject ): TextContent {
    	const { server, articlepath } = wikiService.getCurrent().config;
    	return {
    		type: 'text',
    		text: [
    			`Title: ${ result.title }`,
    			`Description: ${ result.description ?? 'Not available' }`,
    			`Page ID: ${ result.id }`,
    			`Page URL: ${ `${ server }${ articlepath }/${ result.key }` }`,
    			`Thumbnail URL: ${ result.thumbnail?.url ?? 'Not available' }`
    		].join( '\n' )
    	};
    }
  • Includes searchPageTool in the array of tool registrars, which are invoked by registerAllTools to register all tools on the server.
    const toolRegistrars = [
    	getPageTool,
    	getPageHistoryTool,
    	searchPageTool,
    	setWikiTool,
    	addWikiTool,
    	removeWikiTool,
    	updatePageTool,
    	getFileTool,
    	createPageTool,
    	uploadFileTool,
    	uploadFileFromUrlTool,
    	deletePageTool,
    	getRevisionTool,
    	undeletePageTool,
    	getCategoryMembersTool,
    	searchPageByPrefixTool
    ];
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, so the agent knows this is a safe read operation. The description adds that it searches both titles and contents, which provides useful behavioral context beyond the annotations. However, it doesn't disclose other traits like search algorithm, ranking, or pagination behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Search wiki page titles and contents') and follows with the action and result. Every word earns its place with zero redundancy or wasted phrasing.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search operation with 2 parameters), rich annotations (readOnlyHint, destructiveHint), and 100% schema coverage, the description is mostly complete. It clearly states what the tool does. The main gap is lack of output details (no output schema), but for a search tool, the description adequately conveys the expected result ('returns matching pages').

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('query' and 'limit') fully documented in the schema. The description mentions 'search terms' which aligns with the 'query' parameter but adds no additional semantic meaning beyond what the schema provides. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Search wiki page titles and contents'), identifies the resource ('matching pages'), and distinguishes from siblings like 'search-page-by-prefix' (which searches by prefix) and 'get-page' (which retrieves a specific page). It uses precise language that goes beyond the tool name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for searching wiki pages with terms, but provides no explicit guidance on when to use this tool versus alternatives like 'search-page-by-prefix' or 'get-page'. It doesn't mention prerequisites, exclusions, or comparative contexts with other search/fetch tools in the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ProfessionalWiki/MediaWiki-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server