Skip to main content
Glama

search_tasks

Find tasks in Autotask using search terms and filters like project, status, or assigned resource to manage work efficiently.

Instructions

Search for tasks in Autotask with optional filters. Returns optimized task data to prevent large responses.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchTermNoSearch term for task title
projectIDNoFilter by project ID
statusNoFilter by task status (1=New, 2=In Progress, 5=Complete)
assignedResourceIDNoFilter by assigned resource ID
pageSizeNoNumber of results to return (default: 25, max: 100)

Implementation Reference

  • Core handler function that executes the search_tasks tool logic: queries the Autotask tasks API with optimized fields, pagination limits, and data truncation for efficient responses.
    async searchTasks(options: AutotaskQueryOptions = {}): Promise<AutotaskTask[]> { const client = await this.ensureClient(); try { this.logger.debug('Searching tasks with options:', options); // Define essential task fields to minimize response size const essentialFields = [ 'id', 'title', 'description', 'status', 'projectID', 'assignedResourceID', 'creatorResourceID', 'createDateTime', 'startDateTime', 'endDateTime', 'estimatedHours', 'hoursToBeScheduled', 'remainingHours', 'percentComplete', 'priorityLabel', 'taskType', 'lastActivityDateTime', 'completedDateTime' ]; // Set default pagination and field limits const optimizedOptions = { ...options, includeFields: essentialFields, pageSize: options.pageSize || 25, ...(options.pageSize && options.pageSize > 100 && { pageSize: 100 }) }; const result = await client.tasks.list(optimizedOptions as any); const tasks = (result.data as unknown as AutotaskTask[]) || []; // Transform tasks to optimize data size const optimizedTasks = tasks.map(task => this.optimizeTaskData(task)); this.logger.info(`Retrieved ${optimizedTasks.length} tasks (optimized for size)`); return optimizedTasks; } catch (error) { this.logger.error('Failed to search tasks:', error); throw error; } }
  • JSON Schema definition for search_tasks tool inputs, including optional filters like searchTerm, projectID, status, assignedResourceID, and pageSize.
    name: 'search_tasks', description: 'Search for tasks in Autotask with optional filters. Returns optimized task data to prevent large responses.', inputSchema: { type: 'object', properties: { searchTerm: { type: 'string', description: 'Search term for task title' }, projectID: { type: 'number', description: 'Filter by project ID' }, status: { type: 'number', description: 'Filter by task status (1=New, 2=In Progress, 5=Complete)' }, assignedResourceID: { type: 'number', description: 'Filter by assigned resource ID' }, pageSize: { type: 'number', description: 'Number of results to return (default: 25, max: 100)', minimum: 1, maximum: 100 } }, required: [] } },
  • Switch case in callTool method that registers/handles the search_tasks tool by delegating to AutotaskService.searchTasks.
    case 'search_tasks': result = await this.autotaskService.searchTasks(args); message = `Found ${result.length} tasks`; break;
  • Helper function that optimizes task data by truncating descriptions and removing unnecessary fields to reduce response size.
    private optimizeTaskData(task: AutotaskTask): AutotaskTask { const maxDescriptionLength = 400; const optimizedDescription = task.description ? (task.description.length > maxDescriptionLength ? task.description.substring(0, maxDescriptionLength) + '... [truncated]' : task.description) : ''; return { ...task, description: optimizedDescription, // Remove potentially large arrays userDefinedFields: [] }; }

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/asachs01/autotask-mcp'

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