Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

registerTool should return registered tool instead of undefined

Open Beginner friendly
#234 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
api

Research direction

Start at the registerTool() and executeTool() API definitions and their existing tests; the issue does not name specific files. Check how registration currently resolves and what object executeTool() accepts, then add or update a test for passing the returned tool directly to executeTool(). Done when registration returns the registered tool and the example workflow works.

Written by the indexing model from the issue text.

Description

enhancement

When registering and executing tools, I often see boilerplate code that requires an extra call to getTools().

await document.modelContext.registerTool({
  name: "tool",
  description: "A tool",
  execute: () => {},
});

const [tool] = await document.modelContext.getTools();
await document.modelContext.executeTool(tool, "{}");

Could we simplify this workflow by having registerTool() return the registered tool object directly? That way, we can pass it straight into executeTool() without the extra lookup step (which is not required by the way).

const tool = await document.modelContext.registerTool({
  name: "tool",
  description: "A tool",
  execute: () => {},
});

await document.modelContext.executeTool(tool, "{}");
Dominant language
Bikeshed
Stars
4.7k
Forks
328
Avg merge
2d 15h
Merged PRs (30d)
16

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from webmachinelearning/webmcp

All issues in webmachinelearning/webmcp

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.