list_opportunity_entries
Retrieve timeline entries for a sales opportunity, including notes, emails, and completed tasks, sorted newest first. Check the latest activity on any deal.
Instructions
List timeline entries (notes, captured emails, completed-task records) for an opportunity. Returns entries newest-first. Each entry has a type ('note', 'email', 'task'), free-text content, and timestamps. Use this to answer 'what's the latest on deal X?' For party or project timelines, use list_party_entries or list_project_entries respectively.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| opportunityId | Yes | ||
| page | No | ||
| perPage | No | ||
| embed | No | Comma-separated embeds, e.g. 'attachments,participants' |
Implementation Reference
- src/tools/entries.ts:33-39 (handler)The actual handler function for list_opportunity_entries. It calls capsuleGet to fetch entries from /opportunities/{opportunityId}/entries and returns the data along with a nextPage token for pagination.
export async function listOpportunityEntries(input: z.infer<typeof listOpportunityEntriesSchema>) { const { data, nextPage } = await capsuleGet<{ entries: unknown[] }>( `/opportunities/${input.opportunityId}/entries`, { embed: input.embed, page: input.page, perPage: input.perPage }, ); return { ...data, nextPage }; } - src/tools/entries.ts:28-31 (schema)Zod schema for the list_opportunity_entries tool. Requires opportunityId (positive int), plus optional pagination parameters (page, perPage, embed).
export const listOpportunityEntriesSchema = z.object({ opportunityId: z.number().int().positive(), ...listEntriesPagination, }); - src/server.ts:666-672 (registration)Registration of the list_opportunity_entries tool on the MCP server, calling registerTool with the name, description, schema, and handler function.
registerTool( server, "list_opportunity_entries", "List timeline entries (notes, captured emails, completed-task records) for an opportunity. Returns entries newest-first. Each entry has a type ('note', 'email', 'task'), free-text content, and timestamps. Use this to answer 'what's the latest on deal X?' For party or project timelines, use list_party_entries or list_project_entries respectively.", listOpportunityEntriesSchema, listOpportunityEntries, ); - src/server/register-tool.ts:39-59 (helper)The registerTool helper that wraps the handler and registers it with the McpServer SDK, wrapping return values in MCP text-content format.
export function registerTool<Schema extends z.ZodObject<ZodRawShape>>( server: McpServer, name: string, description: string, schema: Schema, handler: (input: z.infer<Schema>) => Promise<unknown>, ): void { // Use the SDK config-form registerTool with the full Zod schema. The // deprecated shape overload rebuilds z.object(schema.shape), which drops // object-level refinements such as superRefine. const registerWithSchema = server.registerTool.bind(server) as ( toolName: string, config: { description: string; inputSchema: Schema }, callback: (input: z.infer<Schema>) => Promise<CallToolResult>, ) => void; registerWithSchema(name, { description, inputSchema: schema }, async (input) => { const result = await handler(input); return wrapAsText(result); }); } - src/capsule/client.ts:344-355 (helper)The capsuleGet helper used by the handler to make GET requests to the Capsule API, returning paginated results with a nextPage link parser.
export async function capsuleGet<T>(path: string, params?: QueryParams): Promise<PagedResult<T>> { const token = getToken(); const url = buildUrl(path, params); const { res, cleanup } = await doFetch(url, { headers: baseHeaders(token) }); try { const data = await handleResponse<T>(res); const nextPage = parseNextPage(res.headers.get("Link")); return { data, nextPage }; } finally { cleanup(); } }