@youdotcom-oss/mcp 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bin/stdio.js +394 -415
  2. package/package.json +12 -23
  3. package/src/contents/contents.schemas.ts +3 -48
  4. package/src/contents/contents.utils.ts +33 -133
  5. package/src/contents/register-contents-tool.ts +24 -24
  6. package/src/contents/tests/contents.utils.spec.ts +58 -134
  7. package/src/express/express.schema.ts +23 -0
  8. package/src/express/express.utils.ts +10 -121
  9. package/src/express/register-express-tool.ts +19 -19
  10. package/src/express/tests/express.utils.spec.ts +80 -159
  11. package/src/get-mcp-server.ts +3 -3
  12. package/src/http.ts +38 -38
  13. package/src/search/register-search-tool.ts +23 -23
  14. package/src/search/search.schema.ts +38 -0
  15. package/src/search/search.utils.ts +18 -96
  16. package/src/search/tests/search.utils.spec.ts +61 -194
  17. package/src/shared/format-search-results-text.ts +16 -16
  18. package/src/shared/get-logger.ts +4 -4
  19. package/src/shared/tests/shared.utils.spec.ts +56 -56
  20. package/src/shared/use-client-version.ts +8 -8
  21. package/src/stdio.ts +16 -16
  22. package/src/tests/http.spec.ts +105 -105
  23. package/src/tests/tool.spec.ts +212 -212
  24. package/dist/contents/contents.schemas.d.ts +0 -55
  25. package/dist/contents/contents.utils.d.ts +0 -28
  26. package/dist/contents/register-contents-tool.d.ts +0 -10
  27. package/dist/express/express.schemas.d.ts +0 -56
  28. package/dist/express/express.utils.d.ts +0 -45
  29. package/dist/express/register-express-tool.d.ts +0 -6
  30. package/dist/get-mcp-server.d.ts +0 -2
  31. package/dist/http.d.ts +0 -3
  32. package/dist/main.d.ts +0 -9
  33. package/dist/search/register-search-tool.d.ts +0 -6
  34. package/dist/search/search.schemas.d.ts +0 -133
  35. package/dist/search/search.utils.d.ts +0 -98
  36. package/dist/shared/api-constants.d.ts +0 -9
  37. package/dist/shared/check-response-for-errors.d.ts +0 -6
  38. package/dist/shared/format-search-results-text.d.ts +0 -19
  39. package/dist/shared/generate-error-report-link.d.ts +0 -9
  40. package/dist/shared/get-logger.d.ts +0 -7
  41. package/dist/shared/use-client-version.d.ts +0 -6
  42. package/dist/stdio.d.ts +0 -2
  43. package/src/express/express.schemas.ts +0 -99
  44. package/src/main.ts +0 -9
  45. package/src/search/search.schemas.ts +0 -147
  46. package/src/shared/api-constants.ts +0 -10
  47. package/src/shared/check-response-for-errors.ts +0 -13
  48. package/src/shared/generate-error-report-link.ts +0 -37
  49. package/src/tests/exports.spec.ts +0 -24
@@ -1,55 +0,0 @@
1
- import * as z from 'zod';
2
- /**
3
- * Input schema for the you-contents tool
4
- * Accepts an array of URLs, optional formats array (or legacy format string), and optional crawl timeout
5
- */
6
- export declare const ContentsQuerySchema: z.ZodObject<{
7
- urls: z.ZodArray<z.ZodString>;
8
- formats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
9
- markdown: "markdown";
10
- html: "html";
11
- metadata: "metadata";
12
- }>>>;
13
- format: z.ZodOptional<z.ZodEnum<{
14
- markdown: "markdown";
15
- html: "html";
16
- }>>;
17
- crawl_timeout: z.ZodOptional<z.ZodNumber>;
18
- }, z.core.$strip>;
19
- export type ContentsQuery = z.infer<typeof ContentsQuerySchema>;
20
- /**
21
- * API response schema from You.com Contents API
22
- * Validates the full response array
23
- */
24
- export declare const ContentsApiResponseSchema: z.ZodArray<z.ZodObject<{
25
- url: z.ZodString;
26
- title: z.ZodOptional<z.ZodString>;
27
- html: z.ZodOptional<z.ZodString>;
28
- markdown: z.ZodOptional<z.ZodString>;
29
- metadata: z.ZodOptional<z.ZodObject<{
30
- jsonld: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
31
- opengraph: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
32
- twitter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
33
- }, z.core.$strip>>;
34
- }, z.core.$strip>>;
35
- export type ContentsApiResponse = z.infer<typeof ContentsApiResponseSchema>;
36
- /**
37
- * Structured content schema for MCP response
38
- * Includes full content and metadata for each URL
39
- */
40
- export declare const ContentsStructuredContentSchema: z.ZodObject<{
41
- count: z.ZodNumber;
42
- formats: z.ZodArray<z.ZodString>;
43
- items: z.ZodArray<z.ZodObject<{
44
- url: z.ZodString;
45
- title: z.ZodOptional<z.ZodString>;
46
- markdown: z.ZodOptional<z.ZodString>;
47
- html: z.ZodOptional<z.ZodString>;
48
- metadata: z.ZodOptional<z.ZodObject<{
49
- jsonld: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
50
- opengraph: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
51
- twitter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
52
- }, z.core.$strip>>;
53
- }, z.core.$strip>>;
54
- }, z.core.$strip>;
55
- export type ContentsStructuredContent = z.infer<typeof ContentsStructuredContentSchema>;
@@ -1,28 +0,0 @@
1
- import { type ContentsApiResponse, type ContentsQuery, type ContentsStructuredContent } from './contents.schemas.ts';
2
- /**
3
- * Fetch content from You.com Contents API
4
- * The API accepts multiple URLs in a single request and returns all results
5
- * @param contentsQuery - Query parameters including URLs and format
6
- * @param YDC_API_KEY - You.com API key
7
- * @param getUserAgent - Function to get User-Agent string
8
- * @returns Parsed and validated API response
9
- */
10
- export declare const fetchContents: ({ contentsQuery: { urls, formats, format, crawl_timeout }, YDC_API_KEY, getUserAgent, }: {
11
- contentsQuery: ContentsQuery;
12
- YDC_API_KEY?: string;
13
- getUserAgent: () => string;
14
- }) => Promise<ContentsApiResponse>;
15
- /**
16
- * Format contents API response for MCP output
17
- * Returns full content in both text and structured formats
18
- * @param response - Validated API response
19
- * @param formats - Formats used for extraction
20
- * @returns Formatted response with content and structuredContent
21
- */
22
- export declare const formatContentsResponse: (response: ContentsApiResponse, formats: string[]) => {
23
- content: Array<{
24
- type: "text";
25
- text: string;
26
- }>;
27
- structuredContent: ContentsStructuredContent;
28
- };
@@ -1,10 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- /**
3
- * Register the you-contents tool with the MCP server
4
- * Extracts and returns full content from multiple URLs in markdown or HTML format
5
- */
6
- export declare const registerContentsTool: ({ mcp, YDC_API_KEY, getUserAgent, }: {
7
- mcp: McpServer;
8
- YDC_API_KEY?: string;
9
- getUserAgent: () => string;
10
- }) => void;
@@ -1,56 +0,0 @@
1
- import * as z from 'zod';
2
- export declare const ExpressAgentInputSchema: z.ZodObject<{
3
- input: z.ZodString;
4
- tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
5
- type: z.ZodEnum<{
6
- web_search: "web_search";
7
- }>;
8
- }, z.core.$strip>>>;
9
- }, z.core.$strip>;
10
- export type ExpressAgentInput = z.infer<typeof ExpressAgentInputSchema>;
11
- export declare const ExpressAgentApiResponseSchema: z.ZodObject<{
12
- output: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
13
- type: z.ZodLiteral<"web_search.results">;
14
- content: z.ZodArray<z.ZodObject<{
15
- source_type: z.ZodOptional<z.ZodString>;
16
- citation_uri: z.ZodOptional<z.ZodString>;
17
- url: z.ZodString;
18
- title: z.ZodString;
19
- snippet: z.ZodString;
20
- thumbnail_url: z.ZodOptional<z.ZodString>;
21
- provider: z.ZodOptional<z.ZodAny>;
22
- }, z.core.$strip>>;
23
- }, z.core.$strip>, z.ZodObject<{
24
- type: z.ZodLiteral<"message.answer">;
25
- text: z.ZodString;
26
- }, z.core.$strip>]>>;
27
- agent: z.ZodOptional<z.ZodString>;
28
- mode: z.ZodOptional<z.ZodString>;
29
- input: z.ZodOptional<z.ZodArray<z.ZodAny>>;
30
- }, z.core.$loose>;
31
- export type ExpressAgentApiResponse = z.infer<typeof ExpressAgentApiResponseSchema>;
32
- declare const ExpressAgentMcpResponseSchema: z.ZodObject<{
33
- answer: z.ZodString;
34
- results: z.ZodOptional<z.ZodObject<{
35
- web: z.ZodArray<z.ZodObject<{
36
- url: z.ZodString;
37
- title: z.ZodString;
38
- snippet: z.ZodString;
39
- }, z.core.$strip>>;
40
- }, z.core.$strip>>;
41
- agent: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>;
43
- export type ExpressAgentMcpResponse = z.infer<typeof ExpressAgentMcpResponseSchema>;
44
- export declare const ExpressStructuredContentSchema: z.ZodObject<{
45
- answer: z.ZodString;
46
- hasResults: z.ZodBoolean;
47
- resultCount: z.ZodNumber;
48
- agent: z.ZodOptional<z.ZodString>;
49
- results: z.ZodOptional<z.ZodObject<{
50
- web: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
- url: z.ZodString;
52
- title: z.ZodString;
53
- }, z.core.$strip>>>;
54
- }, z.core.$strip>>;
55
- }, z.core.$strip>;
56
- export {};
@@ -1,45 +0,0 @@
1
- import { type ExpressAgentInput, type ExpressAgentMcpResponse } from './express.schemas.ts';
2
- export declare const callExpressAgent: ({ YDC_API_KEY, agentInput: { input, tools }, getUserAgent, }: {
3
- agentInput: ExpressAgentInput;
4
- YDC_API_KEY?: string;
5
- getUserAgent: () => string;
6
- }) => Promise<{
7
- answer: string;
8
- results?: {
9
- web: {
10
- url: string;
11
- title: string;
12
- snippet: string;
13
- }[];
14
- } | undefined;
15
- agent?: string | undefined;
16
- }>;
17
- export declare const formatExpressAgentResponse: (response: ExpressAgentMcpResponse) => {
18
- content: {
19
- type: "text";
20
- text: string;
21
- }[];
22
- structuredContent: {
23
- answer: string;
24
- hasResults: boolean;
25
- resultCount: number;
26
- agent: string | undefined;
27
- results: {
28
- web: {
29
- url: string;
30
- title: string;
31
- }[];
32
- } | undefined;
33
- };
34
- fullResponse: {
35
- answer: string;
36
- results?: {
37
- web: {
38
- url: string;
39
- title: string;
40
- snippet: string;
41
- }[];
42
- } | undefined;
43
- agent?: string | undefined;
44
- };
45
- };
@@ -1,6 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare const registerExpressTool: ({ mcp, YDC_API_KEY, getUserAgent, }: {
3
- mcp: McpServer;
4
- YDC_API_KEY?: string;
5
- getUserAgent: () => string;
6
- }) => void;
@@ -1,2 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare const getMCpServer: () => McpServer;
package/dist/http.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Hono } from 'hono';
2
- declare const app: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
3
- export default app;
package/dist/main.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export * from './contents/contents.schemas.ts';
2
- export * from './contents/contents.utils.ts';
3
- export * from './express/express.schemas.ts';
4
- export * from './express/express.utils.ts';
5
- export * from './search/search.schemas.ts';
6
- export * from './search/search.utils.ts';
7
- export * from './shared/api-constants.ts';
8
- export * from './shared/check-response-for-errors.ts';
9
- export * from './shared/format-search-results-text.ts';
@@ -1,6 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- export declare const registerSearchTool: ({ mcp, YDC_API_KEY, getUserAgent, }: {
3
- mcp: McpServer;
4
- YDC_API_KEY?: string;
5
- getUserAgent: () => string;
6
- }) => void;
@@ -1,133 +0,0 @@
1
- import * as z from 'zod';
2
- export declare const SearchQuerySchema: z.ZodObject<{
3
- query: z.ZodString;
4
- count: z.ZodOptional<z.ZodNumber>;
5
- freshness: z.ZodOptional<z.ZodString>;
6
- offset: z.ZodOptional<z.ZodNumber>;
7
- country: z.ZodOptional<z.ZodEnum<{
8
- AR: "AR";
9
- AU: "AU";
10
- AT: "AT";
11
- BE: "BE";
12
- BR: "BR";
13
- CA: "CA";
14
- CL: "CL";
15
- DK: "DK";
16
- FI: "FI";
17
- FR: "FR";
18
- DE: "DE";
19
- HK: "HK";
20
- IN: "IN";
21
- ID: "ID";
22
- IT: "IT";
23
- JP: "JP";
24
- KR: "KR";
25
- MY: "MY";
26
- MX: "MX";
27
- NL: "NL";
28
- NZ: "NZ";
29
- NO: "NO";
30
- CN: "CN";
31
- PL: "PL";
32
- PT: "PT";
33
- PH: "PH";
34
- RU: "RU";
35
- SA: "SA";
36
- ZA: "ZA";
37
- ES: "ES";
38
- SE: "SE";
39
- CH: "CH";
40
- TW: "TW";
41
- TR: "TR";
42
- GB: "GB";
43
- US: "US";
44
- }>>;
45
- safesearch: z.ZodOptional<z.ZodEnum<{
46
- off: "off";
47
- moderate: "moderate";
48
- strict: "strict";
49
- }>>;
50
- site: z.ZodOptional<z.ZodString>;
51
- fileType: z.ZodOptional<z.ZodString>;
52
- language: z.ZodOptional<z.ZodString>;
53
- excludeTerms: z.ZodOptional<z.ZodString>;
54
- exactTerms: z.ZodOptional<z.ZodString>;
55
- livecrawl: z.ZodOptional<z.ZodEnum<{
56
- web: "web";
57
- news: "news";
58
- all: "all";
59
- }>>;
60
- livecrawl_formats: z.ZodOptional<z.ZodEnum<{
61
- markdown: "markdown";
62
- html: "html";
63
- }>>;
64
- }, z.core.$strip>;
65
- export type SearchQuery = z.infer<typeof SearchQuerySchema>;
66
- declare const NewsResultSchema: z.ZodObject<{
67
- title: z.ZodString;
68
- description: z.ZodString;
69
- page_age: z.ZodString;
70
- url: z.ZodString;
71
- thumbnail_url: z.ZodOptional<z.ZodString>;
72
- contents: z.ZodOptional<z.ZodObject<{
73
- html: z.ZodOptional<z.ZodString>;
74
- markdown: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>>;
76
- }, z.core.$strip>;
77
- export type NewsResult = z.infer<typeof NewsResultSchema>;
78
- export declare const SearchResponseSchema: z.ZodObject<{
79
- results: z.ZodObject<{
80
- web: z.ZodOptional<z.ZodArray<z.ZodObject<{
81
- url: z.ZodString;
82
- title: z.ZodString;
83
- description: z.ZodString;
84
- snippets: z.ZodArray<z.ZodString>;
85
- page_age: z.ZodOptional<z.ZodString>;
86
- authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
- thumbnail_url: z.ZodOptional<z.ZodString>;
88
- favicon_url: z.ZodOptional<z.ZodString>;
89
- contents: z.ZodOptional<z.ZodObject<{
90
- html: z.ZodOptional<z.ZodString>;
91
- markdown: z.ZodOptional<z.ZodString>;
92
- }, z.core.$strip>>;
93
- }, z.core.$strip>>>;
94
- news: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
- title: z.ZodString;
96
- description: z.ZodString;
97
- page_age: z.ZodString;
98
- url: z.ZodString;
99
- thumbnail_url: z.ZodOptional<z.ZodString>;
100
- contents: z.ZodOptional<z.ZodObject<{
101
- html: z.ZodOptional<z.ZodString>;
102
- markdown: z.ZodOptional<z.ZodString>;
103
- }, z.core.$strip>>;
104
- }, z.core.$strip>>>;
105
- }, z.core.$strip>;
106
- metadata: z.ZodObject<{
107
- search_uuid: z.ZodOptional<z.ZodOptional<z.ZodString>>;
108
- query: z.ZodOptional<z.ZodString>;
109
- latency: z.ZodOptional<z.ZodNumber>;
110
- }, z.core.$strip>;
111
- }, z.core.$strip>;
112
- export type SearchResponse = z.infer<typeof SearchResponseSchema>;
113
- export declare const SearchStructuredContentSchema: z.ZodObject<{
114
- resultCounts: z.ZodObject<{
115
- web: z.ZodNumber;
116
- news: z.ZodNumber;
117
- total: z.ZodNumber;
118
- }, z.core.$strip>;
119
- results: z.ZodOptional<z.ZodObject<{
120
- web: z.ZodOptional<z.ZodArray<z.ZodObject<{
121
- url: z.ZodString;
122
- title: z.ZodString;
123
- page_age: z.ZodOptional<z.ZodString>;
124
- }, z.core.$strip>>>;
125
- news: z.ZodOptional<z.ZodArray<z.ZodObject<{
126
- url: z.ZodString;
127
- title: z.ZodString;
128
- page_age: z.ZodString;
129
- }, z.core.$strip>>>;
130
- }, z.core.$strip>>;
131
- }, z.core.$strip>;
132
- export type SearchStructuredContent = z.infer<typeof SearchStructuredContentSchema>;
133
- export {};
@@ -1,98 +0,0 @@
1
- import { type SearchQuery, type SearchResponse } from './search.schemas.ts';
2
- export declare const fetchSearchResults: ({ YDC_API_KEY, searchQuery: { query, site, fileType, language, exactTerms, excludeTerms, ...rest }, getUserAgent, }: {
3
- searchQuery: SearchQuery;
4
- YDC_API_KEY?: string;
5
- getUserAgent: () => string;
6
- }) => Promise<{
7
- results: {
8
- web?: {
9
- url: string;
10
- title: string;
11
- description: string;
12
- snippets: string[];
13
- page_age?: string | undefined;
14
- authors?: string[] | undefined;
15
- thumbnail_url?: string | undefined;
16
- favicon_url?: string | undefined;
17
- contents?: {
18
- html?: string | undefined;
19
- markdown?: string | undefined;
20
- } | undefined;
21
- }[] | undefined;
22
- news?: {
23
- title: string;
24
- description: string;
25
- page_age: string;
26
- url: string;
27
- thumbnail_url?: string | undefined;
28
- contents?: {
29
- html?: string | undefined;
30
- markdown?: string | undefined;
31
- } | undefined;
32
- }[] | undefined;
33
- };
34
- metadata: {
35
- search_uuid?: string | undefined;
36
- query?: string | undefined;
37
- latency?: number | undefined;
38
- };
39
- }>;
40
- export declare const formatSearchResults: (response: SearchResponse) => {
41
- content: {
42
- type: "text";
43
- text: string;
44
- }[];
45
- structuredContent: {
46
- resultCounts: {
47
- web: number;
48
- news: number;
49
- total: number;
50
- };
51
- results: {
52
- web?: Array<{
53
- url: string;
54
- title: string;
55
- page_age?: string;
56
- }>;
57
- news?: Array<{
58
- url: string;
59
- title: string;
60
- page_age: string;
61
- }>;
62
- } | undefined;
63
- };
64
- fullResponse: {
65
- results: {
66
- web?: {
67
- url: string;
68
- title: string;
69
- description: string;
70
- snippets: string[];
71
- page_age?: string | undefined;
72
- authors?: string[] | undefined;
73
- thumbnail_url?: string | undefined;
74
- favicon_url?: string | undefined;
75
- contents?: {
76
- html?: string | undefined;
77
- markdown?: string | undefined;
78
- } | undefined;
79
- }[] | undefined;
80
- news?: {
81
- title: string;
82
- description: string;
83
- page_age: string;
84
- url: string;
85
- thumbnail_url?: string | undefined;
86
- contents?: {
87
- html?: string | undefined;
88
- markdown?: string | undefined;
89
- } | undefined;
90
- }[] | undefined;
91
- };
92
- metadata: {
93
- search_uuid?: string | undefined;
94
- query?: string | undefined;
95
- latency?: number | undefined;
96
- };
97
- };
98
- };
@@ -1,9 +0,0 @@
1
- /**
2
- * You.com API endpoints
3
- *
4
- * These constants define the base URLs for You.com's APIs.
5
- * Exported for use in tests and external packages.
6
- */
7
- export declare const SEARCH_API_URL = "https://ydc-index.io/v1/search";
8
- export declare const EXPRESS_API_URL = "https://api.you.com/v1/agents/runs";
9
- export declare const CONTENTS_API_URL = "https://ydc-index.io/v1/contents";
@@ -1,6 +0,0 @@
1
- /**
2
- * Checks if a response object contains an error field and throws if found
3
- * Handles API responses that return 200 status but contain error messages
4
- * Used by both search and express agent utilities
5
- */
6
- export declare const checkResponseForErrors: (responseData: unknown) => unknown;
@@ -1,19 +0,0 @@
1
- /**
2
- * Generic search result type that works for both Search and Express APIs
3
- * Used by both search.utils.ts and express.utils.ts
4
- */
5
- type GenericSearchResult = {
6
- url: string;
7
- title: string;
8
- description?: string;
9
- snippet?: string;
10
- snippets?: string[];
11
- page_age?: string;
12
- };
13
- /**
14
- * Format array of search results into display text
15
- * Used by both search and express agent formatting
16
- * @param results - Array of search results to format
17
- */
18
- export declare const formatSearchResultsText: (results: GenericSearchResult[]) => string;
19
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * Generates a mailto link for error reporting with pre-filled context
3
- * Used by tool error handlers to provide easy error reporting
4
- */
5
- export declare const generateErrorReportLink: ({ errorMessage, tool, clientInfo, }: {
6
- errorMessage: string;
7
- tool: string;
8
- clientInfo: string;
9
- }) => string;
@@ -1,7 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import type { LoggingMessageNotification } from '@modelcontextprotocol/sdk/types.js';
3
- /**
4
- * Creates a logger function that sends messages through MCP server
5
- * Used by tool registration files
6
- */
7
- export declare const getLogger: (mcp: McpServer) => (params: LoggingMessageNotification["params"]) => Promise<void>;
@@ -1,6 +0,0 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- /**
3
- * Get's function that returns a formatted client version information into a string
4
- * Used by stdio.ts and http.ts for logging/debugging
5
- */
6
- export declare const useGetClientVersion: (mcp: McpServer) => () => string;
package/dist/stdio.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,99 +0,0 @@
1
- import * as z from 'zod';
2
-
3
- export const ExpressAgentInputSchema = z.object({
4
- input: z.string().min(1, 'Input is required').describe('Query or prompt'),
5
- tools: z
6
- .array(
7
- z.object({
8
- type: z.enum(['web_search']).describe('Tool type'),
9
- }),
10
- )
11
- .optional()
12
- .describe('Tools (web search only)'),
13
- });
14
-
15
- export type ExpressAgentInput = z.infer<typeof ExpressAgentInputSchema>;
16
-
17
- // API Response Schema - Validates the full response from You.com API
18
-
19
- // Search result content item from web_search.results
20
- // Note: thumbnail_url, source_type, and provider are API-only pass-through fields not used in MCP output
21
- const ApiSearchResultItemSchema = z.object({
22
- source_type: z.string().optional(),
23
- citation_uri: z.string().optional(), // Used as fallback for url in transformation
24
- url: z.string(),
25
- title: z.string(),
26
- snippet: z.string(),
27
- thumbnail_url: z.string().optional(), // API-only, not transformed to MCP output
28
- provider: z.any().optional(), // API-only, not transformed to MCP output
29
- });
30
-
31
- // Union of possible output item types from API
32
- const ExpressAgentApiOutputItemSchema = z.union([
33
- // web_search.results type - has content array, no text
34
- z.object({
35
- type: z.literal('web_search.results'),
36
- content: z.array(ApiSearchResultItemSchema),
37
- }),
38
- // message.answer type - has text, no content
39
- z.object({
40
- type: z.literal('message.answer'),
41
- text: z.string(),
42
- }),
43
- ]);
44
-
45
- export const ExpressAgentApiResponseSchema = z
46
- .object({
47
- output: z.array(ExpressAgentApiOutputItemSchema),
48
- agent: z.string().optional().describe('Agent identifier'),
49
- mode: z.string().optional().describe('Agent mode'),
50
- input: z.array(z.any()).optional().describe('Input messages'),
51
- })
52
- .passthrough();
53
-
54
- export type ExpressAgentApiResponse = z.infer<typeof ExpressAgentApiResponseSchema>;
55
-
56
- // MCP Output Schema - Defines what we return to the MCP client (answer + optional search results, token efficient)
57
-
58
- // Search result item for MCP output
59
- const McpSearchResultItemSchema = z.object({
60
- url: z.string().describe('URL'),
61
- title: z.string().describe('Title'),
62
- snippet: z.string().describe('Snippet'),
63
- });
64
-
65
- // MCP response structure: answer (always) + results (optional when web_search used)
66
- const ExpressAgentMcpResponseSchema = z.object({
67
- answer: z.string().describe('AI answer'),
68
- results: z
69
- .object({
70
- web: z.array(McpSearchResultItemSchema).describe('Web results'),
71
- })
72
- .optional()
73
- .describe('Search results'),
74
- agent: z.string().optional().describe('Agent ID'),
75
- });
76
-
77
- export type ExpressAgentMcpResponse = z.infer<typeof ExpressAgentMcpResponseSchema>;
78
-
79
- // Minimal schema for structuredContent (reduces payload duplication)
80
- export const ExpressStructuredContentSchema = z.object({
81
- answer: z.string().describe('AI answer'),
82
- hasResults: z.boolean().describe('Has web results'),
83
- resultCount: z.number().describe('Result count'),
84
- agent: z.string().optional().describe('Agent ID'),
85
- results: z
86
- .object({
87
- web: z
88
- .array(
89
- z.object({
90
- url: z.string().describe('URL'),
91
- title: z.string().describe('Title'),
92
- }),
93
- )
94
- .optional()
95
- .describe('Web results'),
96
- })
97
- .optional()
98
- .describe('Search results'),
99
- });
package/src/main.ts DELETED
@@ -1,9 +0,0 @@
1
- export * from './contents/contents.schemas.ts';
2
- export * from './contents/contents.utils.ts';
3
- export * from './express/express.schemas.ts';
4
- export * from './express/express.utils.ts';
5
- export * from './search/search.schemas.ts';
6
- export * from './search/search.utils.ts';
7
- export * from './shared/api-constants.ts';
8
- export * from './shared/check-response-for-errors.ts';
9
- export * from './shared/format-search-results-text.ts';