Skip to main content
Glama

get-objective

Retrieve Shortcut objectives by public ID, offering full or slim field options, enabling efficient project management integration via the Shortcut MCP Server.

Instructions

Get a Shortcut objective by public ID

Input Schema

NameRequiredDescriptionDefault
fullNoTrue to return all objective fields from the API. False to return a slim version that excludes uncommon fields
objectivePublicIdYesThe public ID of the objective to get

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "full": { "default": false, "description": "True to return all objective fields from the API. False to return a slim version that excludes uncommon fields", "type": "boolean" }, "objectivePublicId": { "description": "The public ID of the objective to get", "exclusiveMinimum": 0, "type": "number" } }, "required": [ "objectivePublicId" ], "type": "object" }

Implementation Reference

  • The main handler function that implements the logic for retrieving a specific Shortcut objective (milestone) by its public ID, fetches related data, and formats the response.
    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), ); }
  • Registers the MCP tool named 'objectives-get-by-id' (the get-objective tool), including its description, input schema, and links to the 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), );
  • src/server.ts:50-50 (registration)
    Initializes the ObjectiveTools instance and adds its tools (including get-objective) to the MCP server.
    ObjectiveTools.create(client, server);
  • Zod schema defining the input parameters for the get-objective tool: objectivePublicId (required number) and full (optional boolean).
    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", ), },
  • Helper method used by the handler to fetch and attach related entities (users, teams, etc.) to the objective data.
    protected async entityWithRelatedEntities( entity: | Story | StorySearchResult | StorySlim | Epic | EpicSearchResult | Iteration | IterationSlim | Group | Workflow | ObjectiveSearchResult | Milestone, entityType = "entity", full = false, ) { const finalEntity = full ? entity : this.getSimplifiedEntity(entity, "simple"); const relatedEntities = await this.getRelatedEntities(entity, full ? "full" : "simple"); return { [entityType]: this.renameEntityProps(finalEntity as unknown as Record<string, unknown>), relatedEntities, }; }

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/useshortcut/mcp-server-shortcut'

If you have feedback or need assistance with the MCP directory API, please join our Discord server