list_associated_projects
Retrieve projects linked to a specific opportunity. Use to discover opportunity-to-project relationships.
Instructions
List projects (cases) associated with a given opportunity. Returns the same record shape as list_projects, filtered to one opportunity. The inverse direction (project → opportunity) is on each project's opportunity field directly, so this tool is only needed for opportunity → projects discovery — use list_party_projects for party → projects.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| opportunityId | Yes | ||
| embed | No | Comma-separated embeds, e.g. 'tags,fields' | |
| page | No | ||
| perPage | No |
Implementation Reference
- src/tools/relationships.ts:153-160 (handler)The main handler function for list_associated_projects. Makes a GET request to /opportunities/{id}/kases (Capsule's API uses /kases for projects) and returns the data with pagination info.
export async function listAssociatedProjects(input: z.infer<typeof listAssociatedProjectsSchema>) { // Capsule's API uses /kases for projects. const { data, nextPage } = await capsuleGet<{ kases: unknown[] }>( `/opportunities/${input.opportunityId}/kases`, { embed: input.embed, page: input.page, perPage: input.perPage }, ); return { ...data, nextPage }; } - src/tools/relationships.ts:146-151 (schema)Zod schema for list_associated_projects input: opportunityId (required positive int), embed (optional string for tags/fields), page (default 1), perPage (default 25, max 100).
export const listAssociatedProjectsSchema = z.object({ opportunityId: z.number().int().positive(), embed: z.string().optional().describe(EMBED_TAGS_FIELDS_DESCRIPTION), page: z.number().int().positive().optional().default(1), perPage: z.number().int().min(1).max(100).optional().default(25), }); - src/server.ts:450-456 (registration)Registration of the 'list_associated_projects' tool with the MCP server, linking the schema and handler.
registerTool( server, "list_associated_projects", "List projects (cases) associated with a given opportunity. Returns the same record shape as list_projects, filtered to one opportunity. The inverse direction (project → opportunity) is on each project's `opportunity` field directly, so this tool is only needed for opportunity → projects discovery — use list_party_projects for party → projects.", listAssociatedProjectsSchema, listAssociatedProjects, ); - src/server.ts:156-165 (registration)Import of listAssociatedProjectsSchema and listAssociatedProjects from the relationships module.
import { listAdditionalPartiesSchema, listAdditionalParties, addAdditionalPartySchema, addAdditionalParty, removeAdditionalPartySchema, removeAdditionalParty, listAssociatedProjectsSchema, listAssociatedProjects, } from "./tools/relationships.js";