Skip to main content
Glama
jakedx6
by jakedx6

get_smart_context

Aggregates relevant context from projects, tasks, and documents using natural language queries to provide focused information for project management needs.

Instructions

Get intelligent context aggregation based on natural language query across projects, tasks, and documents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language query describing what context you need (e.g., "authentication tasks", "API documentation", "blocked items")
project_idNoOptional project ID to scope the search
context_typesNoTypes of content to include in context
max_results_per_typeNoMaximum results to return per content type
include_relatedNoWhether to include related/linked content

Implementation Reference

  • Primary execution handler for the get_smart_context tool. Parses arguments, analyzes natural language query, fetches relevant projects/tasks/documents/conversations based on context types, optionally includes related content, generates insights and summary, and returns aggregated context.
    export const getSmartContext = requireAuth(async (args: any) => { const { query, project_id, context_types, max_results_per_type, include_related } = GetSmartContextSchema.parse(args) logger.info('Getting smart context', { query, project_id, context_types }) // Analyze query to understand intent and extract keywords const queryAnalysis = analyzeContextQuery(query) const context: any = { query_analysis: queryAnalysis, results: {}, related_content: {}, insights: {} } // Get relevant content for each requested type for (const type of context_types) { try { switch (type) { case 'projects': context.results.projects = await getRelevantProjects(queryAnalysis, project_id, max_results_per_type) break case 'tasks': context.results.tasks = await getRelevantTasks(queryAnalysis, project_id, max_results_per_type) break case 'documents': context.results.documents = await getRelevantDocuments(queryAnalysis, project_id, max_results_per_type) break case 'conversations': context.results.conversations = await getRelevantConversations(queryAnalysis, project_id, max_results_per_type) break } } catch (error) { logger.error(`Error getting ${type} context:`, error) context.results[type] = [] } } // Get related content if requested if (include_related) { context.related_content = await findRelatedContentInternal(context.results, queryAnalysis) } // Generate insights and recommendations context.insights = generateContextInsights(context.results, queryAnalysis) context.summary = generateSmartContextSummary(context, query) logger.info('Smart context generated', { query, total_results: Object.values(context.results).flat().length }) return context })
  • Zod validation schema used internally by the handler to parse and validate input arguments for get_smart_context.
    const GetSmartContextSchema = z.object({ query: z.string().min(1), project_id: z.string().uuid().optional(), context_types: z.array(z.enum(['projects', 'tasks', 'documents', 'conversations'])).default(['projects', 'tasks', 'documents']), max_results_per_type: z.number().int().positive().max(20).default(5), include_related: z.boolean().default(true) })
  • MCPTool definition registering the get_smart_context tool with name, description, and JSON input schema matching the Zod schema.
    export const getSmartContextTool: MCPTool = { name: 'get_smart_context', description: 'Get intelligent context aggregation based on natural language query across projects, tasks, and documents', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Natural language query describing what context you need (e.g., "authentication tasks", "API documentation", "blocked items")' }, project_id: { type: 'string', format: 'uuid', description: 'Optional project ID to scope the search' }, context_types: { type: 'array', items: { type: 'string', enum: ['projects', 'tasks', 'documents', 'conversations'] }, default: ['projects', 'tasks', 'documents'], description: 'Types of content to include in context' }, max_results_per_type: { type: 'number', minimum: 1, maximum: 20, default: 5, description: 'Maximum results to return per content type' }, include_related: { type: 'boolean', default: true, description: 'Whether to include related/linked content' } }, required: ['query'] } }
  • Handler mapping object that registers get_smart_context to its handler function getSmartContext.
    export const contextAggregationHandlers = { get_smart_context: getSmartContext, get_workspace_overview: getWorkspaceOverview, get_project_insights: getProjectInsights, find_related_content: findRelatedContent, generate_context_summary: generateContextSummary }
  • Core helper function that analyzes the natural language query to extract keywords, intent, entities, urgency, and generates search terms used throughout the handler.
    function analyzeContextQuery(query: string): any { const keywords = extractKeywords(query) const intent = detectIntent(query) const entities = extractEntities(query) const urgency = detectUrgency(query) return { original_query: query, keywords, intent, entities, urgency, search_terms: generateSearchTerms(keywords, entities) } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jakedx6/helios9-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server