query

Answers a question based on the data available in the WDS MCP Server.

How to call

In supported clients the command syntax can vary. If the WDS MCP server is registered as wds, use:

Client Command
Visual Studio Code /mcp.wds.query

Arguments

Name Type Required Default Description
url string No http://playground Web resource URL to query.
role string No You are an AI assistant that helps people find information. The Role section for the prompt.
userTask string No Analyse the playground (http://playground) and find items that grant the wearer control over the creatures of the forest. The Mission section for the prompt.
outputFormat string? No markdown Output format.

Returned Prompt Text

The block below contains the complete prompt returned to the MCP client. Runtime placeholders map to arguments as follows:

ROLE:
You are an expert in vector search systems. You understand how vector indexes store embeddings, how similarity thresholds influence recall, and how to formulate retrieval queries.

OBJECTIVE:
Retrieve the most relevant context from the vector index and use it to answer the user Task.

RESTRICTIONS:
    -   The agent must use the exact values returned by MCP tools as inputs for later steps. Do not rewrite or guess job names, URLs, run numbers, cursors, or selectors.
    -   MCP structured tool results are serialized as lower-camel JSON fields. Use returned field names such as runNum, completeDateUtc, failedDownloadTasks, data, and dataCursor when reading tool results.
    -   The agent must perform all steps of the PROCEDURE in order, without skipping or parallel execution.
    -   Call MCP tools with named arguments matching the tool parameter names.
    -   WdsFetchChunked returns the download task ID as a string. It does not return raw page text.
    -   Use WdsGetChunk(taskId=taskId, startIndex=startIndex, length=length) to read task content in chunks. Do not use shell/file tools to recover hidden or truncated content from MCP output.
    -   Resolve relative links against the current page URL before passing them to WdsFetchChunked.
    -   To change a JobConfig, read the current object with WdsGetJobConfig when it exists, create or modify the complete object in memory, then persist it with WdsUpsertJobConfig(jobName=jobName, jobConfig=jobCfg). Preserve all unrelated existing properties.
    -   When setting nested JobConfig properties, create missing nested objects or arrays before setting their fields.
    -   To change a TraversalConfig, create or modify the complete object in memory, then persist it with WdsUpsertTraversalConfig(jobName=jobName, traversalConfig=traversalConfig).
    -   WdsRunTraversal and WdsTraversalAll return TraversalRunResult, not crawl data. Use runNum with WdsGetTraversalRunInfo, WdsGetTraversalRunErrors, and WdsGetTraversalRunData.
    -   On any MCP tool error, the agent must STOP WITH REASON and surface the error response.

GLOBAL CONSTANTS:
    TARGET_URL = '<url>'

PROCEDURE (EXECUTE IN EXACT ORDER)
    1.  Identify host
    -	Extract authority/host from TARGET_URL -> lowercase, normalized -> tgtHost
    2.  Select an existing indexed job
        -   jobs = WdsGetJobs()
        -   Find job where job.jobName equals tgtHost (case-insensitive)
        -   If no job is found:
            -   STOP WITH REASON: TARGET_URL has no job yet; run the index prompt first.
        -   jobName = job.jobName
        -   jobCfg = WdsGetJobConfig(jobName=jobName)
        -   If job.enrollmentState is not 'Completed':
            -   STOP WITH REASON and report the enrollment state.
    3.	Build retrieval query
        -   Extract all meaningful keywords from the Task Mission text.
        -   Join them into a whitespace-separated string:
            -   query = 'keyword1 keyword2 …'
    4.	Run first retrieval
        -   threshold = 'exact-match' (0.85)
        -   limit = 100
        -   response = WdsRetrieve(query=query, jobName=jobName, threshold=threshold, limit=limit)
    5.	Evaluate retrieval result
        -   If response is empty:
            -   threshold = 'same-category' (0.75)
            -   response = WdsRetrieve(query=query, jobName=jobName, threshold=threshold, limit=limit)
            -   If response is empty:
                -   threshold = 'same-domain' (0.65)
                -   response = WdsRetrieve(query=query, jobName=jobName, threshold=threshold, limit=limit)
                -   If response is empty:
                    -   Extract all meaningful keywords from the Task Mission text.
                    -   Add their synonyms.
                    -   Join them into a whitespace-separated string:
                    -   query = 'keyword1 synonym1 keyword2 synonym2 …'
                    -   response = WdsRetrieve(query=query, jobName=jobName, threshold=threshold, limit=limit)
        -   If response is still empty:
            -   STOP WITH REASON: no indexed context matched the task.
    6.  Ensure that there is no more items to retrieve
        -   WHILE response item count equals limit AND limit is less than 1000:
            -   limit = limit * 2
            -   response = WdsRetrieve(query=query, jobName=jobName, threshold=threshold, limit=limit)
        -   If response item count equals limit after limit reaches 1000:
            -   Continue with the retrieved items and state that the answer may be based on a capped result set.
    7.	Perform deep fetch if needed
        -   If response items do not contain required information:
            -   FOREACH item IN response:
                -   FOREACH task IN item.downloadTasks:
                    -   url = task.url

            -   taskId = WdsFetchChunked(jobName=jobName, url=url)
            -   REPEAT:
                -   contentResult = WdsGetChunk(taskId=taskId, startIndex=0, length=1024)
                -   If contentResult is not null: BREAK
                -   Continue polling WdsGetChunk with the same arguments until contentResult is not null.
            -   html = contentResult.contentSpan if it is not null; otherwise ''
            -   contentLength = contentResult.contentLength if it is not null; otherwise length(html)
            -   If more unseen content is required for the current analysis:
                -   REPEAT:
                    -   startIndex = length(html)
                    -   If startIndex >= contentLength: BREAK
                    -   contentResult = WdsGetChunk(taskId=taskId, startIndex=startIndex, length=1024)
                    -   If contentResult is null: continue polling WdsGetChunk with the same arguments until contentResult is not null
                    -   Append contentResult.contentSpan to html
                -   UNTIL enough relevant content has been inspected or startIndex >= contentLength
            -   Analyze only the content present in html. If required evidence is in an unread span, read the next span before making conclusions.
                    -   Enhance item with html content for deeper analysis.
    8.	Analyze and answer
        -   Analyze all retrieved and fetched data.
        -   Extract relevant information to answer the Task concisely and accurately in the requested output format.

Task:
Role: <role>
Mission: <userTask>
Output format: <outputFormat>.

Please rotate your device to landscape mode

This documentation is specifically designed with a wider layout to provide a better reading experience for code examples, tables, and diagrams.
Rotating your device horizontally ensures you can see everything clearly without excessive scrolling or resizing.

Return to Web Data Source Home