MCPcopy
hub / github.com/callumalpass/tasknotes / registerTaskTools

Method registerTaskTools

src/services/MCPService.ts:248–566  ·  view source on GitHub ↗
(server: McpServer)

Source from the content-addressed store, hash-verified

246 // Task Tools
247
248 private registerTaskTools(server: McpServer): void {
249 const tool = this.getToolRegistrar(server);
250
251 tool(
252 "tasknotes_list_tasks",
253 {
254 description: "List all tasks with optional pagination",
255 inputSchema: {
256 limit: z.number().optional().describe("Max tasks to return"),
257 offset: z.number().optional().describe("Number of tasks to skip"),
258 },
259 },
260 async ({ limit, offset }: ListTasksArgs) => {
261 try {
262 const allTasks = await this.cacheManager.getAllTasks();
263 const start = offset ?? 0;
264 const end = limit ? start + limit : undefined;
265 const tasks = allTasks.slice(start, end);
266
267 return this.jsonResult({
268 tasks,
269 total: allTasks.length,
270 offset: start,
271 returned: tasks.length,
272 });
273 } catch (error: unknown) {
274 return this.errorResult(this.getErrorMessage(error));
275 }
276 }
277 );
278
279 tool(
280 "tasknotes_get_task",
281 {
282 description: "Get a single task by its file path ID",
283 inputSchema: {
284 id: z.string().describe("Task file path (e.g. 'tasks/My Task.md')"),
285 },
286 },
287 async ({ id }: TaskIdArgs) => {
288 try {
289 const task = await this.cacheManager.getTaskInfo(id);
290 if (!task) {
291 return this.errorResult("Task not found");
292 }
293 const taskWithDetails = await hydrateTaskDetailsFromFile(this.plugin.app, task);
294 return this.jsonResult(taskWithDetails);
295 } catch (error: unknown) {
296 return this.errorResult(this.getErrorMessage(error));
297 }
298 }
299 );
300
301 tool(
302 "tasknotes_create_task",
303 {
304 description: "Create a new task",
305 inputSchema: {

Callers 3

registerToolsMethod · 0.95
getListTasksCallbackFunction · 0.80
captureTaskToolsFunction · 0.80

Calls 15

getToolRegistrarMethod · 0.95
jsonResultMethod · 0.95
errorResultMethod · 0.95
getErrorMessageMethod · 0.95
getTaskInfoMethod · 0.65
createTaskMethod · 0.65
updateTaskMethod · 0.65
materializeOccurrenceMethod · 0.65
parseInputMethod · 0.65

Tested by 2

getListTasksCallbackFunction · 0.64
captureTaskToolsFunction · 0.64