objectives-get-by-id
Retrieve a specific Shortcut objective using its public ID to access project management data, with options for full or slim field returns.
Instructions
Get a Shortcut objective by public ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| objectivePublicId | Yes | The public ID of the objective to get | |
| full | No | True to return all objective fields from the API. False to return a slim version that excludes uncommon fields |
Implementation Reference
- src/tools/objectives.ts:88-98 (handler)The handler function 'getObjective' that fetches the Shortcut objective (milestone) by public ID using the client, handles errors, and formats the result using inherited methods.async getObjective(objectivePublicId: number, full = false) { const objective = await this.client.getMilestone(objectivePublicId); if (!objective) throw new Error(`Failed to retrieve Shortcut objective with public ID: ${objectivePublicId}`); return this.toResult( `Objective: ${objectivePublicId}`, await this.entityWithRelatedEntities(objective, "objective", full), ); }
- src/tools/objectives.ts:15-24 (schema)Input schema using Zod for the tool parameters: objectivePublicId (required positive number) and full (optional boolean, default false).{ objectivePublicId: z.number().positive().describe("The public ID of the objective to get"), full: z .boolean() .optional() .default(false) .describe( "True to return all objective fields from the API. False to return a slim version that excludes uncommon fields", ), },
- src/tools/objectives.ts:12-26 (registration)Registration of the 'objectives-get-by-id' tool via server.addToolWithReadAccess, specifying name, description, input schema, and delegating to the getObjective handler.server.addToolWithReadAccess( "objectives-get-by-id", "Get a Shortcut objective by public ID", { objectivePublicId: z.number().positive().describe("The public ID of the objective to get"), full: z .boolean() .optional() .default(false) .describe( "True to return all objective fields from the API. False to return a slim version that excludes uncommon fields", ), }, async ({ objectivePublicId, full }) => await tools.getObjective(objectivePublicId, full), );