Skip to main content
Glama
OctopusDeploy

Octopus Deploy MCP Server

Official

get_task_by_id

Retrieve detailed information about a specific server task using its unique ID to monitor deployment progress, health checks, or system maintenance operations in Octopus Deploy.

Instructions

Get details for a specific server task by its ID. Tasks represent background operations in Octopus Deploy, such as deployments, health checks, and system maintenance. Each task has a unique ID and can be monitored for status and progress.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spaceNameYes
taskIdYes

Implementation Reference

  • The asynchronous handler function that implements the get_task_by_id tool logic: validates input, creates Octopus client, fetches task by ID from the SpaceServerTaskRepository, and returns the response as JSON-formatted text content.
    async (args) => { const { spaceName, taskId } = args as GetTaskByIdParams; if (!taskId) { throw new Error("Task ID is required"); } const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const serverTaskRepository = new SpaceServerTaskRepository(client, spaceName); const response = await serverTaskRepository.getById(taskId); return { content: [ { type: "text", text: JSON.stringify(response), }, ], }; }
  • TypeScript interface defining the input parameters for the get_task_by_id tool: spaceName and taskId.
    export interface GetTaskByIdParams { spaceName: string; taskId: string; }
  • Registers the get_task_by_id tool definition in the TOOL_REGISTRY, enabling conditional registration in src/tools/index.ts based on configuration.
    registerToolDefinition({ toolName: "get_task_by_id", config: { toolset: "tasks", readOnly: true }, registerFn: registerGetTaskByIdTool, });
  • The registerGetTaskByIdTool function that registers the tool with the MCP server, including name, description, Zod input schema, UI properties, and handler reference.
    export function registerGetTaskByIdTool(server: McpServer) { server.tool( 'get_task_by_id', `Get details for a specific server task by its ID. ${tasksDescription}`, { spaceName: z.string(), taskId: z.string() }, { title: 'Get details for a specific server task by its ID', readOnlyHint: true, }, async (args) => { const { spaceName, taskId } = args as GetTaskByIdParams; if (!taskId) { throw new Error("Task ID is required"); } const configuration = getClientConfigurationFromEnvironment(); const client = await Client.create(configuration); const serverTaskRepository = new SpaceServerTaskRepository(client, spaceName); const response = await serverTaskRepository.getById(taskId); return { content: [ { type: "text", text: JSON.stringify(response), }, ], }; } ); }
  • Reusable helper function to retrieve a server task by ID using a pre-configured Client instance.
    export async function getTaskById(client: Client, params: GetTaskByIdParams) { const { spaceName, taskId } = params; if (!taskId) { throw new Error("Task ID is required"); } const serverTaskRepository = new SpaceServerTaskRepository(client, spaceName); const response = await serverTaskRepository.getById(taskId); return response; }

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

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