Skip to main content
Glama
jakedx6
by jakedx6

get_smart_context

Aggregate relevant project data across tasks, documents, and conversations using natural language queries to provide focused context for decision-making.

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

  • The main execution handler for the 'get_smart_context' tool. It validates input using Zod schema, analyzes the natural language query, fetches relevant projects, tasks, documents, and conversations, optionally includes related content, generates insights, and returns structured 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 })
  • The MCPTool registration object defining the name 'get_smart_context', description, and JSON input schema for the tool.
    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'] } }
  • Zod schema for input validation used inside the handler to parse and validate arguments.
    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) })
  • Handler registration map that associates the tool name 'get_smart_context' with its handler function, likely used for MCP tool dispatching.
    export const contextAggregationHandlers = { get_smart_context: getSmartContext, get_workspace_overview: getWorkspaceOverview, get_project_insights: getProjectInsights, find_related_content: findRelatedContent, generate_context_summary: generateContextSummary }
  • Tools export object including the getSmartContextTool, probably for bulk registration of context aggregation tools.
    export const contextAggregationTools = { getSmartContextTool, getWorkspaceOverviewTool, getProjectInsightsTool, findRelatedContentTool, generateContextSummaryTool }

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