Skip to main content
Glama
asachs01

Autotask MCP Server

search_ticket_notes

Find notes associated with a specific Autotask ticket by entering the ticket ID to review communication history and track updates.

Instructions

Search for notes on a specific ticket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticketIdYesThe ticket ID to search notes for
pageSizeNoNumber of results to return (default: 25, max: 100)

Implementation Reference

  • Tool schema definition including name, description, and input schema requiring ticketId and optional pageSize.
    {
      name: 'search_ticket_notes',
      description: 'Search for notes on a specific ticket',
      inputSchema: {
        type: 'object',
        properties: {
          ticketId: {
            type: 'number',
            description: 'The ticket ID to search notes for'
          },
          pageSize: {
            type: 'number',
            description: 'Number of results to return (default: 25, max: 100)',
            minimum: 1,
            maximum: 100
          }
        },
        required: ['ticketId']
      }
    },
  • MCP tool handler logic in callTool switch statement: extracts args, calls autotaskService.searchTicketNotes, sets success message.
    case 'search_ticket_notes':
      result = await this.autotaskService.searchTicketNotes(args.ticketId, { pageSize: args.pageSize });
      message = `Found ${result.length} ticket notes`;
      break;
  • Core service method implementing the search: queries Autotask notes.list API filtered by ticketId with pagination support, returns typed AutotaskTicketNote[]
    async searchTicketNotes(ticketId: number, options: AutotaskQueryOptionsExtended = {}): Promise<AutotaskTicketNote[]> {
      const client = await this.ensureClient();
      
      try {
        this.logger.debug(`Searching ticket notes for ticket ${ticketId}:`, options);
        
        // Set reasonable limits for notes
        const optimizedOptions = {
          filter: [
            { field: 'ticketId', op: 'eq', value: ticketId }
          ],
          pageSize: options.pageSize || 25
        };
    
        const result = await client.notes.list(optimizedOptions);
        const notes = (result.data as any[]) || [];
        
        this.logger.info(`Retrieved ${notes.length} ticket notes`);
        return notes as AutotaskTicketNote[];
      } catch (error) {
        this.logger.error(`Failed to search ticket notes for ticket ${ticketId}:`, error);
        throw error;
      }
    }
  • MCP server registers the ListTools handler which delegates to toolHandler.listTools() returning all tools including search_ticket_notes.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      try {
        this.logger.debug('Handling list tools request');
        const tools = await this.toolHandler.listTools();
        return { tools };
      } catch (error) {
        this.logger.error('Failed to list tools:', error);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to list tools: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    });
  • MCP server registers the CallTool handler which delegates tool execution (including search_ticket_notes) to toolHandler.callTool.
    // Call a tool
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      try {
        this.logger.debug(`Handling tool call: ${request.params.name}`);
        const result = await this.toolHandler.callTool(
          request.params.name,
          request.params.arguments || {}
        );
        return {
          content: result.content,
          isError: result.isError
        };
      } catch (error) {
        this.logger.error(`Failed to call tool ${request.params.name}:`, error);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to call tool: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    });

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