Skip to main content
Glama
WaterSippin

OSRS MCP Server

Official
by WaterSippin

search_spritetypes

Search sprite image definitions in the spritetypes.txt file for OSRS interface design. Input a query, page number, and page size to retrieve specific sprite data efficiently.

Instructions

Search the spritetypes.txt file for sprite image definitions used in the interface.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination
pageSizeNoNumber of results per page
queryYesThe term to search for in the file

Implementation Reference

  • Handler code executed when 'search_spritetypes' is called. Parses input arguments, determines the spritetypes.txt file path, checks if file exists, searches the file using the shared searchFile helper, and returns paginated results.
    const fileSearchArgs = getSchemaForTool(name).parse(args) as { query: string; page?: number; pageSize?: number };
    const { query, page: filePage = 1, pageSize: filePageSize = 10 } = fileSearchArgs;
    const filename = `${name.replace('search_', '')}.txt`;
    const filePath = path.join(getDataDir(), filename);
    
    if (!fileExists(filename)) {
        return responseToString({ error: `${filename} not found in data directory` });
    }
    
    const fileResults = await searchFile(filePath, query, filePage, filePageSize);
    return responseToString(fileResults);
  • Zod schema definition used for input validation of search_spritetypes tool (shared with other search_* tools). Defines query, pagination parameters.
    const FileSearchSchema = z.object({
        query: z.string().describe("The term to search for in the file"),
        page: z.number().int().min(1).optional().default(1).describe("Page number for pagination"),
        pageSize: z.number().int().min(1).max(100).optional().default(10).describe("Number of results per page")
    });
  • Logic in getSchemaForTool function that selects FileSearchSchema for any tool name starting with 'search_', including search_spritetypes.
            if (toolName.startsWith("search_")) {
                return FileSearchSchema;
            }
            throw new Error(`Unknown tool: ${toolName}`);
    }
  • index.ts:358-360 (registration)
    Tool registration/declaration in getToolDefinitions() array, providing name and description returned by listTools.
        name: "search_spritetypes",
        description: "Search the spritetypes.txt file for sprite image definitions used in the interface.",
    },
  • Core helper function that performs the actual file search: reads lines, matches query (case-insensitive, spaces to underscores), paginates results, formats as ID-value pairs, returns structured results with pagination info. Called by all search_* handlers including search_spritetypes.
    async function searchFile(filePath: string, searchTerm: string, page: number = 1, pageSize: number = 10): Promise<any> {
        //replace spaces with underscores
        searchTerm = searchTerm.replace(" ", "_");
        return new Promise((resolve, reject) => {
            if (!fs.existsSync(filePath)) {
                reject(new Error(`File not found: ${filePath}`));
                return;
            }
    
            const results: {line: string, lineNumber: number}[] = [];
            const fileStream = fs.createReadStream(filePath);
            const rl = readline.createInterface({
                input: fileStream,
                crlfDelay: Infinity
            });
    
            let lineNumber = 0;
            
            rl.on('line', (line) => {
                lineNumber++;
                if (line.toLowerCase().includes(searchTerm.toLowerCase())) {
                    results.push({ line, lineNumber });
                }
            });
    
            rl.on('close', () => {
                const totalResults = results.length;
                const totalPages = Math.ceil(totalResults / pageSize);
                const startIndex = (page - 1) * pageSize;
                const endIndex = startIndex + pageSize;
                const paginatedResults = results.slice(startIndex, endIndex);
    
                // Process the results to extract key-value pairs if possible
                const formattedResults = paginatedResults.map(result => {
                    // Try to format as key-value pair (common for ID data files)
                    const parts = result.line.split(/\s+/);
                    if (parts.length >= 2) {
                        const id = parts[0];
                        const value = parts.slice(1).join(' ');
                        return {
                            ...result,
                            id,
                            value,
                            formatted: `${id}\t${value}`
                        };
                    }
                    return result;
                });
    
                resolve({
                    results: formattedResults,
                    pagination: {
                        page,
                        pageSize,
                        totalResults,
                        totalPages,
                        hasNextPage: page < totalPages,
                        hasPreviousPage: page > 1
                    }
                });
            });
    
            rl.on('error', (err) => {
                reject(err);
            });
        });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions searching a file but does not cover critical aspects such as whether this is a read-only operation, potential rate limits, authentication needs, error handling, or the format of results. For a search tool with no annotation coverage, this leaves significant gaps in understanding its 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 directly states the tool's purpose without any unnecessary words. It is front-loaded with the core action and resource, making it easy to parse and understand quickly.

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

Completeness2/5

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

Given the complexity of a search operation with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, result format, error conditions, and differentiation from siblings, making it incomplete for effective agent use despite the clear schema coverage.

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?

The input schema has 100% description coverage, clearly documenting all three parameters (query, page, pageSize) with details like defaults and constraints. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 without compensating for any gaps.

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

Purpose4/5

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

The description clearly states the action ('Search') and the target resource ('spritetypes.txt file for sprite image definitions used in the interface'), making the purpose evident. However, it does not explicitly differentiate this tool from its many sibling search tools (e.g., search_iftypes, search_invtypes), which all seem to search different file types, leaving some ambiguity about when to choose this specific one over others.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like search_data_file, search_iftypes, etc., it fails to specify contexts, prerequisites, or exclusions, leaving the agent to infer usage based on the file name alone without explicit direction.

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

Related 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/WaterSippin/mcp-osrs'

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