search_edss_documentation
Search EDSS documentation for specific terms, endpoints, or API operations by submitting natural language queries.
Instructions
Search for specific terms or endpoints in EDSS documentation
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "search_edss_documentation"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search term (e.g., 'patient', 'assessment', 'POST', '/api/patients') | |
| version | No | Which version to search | latest |
Implementation Reference
- index.js:81-99 (registration)Tool registration with name, description, and input schema in the ListToolsRequestSchema handler. Declares query (required) and version (optional, default 'latest') parameters.
name: "search_edss_documentation", description: "Search for specific terms or endpoints in EDSS documentation", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search term (e.g., 'patient', 'assessment', 'POST', '/api/patients')" }, version: { type: "string", enum: ["latest", "trunk", "both"], default: "latest", description: "Which version to search" } }, required: ["query"] } }, - index.js:81-99 (schema)Input schema defines the expected parameters for the search tool: query (required string) and version (optional string from enum ['latest', 'trunk', 'both'], default 'latest').
name: "search_edss_documentation", description: "Search for specific terms or endpoints in EDSS documentation", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search term (e.g., 'patient', 'assessment', 'POST', '/api/patients')" }, version: { type: "string", enum: ["latest", "trunk", "both"], default: "latest", description: "Which version to search" } }, required: ["query"] } }, - index.js:560-593 (handler)Main handler for search_edss_documentation. Fetches documentation HTML from legacy URLs, uses findMatches helper to search the content, and returns results as JSON.
async searchDocumentation(args) { const { query, version = "latest" } = args; try { const versions = version === "both" ? ["latest", "trunk"] : [version]; const results = []; for (const ver of versions) { const url = ver === "latest" ? this.legacyDocUrls.latest : this.legacyDocUrls.trunk; const response = await fetch(url); if (response.ok) { const content = await response.text(); const matches = this.findMatches(content, query, ver); results.push(...matches); } } return { content: [ { type: "text", text: JSON.stringify({ query: query, results: results, total: results.length }, null, 2) } ] }; } catch (error) { throw new Error(`Search failed: ${error.message}`); } } - index.js:189-190 (registration)Routing registration in the CallToolRequestSchema switch-case, mapping the tool name 'search_edss_documentation' to the searchDocumentation method.
case "search_edss_documentation": return await this.searchDocumentation(args); - index.js:667-684 (helper)Helper method used by searchDocumentation. Performs regex-based line-by-line search of the HTML content, returning matches with version, line number, content, and surrounding context.
findMatches(content, query, version) { const regex = new RegExp(query, 'gi'); const matches = []; const lines = content.split('\n'); lines.forEach((line, index) => { if (regex.test(line)) { matches.push({ version: version, line: index + 1, content: line.trim(), context: lines.slice(Math.max(0, index - 1), index + 2) }); } }); return matches; }