List Background Tasks
list-background-tasksView all active background tasks like development servers and builds managed by the MCP Background Task Server.
Instructions
Lists all currently running background tasks.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list-background-tasks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:148-178 (handler)The handler function that executes the tool logic: checks if there are any running background tasks and either returns a message indicating none are running or lists all tasks with their name, PID, and state.
async () => { if (processes.size === 0) { return { content: [ { type: "text", text: "No background tasks are currently running.", }, ], }; } else { const tasks = Array.from(processes.entries()).map(([name, child]) => ({ name, pid: child.getPid(), state: child.getState(), })); return { content: [ { type: "text", text: `Currently running tasks:\n${tasks .map( (task) => `- ${task.name} (PID: ${task.pid}, State: ${task.state})` ) .join("\n")}`, }, ], }; } } - src/index.ts:143-147 (schema)The input schema definition for the tool, which requires no parameters (empty inputSchema), along with title and description.
{ title: "List Background Tasks", description: "Lists all currently running background tasks.", inputSchema: {}, }, - src/index.ts:141-179 (registration)The server.registerTool call that registers the 'list-background-tasks' tool, providing its name, schema, and handler function.
server.registerTool( "list-background-tasks", { title: "List Background Tasks", description: "Lists all currently running background tasks.", inputSchema: {}, }, async () => { if (processes.size === 0) { return { content: [ { type: "text", text: "No background tasks are currently running.", }, ], }; } else { const tasks = Array.from(processes.entries()).map(([name, child]) => ({ name, pid: child.getPid(), state: child.getState(), })); return { content: [ { type: "text", text: `Currently running tasks:\n${tasks .map( (task) => `- ${task.name} (PID: ${task.pid}, State: ${task.state})` ) .join("\n")}`, }, ], }; } } );