How to Generate Integration Code with Claude

Generate accurate integration code with Claude and ToolRouter. Ground code generation in current library docs.

Tool
Library Docs icon
Library Docs

Claude fetches live documentation first, then generates code based on the actual current API. The output is grounded in real method signatures and configuration options — not training data that may predate the version you are using.

Connect ToolRouter to Claude

1Open connector settings Open Settings
2Add a custom connector with these details
Name
ToolRouter
URL
https://api.toolrouter.com/mcp
3Let Claude set you up Open Claude

Steps

Once connected (see setup above), use the Library Docs tool:

  1. Ask: "Get the current docs for [package] then write me integration code that [describes what you need]"
  2. Claude fetches the documentation and generates code using accurate API calls
  3. Ask: "Add error handling and TypeScript types"
  4. Copy the working code into your project

Example Prompt

Try this with Claude using the Library Docs tool
Get the current documentation for the Resend email library, then write a TypeScript function that sends a transactional email with a subject, HTML body, and reply-to address.

Tips

  • Ask Claude to fetch the docs and generate the code in one request for maximum efficiency
  • Specify the TypeScript version and whether you are using ESM or CommonJS
  • Ask Claude to include the correct import statement based on the current package exports