@bragduck/mcp 1.7.0 → 1.7.1

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/dist/index.js +1856 -122
  2. package/dist/index.js.map +1 -1
  3. package/package.json +6 -4
  4. package/dist/api-client.d.ts +0 -29
  5. package/dist/api-client.js +0 -146
  6. package/dist/api-client.js.map +0 -1
  7. package/dist/auth.d.ts +0 -8
  8. package/dist/auth.js +0 -202
  9. package/dist/auth.js.map +0 -1
  10. package/dist/credentials.d.ts +0 -31
  11. package/dist/credentials.js +0 -150
  12. package/dist/credentials.js.map +0 -1
  13. package/dist/index.d.ts +0 -2
  14. package/dist/org-preference.d.ts +0 -7
  15. package/dist/org-preference.js +0 -22
  16. package/dist/org-preference.js.map +0 -1
  17. package/dist/tools/link-brag-to-key-result.d.ts +0 -30
  18. package/dist/tools/link-brag-to-key-result.js +0 -81
  19. package/dist/tools/link-brag-to-key-result.js.map +0 -1
  20. package/dist/tools/list-brags.d.ts +0 -53
  21. package/dist/tools/list-brags.js +0 -110
  22. package/dist/tools/list-brags.js.map +0 -1
  23. package/dist/tools/list-objectives.d.ts +0 -15
  24. package/dist/tools/list-objectives.js +0 -66
  25. package/dist/tools/list-objectives.js.map +0 -1
  26. package/dist/tools/list-organisations.d.ts +0 -15
  27. package/dist/tools/list-organisations.js +0 -73
  28. package/dist/tools/list-organisations.js.map +0 -1
  29. package/dist/tools/list-stories.d.ts +0 -41
  30. package/dist/tools/list-stories.js +0 -103
  31. package/dist/tools/list-stories.js.map +0 -1
  32. package/dist/tools/log-brag.d.ts +0 -88
  33. package/dist/tools/log-brag.js +0 -175
  34. package/dist/tools/log-brag.js.map +0 -1
  35. package/dist/tools/log-story.d.ts +0 -81
  36. package/dist/tools/log-story.js +0 -122
  37. package/dist/tools/log-story.js.map +0 -1
  38. package/dist/tools/login.d.ts +0 -24
  39. package/dist/tools/login.js +0 -46
  40. package/dist/tools/login.js.map +0 -1
  41. package/dist/tools/preview-brag.d.ts +0 -71
  42. package/dist/tools/preview-brag.js +0 -103
  43. package/dist/tools/preview-brag.js.map +0 -1
  44. package/dist/tools/quick-brag.d.ts +0 -38
  45. package/dist/tools/quick-brag.js +0 -143
  46. package/dist/tools/quick-brag.js.map +0 -1
  47. package/dist/tools/save-org-preference.d.ts +0 -30
  48. package/dist/tools/save-org-preference.js +0 -47
  49. package/dist/tools/save-org-preference.js.map +0 -1
@@ -1,110 +0,0 @@
1
- import { apiRequest, requirePaidPlan } from '../api-client.js';
2
- export const listBragsTool = {
3
- name: 'list_brags',
4
- description: 'List recent brags (career achievements) from BragDuck. ' +
5
- 'Use this to review past accomplishments, find brags to link to keyResults, or check recent entries.',
6
- inputSchema: {
7
- type: 'object',
8
- properties: {
9
- limit: {
10
- type: 'number',
11
- description: 'Number of brags to return (default: 10, max: 100)',
12
- },
13
- search: {
14
- type: 'string',
15
- description: 'Search term to filter brags by title or description',
16
- },
17
- tags: {
18
- type: 'array',
19
- items: { type: 'string' },
20
- description: 'Filter brags by tags',
21
- },
22
- date_from: {
23
- type: 'string',
24
- description: 'Filter brags from this date (YYYY-MM-DD)',
25
- },
26
- date_to: {
27
- type: 'string',
28
- description: 'Filter brags up to this date (YYYY-MM-DD)',
29
- },
30
- sort: {
31
- type: 'string',
32
- enum: ['date_asc', 'date_desc', 'title_asc', 'title_desc', 'created_asc', 'created_desc'],
33
- description: 'Sort order (default: date_desc)',
34
- },
35
- },
36
- },
37
- };
38
- const IMPACT_LABELS = {
39
- 0: 'None',
40
- 1: 'Low',
41
- 2: 'Medium',
42
- 3: 'High',
43
- };
44
- export async function handleListBrags(input) {
45
- const planError = await requirePaidPlan();
46
- if (planError)
47
- return planError;
48
- try {
49
- const params = {
50
- limit: String(input.limit || 10),
51
- offset: '0',
52
- };
53
- if (input.search)
54
- params.search = input.search;
55
- if (input.tags && input.tags.length > 0)
56
- params['tags[]'] = input.tags;
57
- if (input.date_from)
58
- params.date_from = input.date_from;
59
- if (input.date_to)
60
- params.date_to = input.date_to;
61
- if (input.sort)
62
- params.sort = input.sort;
63
- const response = await apiRequest('/v1/brags', { params });
64
- if (response.brags.length === 0) {
65
- return {
66
- content: [{ type: 'text', text: 'No brags found.' }],
67
- };
68
- }
69
- const lines = response.brags.map((brag) => {
70
- const tags = brag.tags.length > 0 ? ` [${brag.tags.join(', ')}]` : '';
71
- const date = new Date(brag.date).toLocaleDateString();
72
- const impact = `Impact: ${IMPACT_LABELS[brag.impactLevel ?? 0] ?? (brag.impactLevel ?? 0)}`;
73
- const type = brag.type ? ` | Type: ${brag.type}` : '';
74
- const keyResultNote = brag.keyResultIds?.length > 0
75
- ? `\n Linked to key result: ${brag.keyResultIds[0]}`
76
- : '';
77
- const impactDesc = brag.impactDescription ? `\n Impact: ${brag.impactDescription}` : '';
78
- return (`- **${brag.title}** (ID: ${brag.id}, ${date})${tags}\n` +
79
- ` ${impact}${type}` +
80
- impactDesc +
81
- keyResultNote +
82
- `\n ${brag.description.slice(0, 150)}${brag.description.length > 150 ? '...' : ''}` +
83
- `\n View: ${brag.url}`);
84
- });
85
- const { total, has_more } = response.pagination;
86
- const summary = `Found ${total} brags (showing ${response.brags.length}${has_more ? ', more available' : ''}):`;
87
- return {
88
- content: [{ type: 'text', text: `${summary}\n\n${lines.join('\n\n')}` }],
89
- };
90
- }
91
- catch (error) {
92
- if (error instanceof Error && (error.message === 'NOT_AUTHENTICATED' || error.message === 'TOKEN_EXPIRED')) {
93
- return {
94
- content: [{
95
- type: 'text',
96
- text: 'Not authenticated with BragDuck. Please call the "login" tool first.',
97
- }],
98
- isError: true,
99
- };
100
- }
101
- return {
102
- content: [{
103
- type: 'text',
104
- text: `Failed to list brags: ${error instanceof Error ? error.message : String(error)}`,
105
- }],
106
- isError: true,
107
- };
108
- }
109
- }
110
- //# sourceMappingURL=list-brags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-brags.js","sourceRoot":"","sources":["../../src/tools/list-brags.ts"],"names":[],"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AAE,CAAC;SACzE,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,mBAAmB,IAAI,KAAK,CAAC,OAAO,KAAK,eAAe,CAAC,EAAE,CAAC;YAC3G,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sEAAsE;qBAC7E,CAAC;gBACF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBACxF,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const listObjectivesTool: {
2
- name: string;
3
- description: string;
4
- inputSchema: {
5
- type: "object";
6
- properties: {};
7
- };
8
- };
9
- export declare function handleListObjectives(): Promise<{
10
- content: Array<{
11
- type: string;
12
- text: string;
13
- }>;
14
- isError?: boolean;
15
- }>;
@@ -1,66 +0,0 @@
1
- import { apiRequest, requirePaidPlan } from '../api-client.js';
2
- import { getUserInfo } from '../credentials.js';
3
- export const listObjectivesTool = {
4
- name: 'list_objectives',
5
- description: 'List OKRs (Objectives and Key Results) from BragDuck. ' +
6
- 'Use this to see current keyResults and their IDs, which can be used to link brags to specific keyResults.',
7
- inputSchema: {
8
- type: 'object',
9
- properties: {},
10
- },
11
- };
12
- export async function handleListObjectives() {
13
- const planError = await requirePaidPlan();
14
- if (planError)
15
- return planError;
16
- try {
17
- const userInfo = getUserInfo();
18
- if (!userInfo) {
19
- return {
20
- content: [{
21
- type: 'text',
22
- text: 'Not authenticated with BragDuck. Please call the "login" tool first.',
23
- }],
24
- isError: true,
25
- };
26
- }
27
- const response = await apiRequest(`/v1/users/${userInfo.id}/objectives`);
28
- if (response.items.length === 0) {
29
- return {
30
- content: [{ type: 'text', text: 'No objectives found.' }],
31
- };
32
- }
33
- const lines = response.items.map((obj) => {
34
- const keyResults = obj.keyResults
35
- .map((g) => ` - ${g.label} (KeyResult ID: ${g.id}, status: ${g.status})`)
36
- .join('\n');
37
- const category = obj.category ? ` [${obj.category}]` : '';
38
- return `- **${obj.title}** (ID: ${obj.id}, status: ${obj.status})${category}\n${keyResults || ' (no keyResults)'}`;
39
- });
40
- return {
41
- content: [{
42
- type: 'text',
43
- text: `Found ${response.total} objectives:\n\n${lines.join('\n\n')}`,
44
- }],
45
- };
46
- }
47
- catch (error) {
48
- if (error instanceof Error && (error.message === 'NOT_AUTHENTICATED' || error.message === 'TOKEN_EXPIRED')) {
49
- return {
50
- content: [{
51
- type: 'text',
52
- text: 'Not authenticated with BragDuck. Please call the "login" tool first.',
53
- }],
54
- isError: true,
55
- };
56
- }
57
- return {
58
- content: [{
59
- type: 'text',
60
- text: `Failed to list objectives: ${error instanceof Error ? error.message : String(error)}`,
61
- }],
62
- isError: true,
63
- };
64
- }
65
- }
66
- //# sourceMappingURL=list-objectives.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-objectives.js","sourceRoot":"","sources":["../../src/tools/list-objectives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,wDAAwD;QACxD,2GAA2G;IAC7G,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE,EAAE;KACf;CACF,CAAC;AAOF,MAAM,CAAC,KAAK,UAAU,oBAAoB;IAIxC,MAAM,SAAS,GAAG,MAA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M;oBACZ,IAAI,EAAE,SAAS,QAAQ,CAAC,KAAK,mBAAmB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;iBACrE,CAAC;SACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,mBAAmB,IAAI,KAAK,CAAC,OAAO,KAAK,eAAe,CAAC,EAAE,CAAC;YAC3G,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sEAAsE;qBAC7E,CAAC;gBACF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,8BAA8B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC7F,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const listOrganisationsTool: {
2
- name: string;
3
- description: string;
4
- inputSchema: {
5
- type: "object";
6
- properties: {};
7
- };
8
- };
9
- export declare function handleListOrganisations(): Promise<{
10
- content: Array<{
11
- type: string;
12
- text: string;
13
- }>;
14
- isError?: boolean;
15
- }>;
@@ -1,73 +0,0 @@
1
- import { apiRequest, requirePaidPlan } from '../api-client.js';
2
- import { getUserInfo } from '../credentials.js';
3
- import { getOrgPreference } from '../org-preference.js';
4
- export const listOrganisationsTool = {
5
- name: 'list_organisations',
6
- description: 'List the user\'s organisations (companies) from BragDuck. ' +
7
- 'Also returns the saved organisation preference for the current working directory, if any. ' +
8
- 'Use this before logging a brag to determine which company to associate it with.',
9
- inputSchema: {
10
- type: 'object',
11
- properties: {},
12
- },
13
- };
14
- export async function handleListOrganisations() {
15
- const planError = await requirePaidPlan();
16
- if (planError)
17
- return planError;
18
- try {
19
- const userInfo = getUserInfo();
20
- if (!userInfo) {
21
- return {
22
- content: [{
23
- type: 'text',
24
- text: 'Not authenticated with BragDuck. Please call the "login" tool first.',
25
- }],
26
- isError: true,
27
- };
28
- }
29
- const response = await apiRequest(`/v1/users/${userInfo.id}/organisations`);
30
- if (response.items.length === 0) {
31
- return {
32
- content: [{
33
- type: 'text',
34
- text: 'No organisations found. You can add companies in the BragDuck web app.',
35
- }],
36
- };
37
- }
38
- const cwd = process.cwd();
39
- const saved = getOrgPreference(cwd);
40
- const lines = response.items.map((org) => {
41
- const status = org.current ? 'current' : 'former';
42
- return `- **${org.name}** (ID: ${org.id}, role: ${org.role}, ${status})`;
43
- });
44
- const savedLine = saved
45
- ? `\nSaved preference for this directory: **${saved.orgName}** (ID: ${saved.orgId})`
46
- : '\nNo saved preference for this directory.';
47
- return {
48
- content: [{
49
- type: 'text',
50
- text: `Found ${response.items.length} organisation(s):\n\n${lines.join('\n')}${savedLine}`,
51
- }],
52
- };
53
- }
54
- catch (error) {
55
- if (error instanceof Error && (error.message === 'NOT_AUTHENTICATED' || error.message === 'TOKEN_EXPIRED')) {
56
- return {
57
- content: [{
58
- type: 'text',
59
- text: 'Not authenticated with BragDuck. Please call the "login" tool first.',
60
- }],
61
- isError: true,
62
- };
63
- }
64
- return {
65
- content: [{
66
- type: 'text',
67
- text: `Failed to list organisations: ${error instanceof Error ? error.message : String(error)}`,
68
- }],
69
- isError: true,
70
- };
71
- }
72
- }
73
- //# sourceMappingURL=list-organisations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-organisations.js","sourceRoot":"","sources":["../../src/tools/list-organisations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CA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AG,CAAC,IAAI,KAAK,MAAM,GAAG,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,KAAK;YACrB,CAAC,CAAC,4CAA4C,KAAK,CAAC,OAAO,WAAW,KAAK,CAAC,KAAK,GAAG;YACpF,CAAC,CAAC,2CAA2C,CAAC;QAEhD,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS,QAAQ,CAAC,KAAK,CAAC,MAAM,wBAAwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,EAAE;iBAC3F,CAAC;SACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,mBAAmB,IAAI,KAAK,CAAC,OAAO,KAAK,eAAe,CAAC,EAAE,CAAC;YAC3G,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sEAAsE;qBAC7E,CAAC;gBACF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAChG,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,41 +0,0 @@
1
- export declare const listStoriesTool: {
2
- name: string;
3
- description: string;
4
- inputSchema: {
5
- type: "object";
6
- properties: {
7
- limit: {
8
- type: string;
9
- minimum: number;
10
- maximum: number;
11
- description: string;
12
- };
13
- category: {
14
- type: string;
15
- description: string;
16
- };
17
- orgId: {
18
- type: string;
19
- description: string;
20
- };
21
- search: {
22
- type: string;
23
- description: string;
24
- };
25
- };
26
- };
27
- };
28
- interface ListStoriesInput {
29
- limit?: number;
30
- category?: string;
31
- orgId?: string;
32
- search?: string;
33
- }
34
- export declare function handleListStories(input: ListStoriesInput): Promise<{
35
- content: Array<{
36
- type: string;
37
- text: string;
38
- }>;
39
- isError?: boolean;
40
- }>;
41
- export {};
@@ -1,103 +0,0 @@
1
- import { apiRequest, requirePaidPlan } from '../api-client.js';
2
- import { getUserInfo } from '../credentials.js';
3
- import { STORY_CATEGORY_LABELS } from '@bragduck/types';
4
- export const listStoriesTool = {
5
- name: 'list_stories',
6
- description: 'List STAR interview stories from BragDuck. ' +
7
- 'Use when the user wants to review their interview stories or search for stories by category.',
8
- inputSchema: {
9
- type: 'object',
10
- properties: {
11
- limit: {
12
- type: 'number',
13
- minimum: 1,
14
- maximum: 100,
15
- description: 'Max stories to return (default 10)',
16
- },
17
- category: {
18
- type: 'string',
19
- description: 'Filter by category (e.g. leadership, technical_excellence, problem_solving)',
20
- },
21
- orgId: {
22
- type: 'string',
23
- description: 'Filter by organisation ID',
24
- },
25
- search: {
26
- type: 'string',
27
- description: 'Search stories by keyword',
28
- },
29
- },
30
- },
31
- };
32
- export async function handleListStories(input) {
33
- const planError = await requirePaidPlan();
34
- if (planError)
35
- return planError;
36
- try {
37
- const userInfo = getUserInfo();
38
- if (!userInfo) {
39
- return {
40
- content: [{
41
- type: 'text',
42
- text: 'Not authenticated with BragDuck. Please call the "login" tool first.',
43
- }],
44
- isError: true,
45
- };
46
- }
47
- const params = {
48
- page: '1',
49
- perPage: String(input.limit || 10),
50
- };
51
- if (input.category)
52
- params.category = input.category;
53
- if (input.orgId)
54
- params.orgId = input.orgId;
55
- if (input.search)
56
- params.search = input.search;
57
- const response = await apiRequest(`/v1/users/${userInfo.id}/stories`, { params });
58
- if (response.items.length === 0) {
59
- return {
60
- content: [{ type: 'text', text: 'No stories found.' }],
61
- };
62
- }
63
- const lines = response.items.map((story) => {
64
- const categoryLabel = story.category
65
- ? STORY_CATEGORY_LABELS[story.category]
66
- : null;
67
- const categoryPart = categoryLabel ? `Category: ${categoryLabel} | ` : '';
68
- const strengthPart = `Strength: ${story.strengthScore ?? '-'}/10`;
69
- const impactPart = `Impact: ${story.impactScore ?? '-'}/10`;
70
- const summary = story.aiSummary || 'No AI summary yet';
71
- const competencies = story.competencies.length > 0
72
- ? story.competencies.join(', ')
73
- : 'None';
74
- return (`**${story.title}** (ID: ${story.id})\n` +
75
- `${categoryPart}${strengthPart} | ${impactPart}\n` +
76
- `${summary}\n` +
77
- `Competencies: ${competencies}`);
78
- });
79
- const summary = `Found ${response.total} stories (showing ${response.items.length}):`;
80
- return {
81
- content: [{ type: 'text', text: `${summary}\n\n${lines.join('\n\n')}` }],
82
- };
83
- }
84
- catch (error) {
85
- if (error instanceof Error && (error.message === 'NOT_AUTHENTICATED' || error.message === 'TOKEN_EXPIRED')) {
86
- return {
87
- content: [{
88
- type: 'text',
89
- text: 'Not authenticated with BragDuck. Please call the "login" tool first.',
90
- }],
91
- isError: true,
92
- };
93
- }
94
- return {
95
- content: [{
96
- type: 'text',
97
- text: `Failed to list stories: ${error instanceof Error ? error.message : String(error)}`,
98
- }],
99
- isError: true,
100
- };
101
- }
102
- }
103
- //# sourceMappingURL=list-stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list-stories.js","sourceRoot":"","sources":["../../src/tools/list-stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,6CAA6C;QAC7C,8FAA8F;IAChG,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAA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MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;SACzE,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,mBAAmB,IAAI,KAAK,CAAC,OAAO,KAAK,eAAe,CAAC,EAAE,CAAC;YAC3G,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,sEAAsE;qBAC7E,CAAC;gBACF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC1F,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,88 +0,0 @@
1
- export declare const logBragTool: {
2
- name: string;
3
- description: string;
4
- inputSchema: {
5
- type: "object";
6
- properties: {
7
- title: {
8
- type: string;
9
- minLength: number;
10
- maxLength: number;
11
- description: string;
12
- };
13
- description: {
14
- type: string;
15
- minLength: number;
16
- maxLength: number;
17
- description: string;
18
- };
19
- tags: {
20
- type: string;
21
- items: {
22
- type: string;
23
- minLength: number;
24
- maxLength: number;
25
- };
26
- maxItems: number;
27
- description: string;
28
- };
29
- date: {
30
- type: string;
31
- description: string;
32
- };
33
- impact_level: {
34
- type: string;
35
- enum: number[];
36
- description: string;
37
- };
38
- impact_description: {
39
- type: string;
40
- description: string;
41
- };
42
- type: {
43
- type: string;
44
- enum: string[];
45
- description: string;
46
- };
47
- references: {
48
- type: string;
49
- items: {
50
- type: string;
51
- format: string;
52
- };
53
- maxItems: number;
54
- description: string;
55
- };
56
- orgId: {
57
- type: string;
58
- description: string;
59
- };
60
- agent: {
61
- type: string;
62
- maxLength: number;
63
- description: string;
64
- };
65
- };
66
- required: string[];
67
- };
68
- };
69
- interface LogBragInput {
70
- title: string;
71
- description: string;
72
- type: string;
73
- impact_level: number;
74
- impact_description: string;
75
- tags?: string[];
76
- date?: string;
77
- references?: string[];
78
- orgId?: string;
79
- agent?: string;
80
- }
81
- export declare function handleLogBrag(input: LogBragInput): Promise<{
82
- content: Array<{
83
- type: string;
84
- text: string;
85
- }>;
86
- isError?: boolean;
87
- }>;
88
- export {};