resolve_gap
Log undocumented decisions as knowledge gaps when no documented guidance exists, then returns how to proceed based on the team's configured gap policy: ask user, infer, or agent decide.
Instructions
Call this when query_knowledge_base returned no documented guidance for a decision you need to make. Logs the undocumented decision as a knowledge gap so the developer can review and document it. Returns how you should proceed based on the team's configured gap policy: "ask_user" = stop and ask the developer for a decision before continuing; "infer" = MarkdownLM has auto-resolved the gap, use the returned resolution value; "agent_decide" = proceed with your best judgement and document your reasoning. Do NOT call this if query_knowledge_base returned matching rules — it is only for genuinely undocumented decisions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| question | Yes | The specific undocumented decision you need to make, phrased as a question. Be precise so the developer understands exactly what is missing from the knowledge base. Example: "Which HTTP client library should I use for server-side requests — axios, got, or native fetch?" | |
| category | Yes | Category that best describes the gap. Helps the developer triage and document the missing rule. |
Implementation Reference
- src/index.ts:132-171 (registration)Tool definition and input schema for 'resolve_gap' registered in the ListToolsRequestSchema handler. Name, description, and inputSchema with 'question' (string) and 'category' (enum) required fields.
{ name: 'resolve_gap', description: "Call this when query_knowledge_base returned no documented guidance for a decision you need to make. " + "Logs the undocumented decision as a knowledge gap so the developer can review and document it. " + "Returns how you should proceed based on the team's configured gap policy: " + '"ask_user" = stop and ask the developer for a decision before continuing; ' + '"infer" = MarkdownLM has auto-resolved the gap, use the returned resolution value; ' + '"agent_decide" = proceed with your best judgement and document your reasoning. ' + 'Do NOT call this if query_knowledge_base returned matching rules — it is only for genuinely undocumented decisions.', inputSchema: { type: 'object' as const, properties: { question: { type: 'string', description: 'The specific undocumented decision you need to make, phrased as a question. ' + 'Be precise so the developer understands exactly what is missing from the knowledge base. ' + 'Example: "Which HTTP client library should I use for server-side requests — axios, got, or native fetch?"', }, category: { type: 'string', enum: [ 'architecture', 'stack', 'testing', 'deployment', 'security', 'style', 'dependencies', 'error_handling', 'business_logic', 'general', ], description: 'Category that best describes the gap. Helps the developer triage and document the missing rule.', }, }, required: ['question', 'category'], }, }, - src/index.ts:219-227 (handler)The tool execution handler for 'resolve_gap'. Extracts 'question' and 'category' from arguments, validates them as required strings, calls client.resolveGap(), logs the outcome, and returns the result.
case 'resolve_gap': { const question = requireString(safeArgs, 'question') if (!question) { log(toolName, safeArgs, 'error', 'missing question'); return err('question is required') } const category = requireString(safeArgs, 'category') if (!category) { log(toolName, safeArgs, 'error', 'missing category'); return err('category is required') } const result = await client.resolveGap({ question, category }) log(toolName, { question, category }, 'ok') return ok(result) } - src/lib/api-client.ts:22-25 (schema)ResolveGapInput type definition: requires 'question' (string) and 'category' (string).
export interface ResolveGapInput { question: string category: string } - src/lib/api-client.ts:27-32 (schema)ResolveGapResult type definition: includes 'gap_detected' (boolean), 'resolution_mode' (union of 'markdownlm' | 'ask_user' | 'agent_decide' | 'none'), optional 'resolution' (string), and optional 'gap_id' (string).
export interface ResolveGapResult { gap_detected: boolean resolution_mode: 'markdownlm' | 'ask_user' | 'agent_decide' | 'none' resolution?: string gap_id?: string } - src/lib/api-client.ts:126-131 (helper)The client-side resolveGap method. Accepts ResolveGapInput, makes a POST request to '/gaps/detect' with 'query' (the question) and 'category', and returns a Promise<ResolveGapResult>.
async resolveGap(input: ResolveGapInput): Promise<ResolveGapResult> { return this.request<ResolveGapResult>('/gaps/detect', { query: input.question, ...(input.category ? { category: input.category } : {}), }) }