Skip to content

Commit 66ab6ef

Browse files
committed
Linting
1 parent 2333b63 commit 66ab6ef

File tree

7 files changed

+38
-28
lines changed

7 files changed

+38
-28
lines changed

apps/docs-autorag/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ Then connect to the server via remote MCP at `http://localhost:8976/sse`
1818

1919
```
2020
pnpm run deploy --env [ENVIRONMENT]
21-
```
21+
```

apps/docs-autorag/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { McpAgent } from 'agents/mcp'
3+
34
import { registerDocsTools } from './tools/docs'
45

56
// The docs MCP server isn't stateful, so we don't have state/props
@@ -13,7 +14,10 @@ export class CloudflareDocumentationMCP extends McpAgent<Env, State, Props> {
1314
version: '1.0.0',
1415
})
1516

16-
constructor(public ctx: DurableObjectState, public env: Env) {
17+
constructor(
18+
public ctx: DurableObjectState,
19+
public env: Env
20+
) {
1721
super(ctx, env)
1822
}
1923

apps/docs-autorag/src/tools/docs.ts

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import { type EmbeddedResource } from '@modelcontextprotocol/sdk/types.js'
2+
import mime from 'mime'
13
import { z } from 'zod'
4+
25
import type { CloudflareDocumentationMCP } from '../index'
3-
import { type EmbeddedResource } from "@modelcontextprotocol/sdk/types.js"
4-
import mime from "mime"
6+
57
/**
68
* Registers the docs search tool with the MCP server
79
* @param agent The MCP server instance
@@ -18,7 +20,7 @@ export function registerDocsTools(agent: CloudflareDocumentationMCP) {
1820
- You are unsure of how to use some Cloudflare functionality
1921
- You are writing Cloudflare Workers code and need to look up Workers-specific documentation
2022
21-
This tool returns a number of results from a vector database. These are embedded as resources in the response and are plaintext doucments in a variety of formats.
23+
This tool returns a number of results from a vector database. These are embedded as resources in the response and are plaintext documents in a variety of formats.
2224
`,
2325
{
2426
// partially pulled from autorag query optimization example
@@ -28,35 +30,46 @@ export function registerDocsTools(agent: CloudflareDocumentationMCP) {
2830
3. Remove irrelevant filler words
2931
4. Structure the query to emphasize key terms
3032
5. Include technical or domain-specific terminology if applicable`),
31-
scoreThreshold: z.number().min(0).max(1).optional().describe("A score threshold (0-1) for which matches should be included."),
32-
maxNumResults: z.number().default(10).optional().describe("The maximum number of results to return.")
33+
scoreThreshold: z
34+
.number()
35+
.min(0)
36+
.max(1)
37+
.optional()
38+
.describe('A score threshold (0-1) for which matches should be included.'),
39+
maxNumResults: z
40+
.number()
41+
.default(10)
42+
.optional()
43+
.describe('The maximum number of results to return.'),
3344
},
3445
async (params) => {
3546
// we don't need "rewrite query" OR aiSearch because an LLM writes the query and formats the output for us.
3647
const result = await agent.env.AI.autorag(agent.env.AUTORAG_NAME).search({
3748
query: params.query,
38-
ranking_options: params.scoreThreshold ? {
39-
score_threshold: params.scoreThreshold
40-
} : undefined,
41-
max_num_results: params.maxNumResults
49+
ranking_options: params.scoreThreshold
50+
? {
51+
score_threshold: params.scoreThreshold,
52+
}
53+
: undefined,
54+
max_num_results: params.maxNumResults,
4255
})
4356

4457
const resources: EmbeddedResource[] = result.data.map((result) => {
4558
const content = result.content.reduce((acc, contentPart) => {
4659
return acc + contentPart.text
47-
}, "")
60+
}, '')
4861
return {
49-
type: "resource",
62+
type: 'resource',
5063
resource: {
5164
uri: `docs://${result.filename}`,
52-
mimeType: mime.getType(result.filename) ?? "text/plain",
53-
text: content
54-
}
65+
mimeType: mime.getType(result.filename) ?? 'text/plain',
66+
text: content,
67+
},
5568
}
5669
})
5770

5871
return {
59-
content: resources
72+
content: resources,
6073
}
6174
}
6275
)

apps/docs-autorag/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"extends": "@repo/typescript-config/workers.json",
3-
"include": ["*/**.ts", "./vitest.config.ts"],
3+
"include": ["*/**.ts", "./vitest.config.ts"]
44
}

apps/docs-autorag/types.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/docs-autorag/wrangler.jsonc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"vars": {
3232
"ENVIRONMENT": "development",
33-
"AUTORAG_NAME": "cloudflare-docs-autorag",
33+
"AUTORAG_NAME": "cloudflare-docs-autorag"
3434
},
3535
"dev": {
3636
"port": 8976
@@ -52,7 +52,7 @@
5252
},
5353
"vars": {
5454
"ENVIRONMENT": "staging",
55-
"AUTORAG_NAME": "cloudflare-docs-autorag",
55+
"AUTORAG_NAME": "cloudflare-docs-autorag"
5656
},
5757

5858
"ai": {
@@ -73,7 +73,7 @@
7373
},
7474
"vars": {
7575
"ENVIRONMENT": "production",
76-
"AUTORAG_NAME": "cloudflare-docs-autorag",
76+
"AUTORAG_NAME": "cloudflare-docs-autorag"
7777
},
7878
"ai": {
7979
"binding": "AI"

packages/mcp-common/src/tools/kv_namespace.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { z } from 'zod'
2-
31
import { getCloudflareClient } from '../cloudflare-api'
42
import { MISSING_ACCOUNT_ID_RESPONSE } from '../constants'
53
import { type CloudflareMcpAgent } from '../types/cloudflare-mcp-agent'

0 commit comments

Comments
 (0)