get_tool_context
Retrieve tool-specific rules, syntax, and preferences for any tool. Automatically injects context across chat sessions, eliminating need to re-establish in each new conversation.
Instructions
Get complete context (rules, syntax, preferences) for a specific tool
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tool_name | Yes | Tool name or category (e.g. "git", "dokuwiki", "terraform") |
Implementation Reference
- src/engine/engine.ts:190-192 (helper)Engine.matchContexts() delegates to ContextMatcher.match() to find contexts matching the tool query.
matchContexts(query: ContextQuery): ContextMatch[] { return this.contextMatcher.match(this.contexts, query); } - src/engine/context-matcher.ts:22-56 (helper)ContextMatcher.match() performs the core context matching logic: filtering by categories, priority, and tool pattern matching (exact, wildcard, prefix).
match( contexts: Map<string, Context>, query: ContextQuery, ): ContextMatch[] { const minPriority = PRIORITY_ORDER[query.min_priority ?? 'low'] ?? 1; const matches: ContextMatch[] = []; for (const context of contexts.values()) { // Category filter if ( query.categories?.length && !query.categories.includes(context.tool_category) ) { continue; } // Priority filter const priority = context.metadata.priority ?? 'medium'; if ((PRIORITY_ORDER[priority] ?? 2) < minPriority) continue; // Tool pattern matching const matchedPattern = this.findMatchingTool( context.metadata.applies_to_tools, query.tool, ); if (!matchedPattern) continue; matches.push({ context, matched_pattern: matchedPattern, priority }); } return matches.sort( (a, b) => (PRIORITY_ORDER[b.priority] ?? 2) - (PRIORITY_ORDER[a.priority] ?? 2), ); } - src/types/context.ts:205-214 (schema)Type definition for ContextQuery used as input to matchContexts.
export interface ContextQuery { /** The tool being used, e.g. "bash:git", "memory", "docker". */ tool: string; /** Optional: only return contexts with these categories. */ categories?: string[]; /** Optional: only return contexts with this priority or higher. */ min_priority?: 'high' | 'medium' | 'low'; }