Skip to content

Commit e7107f8

Browse files
committed
docs(docql): simplify and clarify DocQLTool schema descriptions
Streamline parameter and usage descriptions for DocQLTool to improve clarity and conciseness.
1 parent 07a37f8 commit e7107f8

File tree

1 file changed

+7
-57
lines changed
  • mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl

1 file changed

+7
-57
lines changed

mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/tool/impl/DocQLTool.kt

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,7 @@ data class DocQLParams(
7373

7474
object DocQLSchema : DeclarativeToolSchema(
7575
description = """
76-
Executes a DocQL query against available documents (both in-memory and indexed).
77-
78-
## SMART SEARCH (Recommended)
79-
Simply provide a keyword or phrase, and the tool will automatically:
80-
1. Search for Classes and Functions matching the keyword (High Priority)
81-
2. Search for Headings and Content matching the keyword (Medium Priority)
82-
3. Rerank results to show the most relevant code and documentation first.
83-
4. If user's language search yields no results, try alternative encodings (pinyin, English, etc.)
84-
85-
**Example:** `{"query": "Auth"}` -> Finds `AuthService` class, `authenticate` function, and "Authentication" sections.
86-
87-
## ADVANCED: DIRECT DOCQL QUERIES
88-
For precise control, use standard DocQL syntax (starts with `$.`):
76+
Query documents using keywords or DocQL syntax.
8977
9078
### 1. Document Queries ($.content.*, $.toc[*])
9179
**For:** Markdown, text files, documentation (.md, .txt, README)
@@ -117,13 +105,6 @@ object DocQLSchema : DeclarativeToolSchema(
117105
- $.files[?(@.name~="Service")] - Filter files by name
118106
- $.structure - Get tree view of all file paths
119107
120-
## Parameters
121-
- **query** (required): The keyword (Smart Search) or DocQL query string (Advanced)
122-
- **documentPath** (optional): Target specific document by path
123-
- **maxResults** (optional): Limit results (default: 20)
124-
- **secondaryKeyword** (optional): Additional keyword for filtering when results are too many
125-
- **returnAll** (optional): When true, return all results without truncation (useful for $.code.class("*"))
126-
127108
## Multi-Level Keyword Strategy
128109
The tool automatically expands keywords when needed:
129110
- **Level 1**: Original query + phrase variations (e.g., "base64 encoding" -> "base64 encoder")
@@ -134,58 +115,27 @@ object DocQLSchema : DeclarativeToolSchema(
134115
""".trimIndent(),
135116
properties = mapOf(
136117
"query" to string(
137-
description = "The keyword to search for (Smart Search) or a specific DocQL query (e.g., '$.content.heading(\"Introduction\")').",
118+
description = "Keyword for smart search or DocQL query starting with '$.' (e.g., '$.content.heading(\"Introduction\")').",
138119
required = true
139120
),
140121
"documentPath" to string(
141-
description = """
142-
The path of the document to query (e.g., 'design-system-color.md').
143-
Use this to target specific documents when their names match your keywords.
144-
Check the available documents list and match keywords before querying.
145-
If omitted, searches all registered documents.
146-
""".trimIndent(),
122+
description = "Optional path to query a specific document (e.g., 'design-system-color.md'). Omit to search all documents.",
147123
required = false
148124
),
149125
"maxResults" to integer(
150-
description = """
151-
Maximum number of results to return. Default is 20.
152-
Use lower values for quick overview, higher values for comprehensive search.
153-
Note: Very high values may exceed context limits for large result sets.
154-
""".trimIndent(),
126+
description = "Max results to return (default: 20). Higher values may exceed context limits.",
155127
required = false
156128
),
157129
"secondaryKeyword" to string(
158-
description = """
159-
Optional secondary keyword for multi-level filtering.
160-
When the primary query returns too many results (>20), the secondary keyword
161-
is used to filter and prioritize the most relevant results.
162-
163-
Example: query="Auth", secondaryKeyword="Service"
164-
Finds AuthService, AuthenticationService with higher priority
165-
""".trimIndent(),
130+
description = "Optional secondary filter when primary query returns too many results. Example: query=\"Auth\", secondaryKeyword=\"Service\" prioritizes AuthService.",
166131
required = false
167132
),
168133
"rerankerType" to string(
169-
description = """
170-
Reranker algorithm to use for ordering results.
171-
172-
Options:
173-
- "heuristic" (default): Fast BM25 + type + name matching. Best for quick searches.
174-
- "rrf_composite": RRF fusion with composite scoring. Better for multi-source results.
175-
- "llm_metadata": LLM-based intelligent reranking using document metadata.
176-
Considers file paths, headings, modification time, references. Slower but smarter.
177-
- "hybrid": Heuristic pre-filter + LLM rerank. Balance of speed and quality.
178-
""".trimIndent(),
134+
description = "Reranking strategy: \"heuristic\" (fast, default), \"rrf_composite\" (multi-source), \"llm_metadata\" (smart, slower), \"hybrid\" (balanced).",
179135
required = false
180136
),
181137
"returnAll" to boolean(
182-
description = """
183-
When true, return all results without truncation.
184-
Useful for queries like $.code.class("*") or $.code.classes[*] where you want to see all items.
185-
186-
WARNING: May return very large results for big codebases. Use with caution.
187-
Default: false (results are truncated to maxResults)
188-
""".trimIndent(),
138+
description = "Return all results without truncation. WARNING: May be very large. Default: false.",
189139
required = false
190140
)
191141
)

0 commit comments

Comments
 (0)