ninja_get_ticket_log
Fetch the activity and change log entries for a ticket. Use the ticket ID, and optionally set page size or pagination cursor to control results.
Instructions
Get the activity and change log entries for a ticket.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ticketId | Yes | Ticket ID | |
| pageSize | No | Max entries to return | |
| after | No | Pagination cursor |
Implementation Reference
- src/tools/ticketing.ts:134-136 (handler)The handler function for ninja_get_ticket_log. Makes a GET request to /ticketing/ticket/{ticketId}/log-entry, passing pagination params (pageSize, after) after stripping null/empty values via the clean() utility.
handler: async ({ ticketId, ...params }, client: NinjaOneClient) => client.get(`/ticketing/ticket/${ticketId}/log-entry`, clean(params)), }, - src/tools/ticketing.ts:124-132 (schema)The input schema for ninja_get_ticket_log. Requires ticketId (number), with optional pageSize (number) and after (number) for pagination.
inputSchema: { type: 'object', required: ['ticketId'], properties: { ticketId: { type: 'number', description: 'Ticket ID' }, pageSize: { type: 'number', description: 'Max entries to return' }, after: { type: 'number', description: 'Pagination cursor' }, }, }, - src/tools/ticketing.ts:120-136 (registration)The tool definition entry in the ticketingTools array. The tool is named 'ninja_get_ticket_log' with its schema and handler bundled together as a ToolDef object.
{ tool: { name: 'ninja_get_ticket_log', description: 'Get the activity and change log entries for a ticket.', inputSchema: { type: 'object', required: ['ticketId'], properties: { ticketId: { type: 'number', description: 'Ticket ID' }, pageSize: { type: 'number', description: 'Max entries to return' }, after: { type: 'number', description: 'Pagination cursor' }, }, }, }, handler: async ({ ticketId, ...params }, client: NinjaOneClient) => client.get(`/ticketing/ticket/${ticketId}/log-entry`, clean(params)), }, - src/tools/index.ts:13-24 (registration)ALL_TOOLS aggregates all tool definitions. ticketingTools (which includes ninja_get_ticket_log) is spread into this array, which is used by the MCP server to register tools.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:24-60 (registration)The MCP server registration in src/index.ts. The toolMap is built from ALL_TOOLS, mapping each tool name to its handler. The CallToolRequestSchema handler looks up the tool by name (e.g., 'ninja_get_ticket_log') and calls its handler.
const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler])); const server = new Server( { name: 'ninjaone-mcp', version: '1.0.0' }, { capabilities: { tools: {} } }, ); server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ALL_TOOLS.map((def) => def.tool), })); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const handler = toolMap.get(name); if (!handler) { return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true, }; } try { const result = await handler( (args ?? {}) as Record<string, unknown>, ninjaClient, ); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (err) { return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true, }; } });