File tree Expand file tree Collapse file tree 3 files changed +19
-16
lines changed Expand file tree Collapse file tree 3 files changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313// Import tools
1414import * as browserEval from "./tools/browser-eval.js"
1515import * as enableCacheComponents from "./tools/enable-cache-components.js"
16+ import * as init from "./tools/init.js"
1617import * as nextjsDocs from "./tools/nextjs-docs.js"
1718import * as nextjsRuntime from "./tools/nextjs-runtime.js"
1819import * as upgradeNextjs16 from "./tools/upgrade-nextjs-16.js"
@@ -42,6 +43,7 @@ import * as nextjs16Examples from "./resources/(nextjs16)/migration/examples.js"
4243const tools = [
4344 browserEval ,
4445 enableCacheComponents ,
46+ init ,
4547 nextjsDocs ,
4648 nextjsRuntime ,
4749 upgradeNextjs16 ,
@@ -115,8 +117,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
115117 // Validate arguments with Zod schema
116118 const parsedArgs = validateToolArgs ( tool . inputSchema , args || { } )
117119
118- // Call the tool handler
119- const result = await tool . handler ( parsedArgs )
120+ // Call the tool handler (cast to any to work around TypeScript union type limitations)
121+ const result = await ( tool . handler as any ) ( parsedArgs )
120122
121123 return {
122124 content : [
Original file line number Diff line number Diff line change 1- import { type InferSchema } from "xmcp"
21import { z } from "zod"
3- import { markInitCalled } from "../_internal/global-state"
2+ import { markInitCalled } from "../_internal/global-state.js "
43
5- export const schema = {
4+ export const inputSchema = {
65 project_path : z
76 . string ( )
87 . optional ( )
@@ -30,7 +29,11 @@ Use this tool at the beginning of a Next.js session to:
3029- Follow best practices for Next.js development` ,
3130}
3231
33- export default async function init ( args : InferSchema < typeof schema > ) : Promise < string > {
32+ type InitArgs = {
33+ project_path ?: string
34+ }
35+
36+ export async function handler ( args : InitArgs ) : Promise < string > {
3437 try {
3538 // Fetch the latest Next.js LLM documentation
3639 let nextjsDocsContent = ""
Original file line number Diff line number Diff line change 11import { z } from "zod"
2- import { isInitCalled } from "../_internal/global-state"
2+ import { isInitCalled } from "../_internal/global-state.js "
33
44export const inputSchema = {
55 action : z
@@ -33,15 +33,13 @@ export const inputSchema = {
3333 ) ,
3434}
3535
36- type NextjsDocsArgs = z . infer < typeof inputSchema [ "action" ] > extends "search" | "get"
37- ? {
38- action : "search" | "get"
39- query ?: string
40- path ?: string
41- anchor ?: string
42- routerType ?: "all" | "app" | "pages"
43- }
44- : never
36+ type NextjsDocsArgs = {
37+ action : "search" | "get" | "force-search"
38+ query ?: string
39+ path ?: string
40+ anchor ?: string
41+ routerType ?: "all" | "app" | "pages"
42+ }
4543
4644export const metadata = {
4745 name : "nextjs_docs" ,
You can’t perform that action at this time.
0 commit comments